Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#18184 closed defect (fixed)

Remove "support" for unsigned time_t

Reported by: nickm Owned by: nickm
Priority: Low Milestone: Tor: 0.2.8.x-final
Component: Core Tor/Tor Version:
Severity: Minor Keywords:
Cc: Actual Points:
Parent ID: Points: small
Reviewer: Sponsor:

Description

I maintain that unsigned time_t does not actually exist, and that time_t is signed everywhere that matters. Further, we probably have all kinds of assumptions in our code that it is signed. So let's remove the "support" for unsigned time_t, since it probably wouldn't work anyway.

Child Tickets

Change History (6)

comment:1 Changed 3 years ago by nickm

Owner: set to nickm
Status: newaccepted

comment:2 Changed 3 years ago by nickm

Priority: MediumLow
Severity: NormalMinor
Status: acceptedneeds_review

We've also warned about this since 0.2.5.1-alpha, and nobody has complained.

It turns out that OpenVMS has had an unsigned time_t for a while, but afaik nobody builds Tor on OpenVMS. Signed time_t remains as a compile-time option there anyway.

See branch "bug18184" in my public repository.

comment:3 Changed 3 years ago by asn

Looks good to me.

comment:4 Changed 3 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Merging!

comment:5 Changed 2 years ago by ryankung

Hi

I'm trying build tor for QNX, and met this errors when run configures.

"You have an unsigned time_t; Tor does not support that. Please tell the Tor developers about your interesting platform."

And QNX is using a unsigned 32-bit/64-bit number for time_t.

. The time_t data type is an unsigned 32-bit number, which extends this range for many applications through 2106. The kernel itself uses unsigned 64-bit numbers to count the nanoseconds since January 1970, and so can handle dates through 2554.

So I think we should reverse this ticket/merge.

http://www.qnx.com/developers/docs/660/index.jsp?topic=%2Fcom.qnx.doc.neutrino.sys_arch%2Ftopic%2Fkernel_CLOCKANDTIMER.html

comment:6 Changed 2 years ago by nickm

I've opened a new ticket (#21735) for this. There's more to do here than just reverting the merge: We'd need to actually go through all our uses of time_t, and make sure that they don't rely on time_t being signed. Even though tor used to allow you to try to compile that way, we're pretty sure it never actually worked. More info on that ticket.

Note: See TracTickets for help on using tickets.