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

  1. /*****
  2.                               unpackdate()
  3.  
  4.       This function unpacks the date from an unsigned integer, using the
  5.    DOS disk format with bits: 0x00 - 0x04 = day, 0x05 - 0x08 = month,
  6.    0x09 - 0x0f = year. The year is formed relative to 1980.
  7.  
  8.    Argument list:    int *day        the day
  9.                      int *month      the month
  10.                      int *year       the year
  11.                      int num         the packed number
  12.  
  13.    Return value:     void
  14.  
  15. *****/
  16.  
  17. void unpackdate(int *day, int *month, int *year, unsigned int num)
  18. {
  19.    *day = num & 0x1f;
  20.    *month = (num & 0x1e0) >> 0x05;
  21.    *year = (num & 0xfe00) >> 0x09;
  22.    *year += 1980;                   /* Add offset back in */
  23. }
  24.