FreeCalypso > hg > fc-sim-sniff
view sw/sniff-rx/datetime.c @ 27:990ecafdddb4
fpga tree: move icestick.pcf to common subdirectory
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 29 Aug 2023 18:10:41 +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)); }