File:  [ELWIX - Embedded LightWeight unIX -] / libelwix / example / test_time.c
Revision 1.1.2.1: download - view: text, annotated - select for diffs - revision graph
Thu Mar 7 15:41:11 2013 UTC (11 years, 2 months ago) by misho
Branches: elwix1_1
added new UT

#include <stdio.h>
#include <string.h>
#include <time.h>
#include <elwix.h>


int
main(int argc, char **argv)
{
	time_t tim;
	struct tm *tm;
	char str[BUFSIZ];

	if (argc < 2)
		return 1;

	memset(str, 0, sizeof str);

	tim = time_Parse(argv[1]);
	printf("time_t=%u\n", tim);

	tm = localtime(&tim);
	strftime(str, sizeof str, "%Y-%m-%d %H:%M:%S", tm);
	printf("Time:: %s\n", str);

	return 0;
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>