| 68 | } |
| 69 | |
| 70 | void split_time(u64 time, u32& years, u32& months, u32& days, u32& hours, u32& minutes, u32& seconds, u32& milliseconds) |
| 71 | { |
| 72 | milliseconds = u32(time % 1000); |
| 73 | time /= 1000; |
| 74 | seconds = u32(time % 60); |
| 75 | time /= 60; |
| 76 | minutes = u32(time % 60); |
| 77 | time /= 60; |
| 78 | hours = u32(time % 24); |
| 79 | time /= 24; |
| 80 | years = u32(u64(400) * time / u64(365 * 400 + 100 - 4 + 1) + 1); |
| 81 | u64 t1, t2, t3, t4; |
| 82 | t1 = years / 400; |
| 83 | t2 = years / 100; |
| 84 | t3 = years / 4; |
| 85 | bool a1, a2, a3; |
| 86 | a1 = !(years % 400); |
| 87 | a2 = !(years % 100); |
| 88 | a3 = !(years % 4); |
| 89 | t4 = a3 && (!a2 || a1) ? 1 : 0; |
| 90 | u64 result = u64(years - 1) * u64(365) + t1 - t2 + t3; |
| 91 | time -= result; |
| 92 | ++time; |
| 93 | months = 1; |
| 94 | if (time > 31) |
| 95 | { |
| 96 | ++months; |
| 97 | time -= 31; |
| 98 | if (time > 28 + t4) |
| 99 | { |
| 100 | ++months; |
| 101 | time -= 28 + t4; |
| 102 | if (time > 31) |
| 103 | { |
| 104 | ++months; |
| 105 | time -= 31; |
| 106 | if (time > 30) |
| 107 | { |
| 108 | ++months; |
| 109 | time -= 30; |
| 110 | if (time > 31) |
| 111 | { |
| 112 | ++months; |
| 113 | time -= 31; |
| 114 | if (time > 30) |
| 115 | { |
| 116 | ++months; |
| 117 | time -= 30; |
| 118 | if (time > 31) |
| 119 | { |
| 120 | ++months; |
| 121 | time -= 31; |
| 122 | if (time > 31) |
| 123 | { |
| 124 | ++months; |
| 125 | time -= 31; |
| 126 | if (time > 30) |
| 127 | { |
no test coverage detected