localtime. McGraw-Hill The Complete Reference Fourth Edition
Reklaam
Reklaam
752
C + + : T h e C o m p l e t e R e f e r e n c e
A related function is setlocale( ).
localtime
#include <ctime> struct tm *localtime(const time_t * time);
The localtime( ) function returns a pointer to the broken-down form of time in the form of a tm structure. The time is represented in local time. The time value is usually obtained through a call to time( ).
The structure used by localtime( ) to hold the broken-down time is statically allocated and is overwritten each time the function is called. If you wish to save the contents of the structure, you must copy it elsewhere.
Related functions are gmtime( ), time( ), and asctime( ).
mktime
#include <ctime> time_t mktime(struct tm * time);
The mktime( ) function returns the calendar-time equivalent of the broken-down time found in the structure pointed to by time. The elements tm_wday and tm_yday are set by the function, so they need not be defined at the time of the call.
If mktime( ) cannot represent the information as a valid calendar time, –1 is returned.
Related functions are time( ), gmtime( ), asctime( ), and ctime( ).
setlocale
#include <clocale> char *setlocale(int type, const char *locale);
The setlocale( ) function allows certain parameters that are sensitive to the geopolitical environment of a program's execution to be queried or set. If locale is null, setlocale( ) returns a pointer to the current localization string. Otherwise, setlocale( ) attempts to use the string specified by locale to set the locale parameters as specified by type. Refer to your compiler's documentation for the localization strings that it supports.
At the time of the call, type must be one of the following macros:
Laadi alla
Reklaam