time 990 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. void main() {
  2. Timer m1;
  3. getMillis(m1);
  4. Timer m2;
  5. getMillis(m2);
  6. Timer m3;
  7. getMillis(m3);
  8. test(m1.nanos <= m2.nanos && m2.nanos <= m3.nanos);
  9. test(m1.seconds <= m2.seconds && m2.seconds <= m3.seconds);
  10. Timer n1;
  11. getNanos(n1);
  12. Timer n2;
  13. getNanos(n2);
  14. Timer n3;
  15. getNanos(n3);
  16. test(n1.nanos < n2.nanos && n2.nanos < n3.nanos);
  17. test(n1.seconds <= n2.seconds && n2.seconds <= n3.seconds);
  18. Time time;
  19. time.year = 999999;
  20. toTime(m1, time);
  21. test(time.year >= 2021);
  22. test(time.month >= 0 && time.month <= 11);
  23. test(time.day >= 1 && time.day <= 31);
  24. test(time.hours >= 0 && time.hours <= 59);
  25. test(time.minutes >= 0 && time.minutes <= 59);
  26. test(time.seconds >= 0 && time.seconds <= 60);
  27. test(time.millis >= 0 && time.millis <= 999);
  28. Timer m;
  29. toMillis(time, m);
  30. test(m.seconds == m1.seconds);
  31. test(m.nanos == m1.nanos);
  32. }