Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Tips and Techniques: Converting Time

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tips and Techniques: Converting Time

    ** This thread discusses the article: Tips and Techniques: Converting Time **
    ** This thread discusses the Content article: Tips and Techniques: Converting Time **
    0

  • #2
    Tips and Techniques: Converting Time

    ** This thread discusses the article: Tips and Techniques: Converting Time **

    Code

    Comment


    • #3
      Tips and Techniques: Converting Time

      ** This thread discusses the article: Tips and Techniques: Converting Time **
      The only advantage is that it works directly from and to non-date data-type fields.

      Comment


      • #4
        Tips and Techniques: Converting Time

        ** This thread discusses the article: Tips and Techniques: Converting Time **
        The *DTS format is the same format returned by the MI MATTOD() I believe the format is a 42 bit number with the remaining bits left to make each MATTOD() guaranteed to be unique. The 42nd bit increments every 1024 microseconds, and is an interval from the base time of 23 Aug 1928, 12:03:06.315. Here's a little program that shows one way to convert the raw value into today's date: d mattod pr extproc('_MATTOD') d 8 d tod ds inz d dts 1 8u 0 d base s z inz(z'1928-08-23-12.03.06.315') d calc s z c callp mattod(tod) * shift the dts over and convert to seconds * (only the top 42 bits are useful) * (the number in us is too large for ADDDUR) * add that to the base date to come up with today c eval dts = dts / 4096000000 c base adddur dts:*s calc c calc dsply c eval *inlr = *on Note that this particular mechanism destroys the milli- and micor-second values, but it it only meant to demonstrate what the bit pattern of *DTS looks like. --buck

        Comment

        Working...
        X