home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c329 / 2.img / EXAMPLES / GETSEC.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-05-10  |  630 b   |  44 lines

  1. /*
  2.  * getsec.c
  3.  * Purpose: returns time since midnight in hundredths of a second
  4.  *
  5.  * Jeremy D. Freeman
  6.  * Copyright MicroWay, Inc 1989
  7.  *
  8.  */
  9.  
  10. #include    <stdio.h>
  11. #include    <time.h>
  12.  
  13. extern    int centisec;
  14. extern    float getsec100();        /* forward reference */
  15.  
  16. mainiac ()
  17.  
  18. {
  19.     float a, b;
  20.     int i;
  21.     
  22.     a = getsec100();
  23.     printf ("a = %f\n",(double) a);
  24.     for (i=0;i < 100000; i++) {
  25.         ;
  26.     }
  27.     b = getsec100();
  28.     printf ("b = %f\n",(double) b);
  29.     printf ("\n");
  30.  
  31. }
  32.     
  33.  
  34. float getsec100()
  35.  
  36. {
  37.     struct tm *tmp;
  38.     
  39.     tmp = localtime();
  40.     return((3600*tmp->tm_hour+60*tmp->tm_min+tmp->tm_sec)*100+centisec);
  41.  
  42. }
  43.  
  44.