Home  Contents

clock.tzset

Date/Time Core4 Lua Commands

SYNOPSIS

  1. clock.tzset([tz])
  2. tz, name, dstname, offset = clock.tzget()

DESCRIPTION

The function clock.tzset() initializes the timezone information so conversions between UTC and localtime can be done.

This function is called automatically with the contents of the TZ environment variable the first time any function that needs timezone information is called. Since TZ is initialized from the global kconfig configuration area on startup, timezone support is thus fully automatic.

If clock.tzset() is called manually, the optionally passed parameter tz is stored into the TZ environment variable before doing the initialization.

The function clock.tzget() reports the currently configured timezone information.

RETURN VALUE

The function clock.tzget() returns four values: The tz value that was used when calling clock.tzset(), the name of the local timezone, the dstname of the local timezone while daylight saving rules apply, and finally the offset of the local timezone to UTC.

The function clock.tzset() does not return any success/failure value, since the underlying C standard library call doesn't, either.

EXAMPLE

print(clock.tzget())
Europe/Berlin CET CEST -3600

SEE ALSO