comparison src/core/time.cc @ 306:f4538a4c91ba

cleanup: remove extraneous executable flags
author Paper <paper@paper.us.eu.org>
date Sun, 19 May 2024 17:48:52 -0400
parents 91ac90a34003
children da2c5a8ff306
comparison
equal deleted inserted replaced
305:91ac90a34003 306:f4538a4c91ba
47 result += " ago"; 47 result += " ago";
48 48
49 return result; 49 return result;
50 } 50 }
51 51
52 /* "amount" does not have to be in seconds, and can be any unit if the correct ratio to seconds
53 * is passed to "unit_in_seconds" (for example, if the input is minutes, pass 60.0) */
52 std::string GetSecondsAsAbsoluteString(Units unit_cutoff, Timestamp amount, double unit_in_seconds) { 54 std::string GetSecondsAsAbsoluteString(Units unit_cutoff, Timestamp amount, double unit_in_seconds) {
53 /* avoid calculating this twice */ 55 /* avoid calculating this twice */
54 const double years_conv = (31556952.0 / unit_in_seconds); 56 const double years_conv = (31556952.0 / unit_in_seconds);
55 const double months_conv = (2629746.0 / unit_in_seconds); 57 const double months_conv = (2629746.0 / unit_in_seconds);
56 const double days_conv = (86400.0 / unit_in_seconds); 58 const double days_conv = (86400.0 / unit_in_seconds);
91 } 93 }
92 94
93 int64_t GetSystemTime() { 95 int64_t GetSystemTime() {
94 static_assert(sizeof(int64_t) >= sizeof(time_t)); 96 static_assert(sizeof(int64_t) >= sizeof(time_t));
95 time_t t = std::time(nullptr); 97 time_t t = std::time(nullptr);
96 return reinterpret_cast<int64_t>(t); 98 return static_cast<int64_t>(t);
97 } 99 }
98 100
99 } // namespace Time 101 } // namespace Time