home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 463.lha / Date_routines / unpacktime.c < prev    next >
Text File  |  1991-01-04  |  693b  |  24 lines

  1. /*****
  2.                               unpacktime()
  3.  
  4.       This function collapses the time into an unsigned integer by using
  5.    the DOS disk format with bits: 0x00 - 0x04 = day, 0x05 - 0x08 = month,
  6.    0x09 - 0x0f = year. The year is formed relative to 1980 and can only
  7.    be used for dates after 12/31/79.
  8.  
  9.    Argument list:    int *sec        the day
  10.                      int *min        the month
  11.                      int *hour       the hour
  12.                      int num         the packed number
  13.  
  14.    Return value:     void
  15.  
  16. *****/
  17.  
  18. void unpacktime(int *sec, int *min, int *hour, int num)
  19. {
  20.    *sec = (num & 0x1f) * 2;
  21.    *min = (num & 0x7e0) >> 0x05;
  22.    *hour = (num & 0xf800) >> 0x0b;
  23. }
  24.