### Tsettimeofday()

LONG Tsettimeofday( tv, tzp)

timeval *tv;
timezone *tzp;

| Tsettimeofday() sets the state of the internal, high resolution system clock.
Opcode | 342 (0x0156)
Availability | Available when a MiNT kernel of a version at least 1.15.0 release is detected.
Parameters | The argument tv is a pointer to the following structure:
    struct timeval
    {
    	long int tv_sec;
    	long int tv_usec;
    };
tv_sec holds the number of seconds elapsed since the epoch. The epoch is Thu, Jan 1 1970 00:00:00 UTC. tv_usec holds the fractional part of tv_sec measured in microseconds. The argument tzp is a pointer to another structure:
    struct timezone
    {
    	long int tz_minuteswest;
    	long int tz_dsttime;
    };
tz_minuteswest holds the offset to UTC in seconds. Timezones east of the zero-meridian (e.g. Eastern Europe) have a negative offset, timezones west of the zero-meridian (e.g. America) have a positive one. tz_dsttime is non-zero, if daylight savings time applies during some part of the year. You may safely pass NULL for either argument. This isn't considered an error.
Return value | The following error conditions are defined: EPERM - an attempt was made by a user without super-user privileges to change the system time or system time zone information. EBADARG - one of the arguments is out of range. Note that the kernel time cannot be set to dates before Jan 1 1980 00:00:00 and after some day in 2038 (yep, MAX_LONG seconds since the epoch). Timezone offsets must be in the range of +/- 720 minutes.
Binding |
    pea	tzp
    pea	tv
    move.w  #$0156,-(sp)
    trap    #1
    lea     $0a(sp),sp
Caveats | Implementors of library bindings should be aware that the definition of struct timezone is non-standard. The members are actually int and not long int (this applies only to struct timezone; the members of struct timeval are always long). 16-bit libraries will have to copy the contents of the structure that tzp points to.
Comments | The tz_dsttime member of timezone is stored, but not evaluated within the kernel. Beware not to misunderstand its meaning: if non-zero it simply signifies that daylight savings time apply during some part of the year, not necessarily now. In other words: if it is non-zero someday, it should be non-zero during the entire year. The Ssystem() call has a command S_CLOCKMODE. This command allows to retrieve or set the kernel clock mode, i.e. to specify whether the hardware clock is meant to run in UTC or in local time. It is planned to make MiNT compliant with the kernel time keeping model described in RFC1305. This model is already successfully implemented in operating systems such as SunOS, Ultrix, OSF/1, HP-UX and Linux. Please expect the internal realization to change in the future.
See also | Ssystem(), Tgettimeofday()