![]() |
![]() |
![]() |
![]() |
This chapter describes:
Certain data items are used by the C/C++ runtime library and may be inspected (or changed in some cases) by a program:
The increment by which the "break" pointer for memory allocation is advanced when there's no freed block large enough to satisfy a request to allocate a block of memory. This may be changed by a program at any time.
Number of arguments passed to main().
Pointer to a vector containing the actual arguments passed to main().
Pointer to a vector of auxiliary arguments to main().
Beginning of the text segment.
1 when daylight saving time is supported in this locale, and 0 otherwise. Whenever a time function is called, the tzset() function is called to set the variable, based on the TZ environment variable.
End of the data segment, excluding BSS data.
End of the data segment, including BSS data.
Pointer to an array of character pointers to the environment strings.
The last error detected. The runtime library never resets errno to 0. Symbolic names for these errors are found in <errno.h>. See the description of errno and strerror().
End of the text segment.
Pointer to an optional argument.
Indicates whether or not error messages are to be printed.
Index of the current option being scanned.
Pointer to the offending letter when an error was detected.
Basename of the program being executed.
Standard error stream (set to the console by default).
Standard input stream (set to the console by default).
Standard output stream (set to the console by default).
Array of error messages corresponding to errno.
Number of entries in the sys_siglist array.
Number of entries in the sys_siglist array.
Information about the system, including the processor type, bus type, and the location and size of available system RAM. For information about this structure, see the Customizing Image Startup Programs chapter of Building Embedded Systems.
The best way to reference the system information page is via the kernel calls and POSIX cover functions. If there isn't a function to access the information you need, you should use the SYSPAGE_ENTRY() and SYSPAGE_CPU_ENTRY() macros instead of referencing the _syspage_ptr variable directly.
Array of signal names.
The number of seconds by which the local time zone is earlier than Coordinated Universal Time (UTC) (formerly known as Greenwich Mean Time). Whenever a time function is called, the tzset() function is called to set the variable, based on the TZ environment variable.
The standard abbreviations for the time zone and the time zone when daylight saving time is in effect. Whenever a time function is called, the tzset() function is called to set the values in the array, based on the TZ environment variable.
The TZ environment variable is used to establish the local time zone. The value of the variable is used by various time functions to compute times relative to Coordinated Universal Time (UTC), formerly known as Greenwich Mean Time (GMT).
![]() |
If TZ is not set, the system defaults to confstr(_CS_TIMEZONE) for all instances of TZ. The TZ environment variable is POSIX, _CS_TIMEZONE is QNX. |
The time on the computer should be set to UTC. Use the date command if the time isn't automatically maintained by the computer hardware.
The TZ environment variable can be set (before the program is executed) by using:
You could also set the TZ environment variable during program execution by using the setenv() or putenv() library functions:
setenv( "TZ", "PST8PDT", 1 ); putenv( "TZ=PST8PDT" );
To obtain the value of the variable, use the getenv() function:
char *tzvalue; ... tzvalue = getenv( "TZ" );
The tzset() function processes the TZ environment variable and sets the following global variables:
The value of the TZ environment variable should be set as follows (spaces are for clarity only):
std offset dst offset, rule
The expanded format is as follows:
stdoffset[dst[offset][,start[/time],end[/time]]]
where
![]() |
There's no specified list of time zone designations, you can specify whatever name or acronym you'd like. What's important for the library is the information that follows the names -- the numbers that indicate the difference between the local time and UTC, and the rules that specify when to switch on, or out of, daylight saving time. |
hh[:mm[:ss]]
Minutes (mm) and seconds (ss) are optional. The hour (hh) is required; it may be a single digit.
The offset following std is required. If no offset follows dst, summer time is assumed to be one hour ahead of standard time.
One or more digits may be used; the value is always interpreted as a decimal number. The hour may be between 0 and 24; the minutes (and seconds), if present, between 0 and 59. If preceded by a "-", the time zone is east of the prime meridian; otherwise it's west (which may be indicated by an optional preceding "+").
date/time,date/time
where the first date describes when the change from standard to summer time occurs, and the second date describes when the change back happens. Each time field describes when, in current local time, the change to the other time is made.
The format of date may be one of the following:
The time has the same format as offset, except that no leading sign ("+" or "-") is allowed. The default, if time is omitted, is 02:00:00.
Whenever you call ctime(), ctime_r(), localtime(), or mktime(), the time zone names contained in the external variable tzname are set as if you called tzset(). The same is true if you use the %Z directive of strftime().
Here are some examples:
This is the default when the TZ variable isn't set.
This is the full specification for the default when the TZ variable isn't set.
![]() |
![]() |
![]() |
![]() |