1
0

feat: Initial commit

This commit is contained in:
2024-03-22 17:37:24 +01:00
parent 4288bd63a1
commit 6732a7a166
120 changed files with 9620 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
// Laboratorio 8 - Esercizio 3 - Datetime.c
// Matteo Schiff - s295565
#include <stdbool.h>
#include <stdio.h>
#include "Datetime.h"
int DateTimeCompare(DateTime a, DateTime b) {
if (a.year > b.year)
return 1;
else if (a.year < b.year)
return -1;
if (a.month > b.month)
return 1;
else if (a.month < b.month)
return -1;
if (a.day > b.day)
return 1;
else if (a.day < b.day)
return -1;
return 0;
}
int DateTimeRead(DateTime * dt, FILE * fp) {
return fscanf(fp, " %d/%d/%d %d:%d", &dt->year, &dt->month,&dt->day,&dt->hours,&dt->minutes) == 5;
}
int DateRead(DateTime * dt, FILE * fp) {
dt->hours = 0;
dt->minutes = 0;
return fscanf(fp, " %d/%d/%d", &dt->year, &dt->month,&dt->day) == 3;
}