FreeCalypso > hg > fc-sim-sniff
view sw/sniff-rx/datetime.c @ 57:eb4274e7f4da
simsniff-dec: decode SELECT file IDs
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 04 Oct 2023 03:54:00 +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)); }