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 >
Wrap
Text File
|
1991-01-04
|
692b
|
28 lines
/*****
packtime()
This function collapses the time into an unsigned integer using the
DOS disk format with bits: 0x00 - 0x04 = sec, 0x05 - 0x08 = minutes,
0x09 - 0x0f = hour. Second are in two-second increments (0 - 29).
Argument list: int sec seconds
int min minutes
int hour hour
Return value: unsigned int the packed time
*****/
unsigned int packtime(int sec, int min, int hour)
{
unsigned int result;
sec >>= 1; /* Divide seconds in half */
result = sec;
min <<= 0x05;
hour <<= 0x0b;
result += min;
result += hour;
return result;
}