home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name UTTIM2TK -- Compute the IBM clock tick value for a
- * given time of day.
- *
- * Synopsis ticks = uttim2tk (hrs, mins, secs, hunds);
- *
- * unsigned long ticks The tick value that corresponds
- * to the given time of day.
- * int hrs, mins, Time of day to compute tick
- * secs, hunds value for.
- *
- * Description UTTIM2TK computes the number of timer ticks that will be
- * generated in an IBM personal computer (or compatible) in
- * the amount of time specified.
- *
- * The tick value generated is within 2 ticks of the
- * correct value, as long as the time passed to UTTIM2TK is
- * a normal time.
- *
- * On standard IBM PCs, timer ticks occur 1193180/65536
- * (about 18.2) times per second.
- *
- * Returns ticks The number of timer ticks represented
- * by the given time.
- *
- * Version 6.00 (C)Copyright Blaise Computing Inc. 1987,1989
- *
- **/
-
- #include <butil.h>
-
- #define UL (unsigned long)
-
- unsigned long uttim2tk (hrs, mins, secs, hunds)
- int hrs, mins, secs, hunds;
- {
- return (hrs ? ((UL hrs * 65543L) + UL (hrs / 3) ) : 0L)
- + (mins ? ((UL mins * 1092L) + UL ((mins << 1) / 5)) : 0L)
- + (secs ? ((UL secs * 18L) + UL (secs / 5) ) : 0L)
- + (UL hunds / 5L);
- }