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

  1. /*****
  2.                               packtime()
  3.  
  4.       This function collapses the time into an unsigned integer using the
  5.    DOS disk format with bits: 0x00 - 0x04 = sec, 0x05 - 0x08 = minutes,
  6.    0x09 - 0x0f = hour. Second are in two-second increments (0 - 29).
  7.  
  8.    Argument list:    int sec        seconds
  9.                      int min        minutes
  10.                      int hour       hour
  11.  
  12.    Return value:     unsigned int   the packed time
  13.  
  14. *****/
  15.  
  16. unsigned int packtime(int sec, int min, int hour)
  17. {
  18.    unsigned int result;
  19.  
  20.    sec >>= 1;        /* Divide seconds in half */
  21.    result = sec;
  22.    min <<= 0x05;
  23.    hour <<= 0x0b;
  24.    result += min;
  25.    result += hour;
  26.    return result;
  27. }
  28.