<< Previous | Next >>

rtc_timezone

int rtc_timezone( long * seconds, char * tzname );

Description

This function returns the timezone offset as known by the library. The timezone is obtained from the following sources, in order of preference:

  1. The DHCP server. This can only be used if the TCP/IP stack is in use, and USE_DHCP is defined.

  2. The TIMEZONE macro. This should be defined by the program to an _hour_ offset - may be floating point.

Parameters

seconds
Pointer to result longword. This will be set to the number of seconds offset from Coordinated Universal Time (UTC). The value will be negative for west; positive for east of Greenwich.

tzname
If null, no timezone name is returned. Otherwise, this must point to a buffer of at least 7 bytes. The buffer is set to a null-terminated string of between 0 and 6 characters in length, according to the value of the TZNAME macro. If TZNAME is not defined, then the returned string is zero length ("").

Return value

 0: timezone obtained from DHCP.
-1: timezone obtained from TIMEZONE macro. The value of this macro (which may be int, float or a variable name) is multiplied by 3600 to form the return value.
-2: timezone is zero since the TIMEZONE macro was not defined.

Library

RTCLOCK.LIB


Dynamic C Functions << Previous | Next >> rabbit.com