File:
[ELWIX - Embedded LightWeight unIX -] /
libelwix /
example /
test_time.c
Revision
1.3:
download - view:
text,
annotated -
select for diffs -
revision graph
Mon Apr 15 10:42:26 2024 UTC (10 months, 1 week ago) by
misho
Branches:
MAIN
CVS tags:
elwix6_7,
elwix6_6,
elwix6_5,
elwix6_4,
elwix6_3,
elwix6_2,
elwix6_1,
elwix5_12,
HEAD,
ELWIX6_6,
ELWIX6_5,
ELWIX6_4,
ELWIX6_2,
ELWIX6_1,
ELWIX6_0,
ELWIX5_11
Version 5.11
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=%lu\n", tim);
21: if (tim == (time_t) -1) {
22: ELIBERR(elwix);
23: return 2;
24: }
25:
26: tm = localtime(&tim);
27: strftime(str, sizeof str, "%Y-%m-%d %H:%M:%S", tm);
28: printf("Time:: %s\n", str);
29:
30: return 0;
31: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>