home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / unixtools / util / sys / h / time < prev   
Encoding:
Text File  |  1992-07-21  |  973 b   |  45 lines

  1. /* Sys.H.Time: Arm 5-byte time utilities (header file) */
  2.  
  3. #ifndef _sys_time_h
  4. #define _sys_time_h
  5.  
  6. /* Get struct tm from the ANSI header */
  7. #include <time.h>
  8.  
  9. /* ARM System time format */
  10.  
  11. #ifndef __TIME_h
  12. #define __TIME_h
  13. typedef struct
  14. {
  15.     unsigned char t[5];    /* Low byte first - ie. t[0] is low */
  16. }
  17. TIME;
  18. #endif
  19.  
  20. /* Units of time which could be added/subtracted from a TIME */
  21. #define Secs(n)    ((n) * 100)
  22. #define Mins(n) ((n) * 6000)
  23. #define Hrs(n)    ((n) * 360000)
  24.  
  25. /* A time of "zero" */
  26. extern TIME TIMENull;
  27.  
  28. /* Time arithmetic */
  29. extern TIME TIMEadd (TIME t, int n);
  30. extern int  TIMEsub (TIME t1, TIME t2);
  31. extern int  TIMEcmp (TIME t1, TIME t2);
  32.  
  33. /* Time formatting */
  34. extern char *TIMEfmt (const char *fmt, char *buffer, int len, TIME t);
  35. extern char *TIMEstd (TIME t);
  36.  
  37. /* Creating time variables */
  38. extern TIME TIMEnow (TIME *tp);
  39. extern TIME TIMEmktime (struct tm *time);
  40.  
  41. /* Creating a 'struct tm' from a TIME */
  42. extern struct tm *TIMEstruct (TIME t);
  43.  
  44. #endif
  45.