| 54 | } |
| 55 | |
| 56 | static inline void time_to_hms(std::int64_t jd, |
| 57 | std::int32_t & hour, |
| 58 | std::int32_t & min, |
| 59 | std::int32_t & sec, |
| 60 | std::int32_t & msec) { |
| 61 | std::int64_t time; |
| 62 | const std::int64_t USECS_PER_HOUR = 3600000000; |
| 63 | const std::int64_t USECS_PER_MINUTE = 60000000; |
| 64 | const std::int64_t USECS_PER_SEC = 1000000; |
| 65 | time = jd; |
| 66 | hour = time / USECS_PER_HOUR; |
| 67 | time -= (hour) *USECS_PER_HOUR; |
| 68 | min = time / USECS_PER_MINUTE; |
| 69 | time -= (min) *USECS_PER_MINUTE; |
| 70 | sec = time / USECS_PER_SEC; |
| 71 | msec = time - (sec * USECS_PER_SEC); |
| 72 | } |
| 73 | |
| 74 | static inline int timestamp_to_tm( |
| 75 | std::int64_t dt, struct tm & tm, std::int32_t & msec) { |