HomeFreeBSD

fattime: make the test code check beyond 32-bit time_t limits

Description

fattime: make the test code check beyond 32-bit time_t limits

On systems that have a 64-bit time_t, the test code now exercises the whole
range of fattime. To do this, this commit...

  1. replaces the call to random() with two calls to arc4random() to generate a 33-bit number of seconds in order to cover the entire range of fattime [1970,2107]. (32-bits stops just short - in January 2106.) On systems with 32-bit time_t, the extra bits are discarded and only the time_t expressible range is tested.
  2. casts time_t values passed to printf as longs and changes the format string to match.

Now, the test code builds, runs, and exercises what it can (i.e., the whole
fattime range or the 32-bit time_t subset of it) on both 32-bit and 64-bit
time_t systems.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D44754

Details

Provenance
jeffpc_josefsipek.netAuthored on Mon, Apr 29, 1:40 PM
tsoomeCommitted on Wed, May 1, 4:56 AM
Reviewer
imp
Differential Revision
D44754: fattime: make the test code check beyond 32-bit time_t limits
Parents
rG7b8b613d08d0: fattime: make the test code build again
Branches
Unknown
Tags
Unknown