Index: src/macros.py |
diff --git a/src/macros.py b/src/macros.py |
index 8d836aae5bc3f3b3ffd06bd4ef03e9daa121b174..93287ae3d44a378bbfff81fc4f211fe6b8d0f890 100644 |
--- a/src/macros.py |
+++ b/src/macros.py |
@@ -164,35 +164,36 @@ const MAX_TIME_BEFORE_UTC = 8640002592000000; |
# Gets the value of a Date object. If arg is not a Date object |
# a type error is thrown. |
-macro DATE_VALUE_UNCHECKED(arg) = (%_DateField(arg, 0)); |
-macro DATE_LOCAL_UNCHECKED(arg) = (%_DateField(arg, 1)); |
-macro DATE_VALUE(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 0) : ThrowDateTypeError()); |
-macro DATE_LOCAL(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 1) : ThrowDateTypeError()); |
-macro DATE_YEAR(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 2) : ThrowDateTypeError()); |
-macro DATE_MONTH(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 3) : ThrowDateTypeError()); |
-macro DATE_DAY(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 4) : ThrowDateTypeError()); |
-macro DATE_HOUR(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 5) : ThrowDateTypeError()); |
-macro DATE_MIN(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 6) : ThrowDateTypeError()); |
-macro DATE_SEC(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 7) : ThrowDateTypeError()); |
-macro DATE_WEEKDAY(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 8) : ThrowDateTypeError()); |
-macro SET_DATE_VALUE(arg, value) = (%_SetDateField(arg, 0, value)); |
-macro SET_DATE_LOCAL(arg, value) = (%_SetDateField(arg, 1, value)); |
-macro SET_DATE_YEAR(arg, value) = (%_SetDateField(arg, 2, value)); |
-macro SET_DATE_MONTH(arg, value) = (%_SetDateField(arg, 3, value)); |
-macro SET_DATE_DAY(arg, value) = (%_SetDateField(arg, 4, value)); |
-macro SET_DATE_HOUR(arg, value) = (%_SetDateField(arg, 5, value)); |
-macro SET_DATE_MIN(arg, value) = (%_SetDateField(arg, 6, value)); |
-macro SET_DATE_SEC(arg, value) = (%_SetDateField(arg, 7, value)); |
-macro SET_DATE_WEEKDAY(arg, value) = (%_SetDateField(arg, 8, value)); |
-macro DAY(time) = ($floor(time / 86400000)); |
-macro NAN_OR_DATE_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : DateFromTime(time)); |
-macro HOUR_FROM_TIME(time) = (Modulo($floor(time / 3600000), 24)); |
-macro MIN_FROM_TIME(time) = (Modulo($floor(time / 60000), 60)); |
-macro NAN_OR_MIN_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : MIN_FROM_TIME(time)); |
-macro SEC_FROM_TIME(time) = (Modulo($floor(time / 1000), 60)); |
-macro NAN_OR_SEC_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : SEC_FROM_TIME(time)); |
-macro MS_FROM_TIME(time) = (Modulo(time, 1000)); |
-macro NAN_OR_MS_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : MS_FROM_TIME(time)); |
+macro CHECK_DATE(arg) = if (%_ClassOf(arg) !== 'Date') ThrowDateTypeError(); |
+macro LOCAL_DATE_VALUE(arg) = (%_DateField(arg, 0) + %_DateField(arg, 21)); |
+macro UTC_DATE_VALUE(arg) = (%_DateField(arg, 0)); |
+ |
+macro LOCAL_YEAR(arg) = (%_DateField(arg, 1)); |
+macro LOCAL_MONTH(arg) = (%_DateField(arg, 2)); |
+macro LOCAL_DAY(arg) = (%_DateField(arg, 3)); |
+macro LOCAL_WEEKDAY(arg) = (%_DateField(arg, 4)); |
+macro LOCAL_HOUR(arg) = (%_DateField(arg, 5)); |
+macro LOCAL_MIN(arg) = (%_DateField(arg, 6)); |
+macro LOCAL_SEC(arg) = (%_DateField(arg, 7)); |
+macro LOCAL_MS(arg) = (%_DateField(arg, 8)); |
+macro LOCAL_DAYS(arg) = (%_DateField(arg, 9)); |
+macro LOCAL_TIME_IN_DAY(arg) = (%_DateField(arg, 10)); |
+ |
+macro UTC_YEAR(arg) = (%_DateField(arg, 11)); |
+macro UTC_MONTH(arg) = (%_DateField(arg, 12)); |
+macro UTC_DAY(arg) = (%_DateField(arg, 13)); |
+macro UTC_WEEKDAY(arg) = (%_DateField(arg, 14)); |
+macro UTC_HOUR(arg) = (%_DateField(arg, 15)); |
+macro UTC_MIN(arg) = (%_DateField(arg, 16)); |
+macro UTC_SEC(arg) = (%_DateField(arg, 17)); |
+macro UTC_MS(arg) = (%_DateField(arg, 18)); |
+macro UTC_DAYS(arg) = (%_DateField(arg, 19)); |
+macro UTC_TIME_IN_DAY(arg) = (%_DateField(arg, 20)); |
+ |
+macro TIMEZONE_OFFSET(arg) = (%_DateField(arg, 21)); |
+ |
+macro SET_UTC_DATE_VALUE(arg, value) = (%DateSetValue(arg, value, 1)); |
+macro SET_LOCAL_DATE_VALUE(arg, value) = (%DateSetValue(arg, value, 0)); |
# Last input and last subject of regexp matches. |
macro LAST_SUBJECT(array) = ((array)[1]); |