Qore assumes a default time zone for all programs when it starts up. The rules for determining the default time zone are similar to those for the C library in most UNIX or UNIX-\/like operating systems.\hypertarget{time_zones_unix_time_zones}{}\doxysection{UNIX Time Zone Handling}\label{time_zones_unix_time_zones}
If the {\ttfamily TZ} environment variable is defined, then the contents of that variable are used to find a zoneinfo file that contains the time zone definition. If this file cannot be found, then the default time zone will default to {\ttfamily UTC}.

If the {\ttfamily TZ} environment variable is not defined or is empty, then the Qore library tries to find the default zoneinfo definition file (normally {\ttfamily /etc/localtime}). If found, this file is read in and provides the information about the local time zone. If not found, the default time zone will default to {\ttfamily UTC}.

When a zoneinfo file is found, information about local time zone names and daylight savings time is available for times tagged with that time zone.

Note that posix-\/style time zone rules are not understood if assigned to the {\ttfamily TZ} environment variable, only file names to a zoneinfo file can be processed at the moment. Furthermore if the zoneinfo file contains leap second information, it is currently ignored.\hypertarget{time_zones_windows_time_zones}{}\doxysection{Windows Time Zone Handling}\label{time_zones_windows_time_zones}
Time zone information is read in from binary time zone data in the Windows registry under\+:~\newline

\begin{DoxyItemize}
\item {\ttfamily HKEY\+\_\+\+LOCAL\+\_\+\+MACHINE SOFTWARE\textbackslash{}Microsoft\textbackslash{}Windows NT\textbackslash{}Current\+Version\textbackslash{}Time Zones}
\end{DoxyItemize}

Time zone region names must correspond to registry keys under the above key or to zoneinfo names (which will be temporarily converted to the corresponding Windows registry keys according to a lookup table), otherwise the time zone information will not be loaded.

The region name reported by \mbox{\hyperlink{class_qore_1_1_time_zone_a84317e0b38d8536b73fcf475b28b50a5}{Qore\+::\+Time\+Zone\+::region()}} will be the zoneinfo name passed to Time\+Zone\textquotesingle{}s constructor or a zoneinfo name corresponding to the Windows-\/style name (first corresponding zoneinfo name according to alphabet).

For example\+:

\begin{DoxyVerb}O:\bin>qore -ne "TimeZone tz('Central Europe Standard Time'); printf(\"%s\n\", tz.region());"
Europe/Belgrade

O:\bin>qore -ne "TimeZone tz('Europe/Vienna'); printf(\"%s\n\", tz.region());"
Europe/Vienna\end{DoxyVerb}
\hypertarget{time_zones_time_zone_examples}{}\doxysection{More Time Zone Information and Examples}\label{time_zones_time_zone_examples}
See the \mbox{\hyperlink{class_qore_1_1_time_zone}{Qore\+::\+Time\+Zone}} class for information about retrieving, setting, and querying time zone information; see \mbox{\hyperlink{group__date__and__time__functions}{Date and Time Functions}} for a list of functions related to date/time processing.

Here are some examples using Qore\textquotesingle{}s \textquotesingle{}-\/X\textquotesingle{} option for evaluating an expression and displaying the result immediately\+:

\begin{DoxyVerb}prompt% TZ=America/Chicago qore -X 'now_us()'
2010-05-11 06:14:28.845857 Tue -05:00 (CDT)
prompt% TZ=Europe/Rome qore -X 'now_us()'
2010-05-11 13:14:35.070568 Tue +02:00 (CEST)
prompt% TZ=Australia/Sydney qore -X 'now_us()'
2010-05-11 21:14:45.422222 Tue +10:00 (EST)
prompt% TZ=Asia/Tokyo qore -X 'now_us()'
2010-05-11 20:14:59.609249 Tue +09:00 (CJT)\end{DoxyVerb}
 