0

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?

  • 5
    http://stackoverflow.com/questions/471248/what-is-ultimately-a-time-t-typedef-to – deviantfan May 10 '14 at 19:43
  • `man time_t is unsuccess`. I recommend you in this case `man -K time_t`. `man -K`: Search for the specified string in *all* man pages. Warning: this is probably very slow! –  May 10 '14 at 19:47
  • What is your problem ? What are you trying to achieve ? Who cares what this type is ! It just the type of the value returned by the `time()` function, period. – kebs May 10 '14 at 19:49
  • A better man page to read is [time(7)](http://man7.org/linux/man-pages/man7/time.7.html) – Basile Starynkevitch May 10 '14 at 20:39

1 Answers1

1

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.

Community
  • 1
  • 1
Sandro
  • 2,707
  • 2
  • 20
  • 30