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

    1: #include <stdio.h>
    2: #include <string.h>
    3: #include <time.h>
    4: #include <elwix.h>
    5: 
    6: 
    7: int
    8: main(int argc, char **argv)
    9: {
   10: 	time_t tim;
   11: 	struct tm *tm;
   12: 	char str[BUFSIZ];
   13: 
   14: 	if (argc < 2)
   15: 		return 1;
   16: 
   17: 	memset(str, 0, sizeof str);
   18: 
   19: 	tim = time_Parse(argv[1]);
   20: 	printf("time_t=%u\n", tim);
   21: 
   22: 	tm = localtime(&tim);
   23: 	strftime(str, sizeof str, "%Y-%m-%d %H:%M:%S", tm);
   24: 	printf("Time:: %s\n", str);
   25: 
   26: 	return 0;
   27: }

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