Hi Rodrick,

Roderick wrote on Mon, Oct 05, 2020 at 03:16:24PM +0000:

> The result of time() has type time_t and we know what kind of number
> goes there: seconds since 0 hours, 0 minutes, 0 seconds, January 1,
> 1970, Coordinated Universal Time.
> 
> In my FreeBSD running on a 64 bit processor this type is: int (__32_t).
> It considers this size enough for above information.

http://www.openbsd.org/lyrics.html#55

> In my OpenBSD running on a 32 bit processor this type is: long long
> (__64_t).
> 
> None of both has an unsigned type, although time moves forward
> (more or less fast!!!).

https://man.openbsd.org/mktime.3#RETURN_VALUES
https://man.openbsd.org/time.3#RETURN_VALUES

> Is there a reason for this discrepancy? Is there no standard for the
> size of time_t?

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html

only says:

  time_t shall be an integer type.

> And what does mean the types with __? I find it so confusing. :)

Names starting with double underscores are reserved by the C standard,
for example paragraphs 3.8.8 and 4.1.2 in C89, so an implementation
of the C language can use them internally without risking conflicts
with identifiers defined by conforming application programs.

Yours,
  Ingo

Reply via email to