FreeCalypso > hg > fc-sim-sniff
view sw/sniff-rx/datetime.c @ 32:fb9c03515832
sw/sniff-rx/Makefile: add install
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 29 Aug 2023 21:44:22 +0000 |
parents | b112c2df6c43 |
children |
line wrap: on
line source
/* * Some date and time handling functions for simtrace3-sniff-rx. */ #include <sys/time.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <time.h> extern FILE *main_outf; extern struct timeval curtime; struct tm *cur_tm; static struct tm last_tm; void current_date_time() { cur_tm = gmtime(&curtime.tv_sec); if (cur_tm->tm_year != last_tm.tm_year || cur_tm->tm_mon != last_tm.tm_mon || cur_tm->tm_mday != last_tm.tm_mday) fprintf(main_outf, "%d-%02d-%02d (gmtime):\n", cur_tm->tm_year + 1900, cur_tm->tm_mon + 1, cur_tm->tm_mday); bcopy(cur_tm, &last_tm, sizeof(struct tm)); }