Commit | Line | Data |
---|---|---|
21a22afe | 1 | /* |
2 | * Portable implementation of ltime() for any ISO-C platform where | |
3 | * time_t behaves. (In practice, we've found that platforms such as | |
4 | * Windows and Mac have needed their own specialised implementations.) | |
5 | */ | |
6 | ||
aca589d9 | 7 | #include <time.h> |
8 | #include <assert.h> | |
9 | ||
10 | struct tm ltime(void) | |
11 | { | |
12 | time_t t; | |
13 | time(&t); | |
14 | assert (t != ((time_t)-1)); | |
15 | return *localtime(&t); | |
16 | } |