amiga-tz/utility/timezoneinfo.c

33 lines
809 B
C

#include "tzversion.h"
int main(const int argc, char *argv[])
{
struct tm tm;
struct offset {
int hours, mins;
} offset;
time_t now ;
const char* loc;
amiga_open_libs();
now = time(NULL);
localtime_r(&now, &tm);
offset.hours = tm.tm_gmtoff / 60 / 60;
offset.mins = tm.tm_gmtoff / 60 - offset.hours * 60;
loc = tzgetlocation();
FPrintf(Output(), (STRPTR)"Location is %s\n", loc);
FPrintf(Output(), (STRPTR)"Time zone is %s\n", tm.tm_zone);
FPrintf(Output(), (STRPTR)"GMT offset is %ld hours and %ld minutes.\n", offset.hours, offset.mins);
if (tm.tm_isdst) {
FPrintf(Output(), (STRPTR)"It is daylight-saving time.\n");
} else {
FPrintf(Output(), (STRPTR)"It is not daylight-saving time.\n");
}
return 0;
}