64bit timestamp library

Ask a Question related to Ruby, Design and Development.

  1. #1

    Default 64bit timestamp library

    I'm looking for a 64bit timestamp definition/standard with suitable
    range (at least from year 1900 to 2100) and precision (at least
    milliseconds). So far .NET's System.DateTime is the best candidate
    (range is year 1 AD to 9999 AD, precision is 0.1 microsecond). However,
    conversion to/from UNIX timestamp looks to be non-straightforward. Is
    there a Ruby library to do this (or to/from other suitable timestamp)?

    I could always invent my own timestamp, but...

    --
    dave




    David Garamond Guest

  2. Similar Questions and Discussions

    1. Help Compiling XML::Parser On AIX 5.2 64bit
      I'm attempting to get XML::Parser working. Having issues on AIX 5.2 64bit. I've seen a previous message posted months ago with resolution. Has...
    2. int4 -> unix timestamp -> sql timestamp; abstime?
      Hello, what is the opposite of cast(extract('epoch' from now()) as int)? The only thing I found that works is cast(cast(... as abstime) as...
    3. 64bit - 32 bit AIX 5.1 considerations
      Dear All, I'm one of the administrators of an AIX 5.1 system (p660 6M 4CPUs). The system is used as a multiuser system in a university...
    4. ~/Library/ vs ~/System/Library vs /User/Library/
      In article <110720031327074895%justin.c@se.net>, justin <justin.c@se.net> wrote: First off, you're a little bit confused. ~ means your home...
    5. 32bit or 64bit?
      Where can I find whether I have 32bit or 64bit on my Win XP Home edition. System info doesn't seem to tell me. Thanks Greta -- All outgoing...
  3. #2

    Default Re: 64bit timestamp library

    Do me a favor and build you own 128bit timestamp and lets be done with these
    restraints. I'm getting shades of Y2K mainia all over again. ;)

    On Sunday 23 November 2003 02:29 pm, David Garamond wrote:
    > I'm looking for a 64bit timestamp definition/standard with suitable
    > range (at least from year 1900 to 2100) and precision (at least
    > milliseconds). So far .NET's System.DateTime is the best candidate
    > (range is year 1 AD to 9999 AD, precision is 0.1 microsecond). However,
    > conversion to/from UNIX timestamp looks to be non-straightforward. Is
    > there a Ruby library to do this (or to/from other suitable timestamp)?
    >
    > I could always invent my own timestamp, but...


    T. Onoma Guest

  4. #3

    Default Re: 64bit timestamp library

    David Garamond wrote:
    > I'm looking for a 64bit timestamp definition/standard with suitable
    > range (at least from year 1900 to 2100) and precision (at least
    > milliseconds). So far .NET's System.DateTime is the best candidate
    > (range is year 1 AD to 9999 AD, precision is 0.1 microsecond).
    > However, conversion to/from UNIX timestamp looks to be
    > non-straightforward. Is there a Ruby library to do this (or to/from
    > other suitable timestamp)?
    >
    > I could always invent my own timestamp, but...
    Given that:
    1 Year = 365.25 days 365 days/year
    1 Day = 24 hours 8,766 hours/year
    1 Hour = 60 minutes 525,960 minutes/year
    1 Minute = 60 seconds 31,557,600 seconds/year
    1 Second = 1000 miliseconds 31,557,600,000 ms/year
    1 ms = 10 .1 ms 315,576,000,000 .1 ms/year

    2 ^ 63 = 9,223,372,036,854,780,000 => 29,227,102 years @ .1 ms

    So just pick a good date... say 00:00:00.0000001 01/01/2000 and figure
    forwards and backwards from there. Even specifying 0.01 ms resolution
    shouldn't hurt you for most purposes. (Actually I meant New Years +
    epsilon at Greenwich on the year 2000 CE). But the birthday of Charles
    Babbage would be just as good, except for things like the problem of
    figuring leap seconds. Since very few people need to worry about leap
    seconds I think you can leave worrying about the details required to
    handle them until later. Just provide some reasonable way to add in a
    table of fudge factors.



    Charles Hixson Guest

  5. #4

    Default Re: 64bit timestamp library

    Charles Hixson wrote:
    >> I'm looking for a 64bit timestamp definition/standard with suitable
    >> range (at least from year 1900 to 2100) and precision (at least
    >> milliseconds). So far .NET's System.DateTime is the best candidate
    >> (range is year 1 AD to 9999 AD, precision is 0.1 microsecond).
    >> However, conversion to/from UNIX timestamp looks to be
    >> non-straightforward. Is there a Ruby library to do this (or to/from
    >> other suitable timestamp)?
    >>
    >> I could always invent my own timestamp, but...
    >
    > Given that: 1 Year = 365.25 days 365 days/year
    [snip]

    Thanks for the explanation. I should've completed my previous sentence:
    "I could always invent my own timestamp, but... I really don't want to
    :)" There are already too many kinds of timestamps out there (MySQL's,
    Firebird's, Unix's, PostgreSQL's, Win32's, .NET's, etc).

    --
    dave



    David Garamond Guest

  6. #5

    Default Re: 64bit timestamp library

    T. Onoma wrote:
    > Do me a favor and build you own 128bit timestamp and lets be done with these
    > restraints. I'm getting shades of Y2K mainia all over again. ;)
    With 64bit you are quite free to do ranges from thousands of BC to
    hundreds of thousands AD with subsecond precision. You don't really need
    128bit unless you're doing something like atomic-level time scales (e.g.
    picosecond precision) or something like GUID.

    But if you want a 128bit timestamp, there's already DJB's libtai:

    [url]http://cr.yp.to/libtai.html[/url]

    > On Sunday 23 November 2003 02:29 pm, David Garamond wrote:
    >
    >>I'm looking for a 64bit timestamp definition/standard with suitable
    >>range (at least from year 1900 to 2100) and precision (at least
    >>milliseconds). So far .NET's System.DateTime is the best candidate
    >>(range is year 1 AD to 9999 AD, precision is 0.1 microsecond). However,
    >>conversion to/from UNIX timestamp looks to be non-straightforward. Is
    >>there a Ruby library to do this (or to/from other suitable timestamp)?
    >>
    >>I could always invent my own timestamp, but...
    --
    dave




    David Garamond Guest

  7. #6

    Default Re: 64bit timestamp library

    Hi!

    * Charles Hixson; 2003-11-23, 23:49 UTC:
    > Given that:
    > 1 Year = 365.25 days 365 days/year
    > 1 Day = 24 hours 8,766 hours/year
    > 1 Hour = 60 minutes 525,960 minutes/year
    > 1 Minute = 60 seconds 31,557,600 seconds/year
    > 1 Second = 1000 miliseconds 31,557,600,000 ms/year
    > 1 ms = 10 .1 ms 315,576,000,000 .1 ms/year
    >
    > 2 ^ 63 = 9,223,372,036,854,780,000 => 29,227,102 years @ .1 ms
    Or, as w physicist would pput it:

    2**63 * 0.1 ms = 8 * 10**18 * 0.1 ms = 8 * 10**17 ms
    1 yr = PI * 10**7 s = PI * 10**10 ms (1)
    PI = 22/7 (2)

    8 * 10**17 ms = 8/PI * 10**(17-10) a = 56/22 * 10**7 a = 3 * 10**7 a

    (1) Alien but quite precise :->
    (2) Any Forth programmers among us?

    Josef 'Jupp' Schugt
    --
    .-------.
    message > 100 kB? / | |
    sender = spammer? / | R.I.P.|
    text = spam? / ___| |___


    Josef 'Jupp' SCHUGT Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139