Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
728 B

  1. #include <unistd.h>
  2. #include <stdio.h>
  3. #include <malloc.h>
  4. #include <time.h>
  5. //
  6. // 'tsttime.c'
  7. // Time function sanity check.
  8. //
  9. // 06/10/92 DarekM Created
  10. //
  11. time_t loc_time;
  12. time_t gm_time;
  13. int
  14. main(int argc, char *argv[])
  15. {
  16. int i; // this is to introduce some time delays
  17. for (i=0; i<20000; i++)
  18. loc_time = time(NULL);
  19. printf("Local Time #1 = %d, %s\n", loc_time, asctime(localtime(&loc_time)));
  20. for (i=0; i<20000; i++)
  21. time(&loc_time);
  22. printf("Local Time #2 = %d, %s\n", loc_time, asctime(localtime(&loc_time)));
  23. for (i=0; i<20000; i++)
  24. time(&gm_time);
  25. printf("GMT Time = %d, %s\n", loc_time, asctime(gmtime(&gm_time)));
  26. printf("Elapsed time = %d ms\n", clock());
  27. printf("\n\n");
  28. return 1;
  29. }