[haiku-commits] Re: haiku: hrev51545 - headers/os/kernel src/system/libroot/os src/system/kernel

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 15 Nov 2017 22:03:04 +0100

Am 15/11/2017 um 21:13 schrieb waddlesplash:

What about real_time_clock() ?
Ah, right. From looking around, it seems real_time_clock() is just
used to set time_t ... and it does appear that BeOS used a uint32 here
as well (and that function is of course more used.)
So would using "unsigned time_t" be OK here? I think that solves the
ABI problem as well as the return value problem.

You could also use unsigned long for that matter. I would just use that for set_real_time_clock(), too, in order to solve the ABI issue, there, too (and make it consistent as well).

It looks like overflow is not handled for real_time_clock_usecs and
friends either, so this is not exactly a new problem. I wonder what
the right thing to do is? (I doubt anyone will be running an unpatched
Haiku in 292 billion years, so I also wonder just how much of a
practical problem this is.)

It's more of a problem of the 32-bit variant. However, nobody stops you to call set_real_time_clock() with a value of 293 billion years in seconds. If that somehow ends up with Haiku being hacked, it's your fault now :-)

Bye,
   Axel.

Other related posts: