Re: function for clockticks since 1980?



"Peter J. Holzer" <hjp-usenet2@xxxxxx> writes:
[...]
BTW, while I am quite sure that earlier versions of the POSIX standard
restricted time_t to an integral type,
http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/types.h.html
doesn't:

* time_t and clock_t shall be integer or real-floating types.

So it is perfectly ok for time() to return 1185708188.123456 to
represent a time 123456 microseconds ater 2007-07-29 11:23:08 UTC.

Yes, in both C and POSIX. But the use of floating-point for time_t
would introduce some problems. The precision would vary considerably
over time, and some of the bits would be wasted on the ability of
representing times *extremely* close to the epoch. I prefer a uniform
precision over the entire representable range.

[...]

An implementation that chose to make time_t big in readiness for 2038
could have thrown in some extra bits at the bottom for more precision
(even if all they did was count 'time' calls).

It can still do that, but only if it switches to floating-point (which I
think would be the sane thing to do, once 2038 approaches).

I disagree. Assuming an integer representation that overflows in
2038, it's far more sensible IMHO to move to 64 bits (signed). Many
implementations have already done so, and I see no reason that *all*
implementations can't do so in the next 30 years.

[...]

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.



Relevant Pages

  • Re: Float comparison
    ... A given stored floating-point value might have some error range ... not capable of representing such an error range. ... precision, the conversion from the greater precision to the object's ...
    (comp.lang.c)
  • Re: Superstitious learning in Computer Architecture
    ... Doing a Google search on "Computational Fluid Dynamics" and precision ... floating-point) was associated with that type of problem. ... single-precision on the 360, with its poor treatment of the least ... you have to build a second Wallace Tree to process 32-bit floats any ...
    (comp.arch.arithmetic)
  • Re: reply the answer
    ... top bit is much better spent representing times in the past than in ... function for finer precision when it's needed. ... You don't need to make it fixed-point at all. ... If you're not going with the POSIX time_t, ...
    (comp.lang.c)
  • Re: Rational Numbers
    ... It is claimed that decimal FLOATING-point ... |> to explicitly round back down to the precision that you want when you ... Financial calculations are defined in terms of decimal fixed-point, ... specify more digits than they possibly need, ...
    (comp.lang.python)
  • Re: Why all the max length constraints?
    ... then consider various implementations separately. ... although, especially in the case of Algol-68, it was a formal design ... that both IBM & Ingres chose a disk image method of representing ...
    (comp.databases.theory)