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
925 B

  1. #ifndef TIMEDATE_H
  2. #define TIMEDATE_H
  3. #include "Point.h"
  4. #include <time.h>
  5. class TimeDate {
  6. public:
  7. TimeDate() {};
  8. TimeDate(int hour, int minute = 0, int second = 0, long usecond = 0);
  9. TimeDate(struct tm t2) {t = t2;};
  10. TimeDate operator=(TimeDate a);
  11. TimeDate operator+(TimeDate a);
  12. TimeDate operator+(struct tm t2);
  13. TimeDate operator+=(TimeDate a);
  14. TimeDate operator-(TimeDate a);
  15. TimeDate operator*(float f);
  16. /* This reads the current clock time and returns itself */
  17. TimeDate read_time();
  18. void print();
  19. Point sun_direction(float lon = -93, float lat = 45);
  20. private:
  21. /* Call this if the time can only have gotten bigger */
  22. TimeDate correct_bigger();
  23. /* Call this if the time could have gotten bigger or smaller */
  24. TimeDate correct_smaller();
  25. struct tm t;
  26. /* This won't be quite accurate down to microseconds, but should be
  27. * reasonably close */
  28. long usec;
  29. };
  30. #endif