there are sereval impl of PRTimeToSeconds, can we put it in one place?

RESOLVED DUPLICATE of bug 58310

Status

SeaMonkey
General
RESOLVED DUPLICATE of bug 58310
14 years ago
12 years ago

People

(Reporter: Jerry, Unassigned)

Tracking

Trunk
x86
Windows XP

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

14 years ago
see http://lxr.mozilla.org/seamonkey/search?string=PRTimeToSeconds
wtc, could we possibly add this to prtime.h?  Or should we look for a mozilla
header to put this function in?

Comment 2

14 years ago
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...

Comment 4

14 years ago
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.
Product: Browser → Seamonkey

Comment 5

12 years ago
Marking DUP to 58310.

*** This bug has been marked as a duplicate of 58310 ***
Status: NEW → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.