Commits

Kaya Kupferschmidt committed 6371838

Tidied up some code

Comments (0)

Files changed (1)

source/libs/magnum_core/source/magnum/util/DateTime.cpp

 /*--------------------------------------------------------------------------*/
 /**
  */
-void DateTime::setAbsolute(int julianDay, int64 curTicks)
-{
-    int curLeapSeconds = getLeapSecondsForJulianDay(julianDay);
-    curTicks -= curLeapSeconds * TicksPerSecond;
-
-    // Correctly handle over/underflows due to leap-second adjustments
-    if (curTicks < 0) {
-        julianDay--;
-        curTicks += TicksPerDay;
-        int newLeapSeconds = getLeapSecondsForJulianDay(julianDay);
-        if (newLeapSeconds != curLeapSeconds) {
-            curTicks += (curLeapSeconds - newLeapSeconds) * TicksPerSecond;
-        }
-    }
-    else if (curTicks >= TicksPerDay) {
-        julianDay++;
-        curTicks -= TicksPerDay;
-        int newLeapSeconds = getLeapSecondsForJulianDay(julianDay);
-        if (newLeapSeconds != curLeapSeconds) {
-            curTicks -= (newLeapSeconds - curLeapSeconds) * TicksPerSecond;
-            if (curTicks < 0) {
-                julianDay--;
-                curTicks += TicksPerDay;
-            }
-        }
-    }
-
-    m_Date.setJulianDay(julianDay);
-    m_Time.setTicks(curTicks);
-}
-
-
-
-/*--------------------------------------------------------------------------*/
-/**
- */
 void DateTime::addTicks(int64 ticks)
 {
     int julianDay = m_Date.getJulianDay();
 /*--------------------------------------------------------------------------*/
 /**
  */
+void DateTime::setAbsolute(int julianDay, int64 curTicks)
+{
+    int curLeapSeconds = getLeapSecondsForJulianDay(julianDay);
+    curTicks -= curLeapSeconds * TicksPerSecond;
+
+    // Correctly handle over/underflows due to leap-second adjustments
+    if (curTicks < 0) {
+        julianDay--;
+        curTicks += TicksPerDay;
+        int newLeapSeconds = getLeapSecondsForJulianDay(julianDay);
+        if (newLeapSeconds != curLeapSeconds) {
+            curTicks += (curLeapSeconds - newLeapSeconds) * TicksPerSecond;
+        }
+    }
+#if 0
+    else if (curTicks >= TicksPerDay) {
+        julianDay++;
+        curTicks -= TicksPerDay;
+        int newLeapSeconds = getLeapSecondsForJulianDay(julianDay);
+        if (newLeapSeconds != curLeapSeconds) {
+            curTicks -= (newLeapSeconds - curLeapSeconds) * TicksPerSecond;
+            if (curTicks < 0) {
+                julianDay--;
+                curTicks += TicksPerDay;
+            }
+        }
+    }
+#endif
+
+    m_Date.setJulianDay(julianDay);
+    m_Time.setTicks(curTicks);
+}
+
+
+/*--------------------------------------------------------------------------*/
+/**
+ */
 void DateTime::addSeconds(int seconds)
 {
     addMilliseconds(int64(MillisecondsPerSecond)*seconds);