scsh-users
[Top] [All Lists]

Time/Date problem in Unix

To: scsh@martigny.ai.mit.edu
Subject: Time/Date problem in Unix
From: Olin Shivers <shivers@lambda.ai.mit.edu>
Date: 18 Apr 1997 20:23:19 -0400
Organization: Artificial Intelligence Lab, MIT
I got the following useful suggestion from my last post:    

    From: Michael Beach <mbeach@awa.com.au>

    Upon checking my mktime(3) manpage under Linux, it says that tm_wday and
    tm_yday fields of the tm struct are ignored, and recomputed, but that if
    the broken down time cannot be rpresented as a calendar time, the function
    returns (time_t)(-1) and __does not alter__ tm_wday and tm_yday.

    Assuming this behaviour is part of POSIX and not just a Linux
    implementation quirk, would it not be possible to set tm_wday or tm_yday
    to an illegal value prior to the call to mktime(3), then examine the value
    upon return. If the value is unchanged, then an error must have occurred,
    regardless of the return value.

If it's required, it would definitely solve the problem.

I have checked my POSIX spec, which is silent on this issue. It does, however,
say that POSIX mktime() is required to be compliant with the ANSI C spec for
mktime(). I do not have that spec (just the ANSI K&R). Does anyone have a
copy of the spec, and if so, could they look it up for me?
    -Olin

<Prev in Thread] Current Thread [Next in Thread>
  • Time/Date problem in Unix, Olin Shivers <=