view sw/sniff-rx/datetime.c @ 51:8a3003860cf8

doc/Sniffing-hw-setup: wire assignments for mv-sniffer setup
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 24 Sep 2023 01:15:44 +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));
}