home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / database / sybase / 655 < prev    next >
Encoding:
Text File  |  1993-01-12  |  1.3 KB  |  34 lines

  1. Newsgroups: comp.databases.sybase
  2. Path: sparky!uunet!psinntp!jmb2.jmb.com!lewism
  3. From: lewism@jmb2.jmb.com (Mike Lewis)
  4. Subject: Why does dateadd() allow milliseconds?
  5. Message-ID: <1993Jan12.211135.10967@jmb2.jmb.com>
  6. Organization: JMB Realty Corporation
  7. X-Newsreader: TIN [version 1.1 PL6]
  8. Date: Tue, 12 Jan 1993 21:11:35 GMT
  9. Lines: 23
  10.  
  11. I just discovered that the datetime data type stores the date and time parts
  12. separately as 4-byte integers.  The 4-byte integer representing time is the
  13. number of 3/100 of a second since midnight.  Therefore, the following equality
  14. is often (though by no means reliably) true:
  15.  
  16. iamadatetimevariable = dateadd(ms, 1, iamadatetimevariable)
  17.  
  18.  
  19. There are 24*60*60*1000= 86,400,000 milliseconds in 24 hours.  A signed, 4-byte
  20. integer should be able to store a number as large as 2,147,483,648.  This raises
  21. two questions in my mind:
  22.  
  23. 1)    What else is Sybase doing with the 4-byte integer representing time?
  24.  
  25. 2)    Why, if the above equality can be true, does Sybase give me the ability
  26.     to add a single ms to a datetime?  This ability implies that the above
  27.     equality should never be true and is misleading in the extreme.
  28.  
  29. Don't get me wrong, this isn't the bug that ate Tokyo or anything.  I was
  30. just wondering why things work this way.
  31.  
  32.  
  33. Mike Lewis (lewism@jmb2.jmb.com)
  34.