[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian was hacked: The Canterbury Distribution (howto write the date)



On 04/02/2011 06:31 PM, Boyd Stephen Smith Jr. wrote:
In<[🔎] 4D96A8C3.9080208@cox.net>, Ron Johnson wrote:
I've always thought that Unix Time is *incredibly stupid* (who the heck
says "Fri Apr  1 23:27:41 CDT 2011"?)
and *monumentally shortsighted*
(did nothing happen before 01-Jan-1970?).

What makes you say this is UNIX time?  The UNIX standard provides many ways of
displaying a time, and AFAIK, doesn't really prefer any particular string
format.


Because that's traditionally how ls presents the file date.

For me, UNIX time is nanoseconds from Epoch.  The time_t and clock_t types are

The Epoch is still 01-Jan-1970.

allowed to be signed and any reasonable size.

Which is still 32 bits on 32-bit Linux.

$ cat time_t.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main (int argc, char **argv )
{
    printf("bits in time_t = %d\n", sizeof(time_t) * 8);
    printf("bits in clock_t = %d\n", sizeof(clock_t) * 8);
}

$ gcc time_t.c

$ ./a.out
bits in time_t = 32
bits in clock_t = 32


                                             The timespec structure
specifically records nanosecond and interprets a time_t as seconds.  The
clock_t type was "always" in microseconds in SUSv2, but even then there was
warning that it might change.


Which breaks binary compatibility.

Traditionally, UNIX-like systems have used a 32-bit signed time_t, but I'm
pretty sure all the *BSDs (including Mac OS X) and the Linux kernel have moved
beyond that.  I'm not sure about AIX and Solaris.  I'm pretty sure there won't
be anymore HP-UX.


--
"Neither the wisest constitution nor the wisest laws will secure
the liberty and happiness of a people whose manners are universally
corrupt."
Samuel Adams, essay in The Public Advertiser, 1749


Reply to: