ltime.c 366 B

1234567891011121314151617
  1. /*
  2. * Portable implementation of ltime() for any ISO-C platform where
  3. * time_t behaves. (In practice, we've found that platforms such as
  4. * Windows and Mac have needed their own specialised implementations.)
  5. */
  6. #include <time.h>
  7. #include <assert.h>
  8. struct tm ltime(void)
  9. {
  10. time_t t;
  11. time(&t);
  12. assert (t != ((time_t)-1));
  13. return *localtime(&t);
  14. }