Share via


_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).

Syntax

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.

Return Value

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

pReturnValue timeZoneName sizeInBytes index Return value Contents of timeZoneName
size of TZ name NULL 0 0 or 1 0 not modified
size of TZ name any > 0 0 or 1 0 TZ name
not modified NULL > 0 any EINVAL not modified
not modified any zero any EINVAL not modified
not modified any > 0 > 1 EINVAL not modified

Remarks

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

index Contents of timeZoneName timeZoneName default value
0 Time zone name "PST"
1 Daylight standard time zone name "PDT"
> 1 or < 0 errno set to EINVAL not 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.

Requirements

Routine Required header
_get_tzname <time.h>

For more information, see Compatibility.

.NET Framework Equivalent

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

See Also

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