1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-19 21:32:19 +00:00
cc65/testcode/lib/time-test.c
cuz 730a75cce5 New module time-test.c
git-svn-id: svn://svn.cc65.org/cc65/trunk@1505 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-11-12 22:01:17 +00:00

33 lines
695 B
C

#include <stdio.h>
#include <time.h>
int main (void)
{
struct tm tm;
time_t t;
tm.tm_sec = 9;
tm.tm_min = 34;
tm.tm_hour = 21;
tm.tm_mday = 12;
tm.tm_mon = 10; /* 0..11, so this is november */
tm.tm_year = 102; /* year - 1900, so this is 2002 */
tm.tm_wday = 2; /* Tuesday */
tm.tm_isdst = 0;
/* Convert this broken down time into a time_t and back */
t = mktime (&tm);
printf ("Test passes if the following lines are\n"
"identical:\n");
printf ("3DD173D1 - Tue Nov 12 21:34:09 2002\n");
printf ("%08lX - %s", t, asctime (&tm));
printf ("%08lX - %s", t, asctime (gmtime (&t)));
return 0;
}