FreeCalypso > hg > fc-sim-sniff
comparison sw/sniff-rx/datetime.c @ 22:b112c2df6c43
sw: simtrace3-sniff-rx program written, compiles
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 22 Aug 2023 06:16:44 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
21:c4346cdc9641 | 22:b112c2df6c43 |
---|---|
1 /* | |
2 * Some date and time handling functions for simtrace3-sniff-rx. | |
3 */ | |
4 | |
5 #include <sys/time.h> | |
6 #include <stdio.h> | |
7 #include <stdlib.h> | |
8 #include <string.h> | |
9 #include <strings.h> | |
10 #include <time.h> | |
11 | |
12 extern FILE *main_outf; | |
13 extern struct timeval curtime; | |
14 | |
15 struct tm *cur_tm; | |
16 | |
17 static struct tm last_tm; | |
18 | |
19 void | |
20 current_date_time() | |
21 { | |
22 cur_tm = gmtime(&curtime.tv_sec); | |
23 if (cur_tm->tm_year != last_tm.tm_year || | |
24 cur_tm->tm_mon != last_tm.tm_mon || | |
25 cur_tm->tm_mday != last_tm.tm_mday) | |
26 fprintf(main_outf, "%d-%02d-%02d (gmtime):\n", | |
27 cur_tm->tm_year + 1900, cur_tm->tm_mon + 1, | |
28 cur_tm->tm_mday); | |
29 bcopy(cur_tm, &last_tm, sizeof(struct tm)); | |
30 } |