]> git.lizzy.rs Git - plan9front.git/blob - sys/src/libc/9sys/ctime.c
libtags, zuke: add *.mod support (thanks kemal)
[plan9front.git] / sys / src / libc / 9sys / ctime.c
1 #include <u.h>
2 #include <libc.h>
3
4 Tm*
5 localtime(long tim)
6 {
7         static Tm tm;
8         Tzone *tz;
9
10         /*
11          * We have no way to report errors,
12          * so we just ignore them here.
13          */
14         tz = tzload("local");
15         tmtime(&tm, tim, tz);
16         return &tm;
17 }
18
19 Tm*
20 gmtime(long abs)
21 {
22         static Tm tm;
23         return tmtime(&tm, abs, nil);
24 }
25
26 char*
27 ctime(long abs)
28 {
29         Tzone *tz;
30         Tm tm;
31
32         /*
33          * We have no way to report errors,
34          * so we just ignore them here.
35          */
36         tz = tzload("local");
37         tmtime(&tm, abs, tz);
38         return asctime(&tm);
39 }