Question

I'm newbie in C/linux. man time_t is unsuccess. I'm trying to clarify what exactly time_t type is? It's ok when I'm assign const int to the variable type time_t as follows:

time_t =4;

Seems this type is just alias for some numeric type. But I don't understand what is this type?

Was it helpful?

Solution

Yes it is usually an alias, but it is standard type in C/C++. It can be used not only in Linux.

http://www.cplusplus.com/reference/ctime/time_t/

time_t

Time type

Alias of a fundamental arithmetic type capable of representing times, as those returned by function time.

For historical reasons, it is generally implemented as an integral value representing the number of seconds elapsed since 00:00 hours, Jan 1, 1970 UTC (i.e., a unix timestamp). Although libraries may implement this type using alternative time representations.

Portable programs should not use values of this type directly, but always rely on calls to elements of the standard library to translate them to portable types.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top