_get_tzname

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at _get_tzname.

Retrieves the character string representation of the time zone name or the daylight standard time zone name (DST).

errno_t _get_tzname(  
    size_t* pReturnValue,  
    char* timeZoneName,  
    size_t sizeInBytes,  
    int index      
);  

Parameters

[out] pReturnValue
The string length of timeZoneName including a NULL terminator.

[out] timeZoneName
The address of a character string for the representation of the time zone name or the daylight standard time zone name (DST), depending on index.

[in] sizeInBytes
The size of the timeZoneName character string in bytes.

[in] index
The index of one of the two time zone names to retrieve.

Zero if successful, otherwise an errno type value.

If either timeZoneName is NULL, or sizeInBytes is zero or less than zero (but not both), an invalid parameter handler is invoked, as described in Parameter Validation. If execution is allowed to continue, this function sets errno to EINVAL and returns EINVAL.

Error Conditions

pReturnValuetimeZoneNamesizeInBytesindexReturn valueContents of timeZoneName
size of TZ nameNULL00 or 10not modified
size of TZ nameany> 00 or 10TZ name
not modifiedNULL> 0anyEINVALnot modified
not modifiedanyzeroanyEINVALnot modified
not modifiedany> 0> 1EINVALnot modified

The _get_tzname function retrieves the character string representation of the time zone name or the daylight standard time zone name (DST) into the address of timeZoneName depending on the index value, along with the size of the string in pReturnValue. If timeZoneName is NULL and sizeInBytes is zero, just the size of the string of either time zone in bytes is returned in pReturnValue. The index values must be either 0 for standard time zone or 1 for daylight standard time zone; any other values of index have undetermined results.

Index values

indexContents of timeZoneNametimeZoneName default value
0Time zone name"PST"
1Daylight standard time zone name"PDT"
> 1 or < 0errno set to EINVALnot modified

Unless the values are explicitly changed during run time, the default values are "PST" and "PDT" respectively. The sizes of these character arrays are governed by TZNAME_MAX value.

RoutineRequired header
_get_tzname<time.h>

For more information, see Compatibility.

Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.

Time Management
errno, _doserrno, _sys_errlist, and _sys_nerr
_get_daylight
_get_dstbias
_get_timezone
TZNAME_MAX

Show: