wtc, could we possibly add this to prtime.h? Or should we look for a mozilla header to put this function in?
I can't take this function in NSPR. A 32-bit integer that represents the number of seconds since 1970-01-01 will overflow in Year 2036 or 2038. This is why PRTime is a 64-bit integer.
Good point... Perhaps consumers of these functions should in fact be fixed to use PRInt64/PRUint64...
Good point, but still all implementers of PRTimeToSeconds use a 32bit integer, so they ALL will fail in 2037... Let's start with a PRInt64 PRTimeToSeconds(PRTime msecs); in NSPR, so that at least callers are tempted to switch to PRInt64, or if they really want to store it as PRInt32, they have to willingly convert the PRInt64 to PRInt32. Or is PRUint32 enough for the seconds? Then we can to about 2100... In fact most current impl's of TimeToSeconds do this, such as nsCache.
Marking DUP to 58310. *** This bug has been marked as a duplicate of 58310 ***