1
0
mirror of https://frontier.innolan.net/rainlance/amiga-tz.git synced 2025-11-23 16:43:20 +00:00

AmigaOS changes

This commit is contained in:
llsth
2015-06-25 22:28:02 +02:00
parent 06cd2ed30a
commit 477a573d18
6 changed files with 126 additions and 111 deletions

View File

@ -161,6 +161,8 @@ int create_timer()
//
// The return value is also stored in * tloc , provided that tloc is non-null.
//
// NOTICE: This function does not comply with above specifications yet.
//
tz_time_t time(tz_time_t *tloc)
{
struct LocaleBase* localeBase;
@ -186,6 +188,14 @@ tz_time_t time(tz_time_t *tloc)
GetSysTime(&tv);
// TODO: Check TZPatch envvar
// If set time is gmt -> Do not use locale to modify
// If not set, time is local -> use locale to modify
// TODO: Check TZ envvar is valid
// If set time is locale -> use TZ gmtoffset to get gmt.
// if not set, ignore value
if (tloc) {
*tloc = (time_t)tv.tv_secs - locale->loc_GMTOffset * 60; // Check for TZ GMT offset
}
@ -237,6 +247,14 @@ int settimeofday(const struct timeval *tv, const struct timezone *tz)
return error;
}
// TODO: Check TZPatch envvar
// If set time is gmt -> Do not use locale to modify
// If not set, time is local -> use locale to modify
// TODO: Check TZ envvar is valid
// If set time is locale -> use TZ gmtoffset to get gmt.
// if not set, ignore value
request->tr_node.io_Command = TR_SETSYSTIME;
request->tr_time.tv_secs = (long)tv->tv_secs - AMIGAOFFSET + locale->loc_GMTOffset * 60;
request->tr_time.tv_micro = tv->tv_micro;
@ -250,6 +268,20 @@ int settimeofday(const struct timeval *tv, const struct timezone *tz)
return error;
}
/**********************************************************************/
int gettime(struct timeval *tv)
{
int error = create_timer();
if (error != 0) {
return error;
}
GetSysTime(tv);
error = delete_timer();
return error;
}
int settime(struct timeval *tv)
{
int error = create_timer();