tech-kern archive

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

Re: Support for tv_sec=-1 (one second before the epoch) timestamps?



On Dec 16,  1:20pm, Mouse wrote:
}
} >> Not sure about that, but I agree that we should not extend the range
} >> of time_t (aka "seconds since the epoch") to negative values.
} > I'm not sure why anyone thinks that ship didn't sail years ago.
} 
} > % cal 6 1942
} 
} How is that relevant to time_t?

     Indeed, I just looked at the source for cal(1).  It uses time_t
in two places.  The first is if you use cal with no arguments, it
uses it in getting the current time.  The second is in the day_array()
function.  The comment above it says:

/*
 * day_array --
 *      Fill in an array of 42 integers with a calendar.  Assume for a moment
 *      that you took the (maximum) 6 rows in a calendar and stretched them
 *      out end to end.  You would have 42 numbers or spaces.  This routine
 *      builds that array for any month from Jan. 1 through Dec. 9999.
 */

I haven't fully analyzed it, but I suspect it could be done in a
different way.  At no point is any math done on a time_t variable.

}-- End of excerpt from Mouse


Home | Main Index | Thread Index | Old Index