diff --git a/libs/datetime/date_functions.c b/libs/datetime/date_functions.c index 8b03a74..7da6ec0 100644 --- a/libs/datetime/date_functions.c +++ b/libs/datetime/date_functions.c @@ -84,7 +84,7 @@ GroundValue datetime_ToEpochLocal(GroundScope* scope, List args) { }; time_t ts = mktime(&t); - return groundCreateValue(DOUBLE, (double)ts); + return groundCreateValue(INT, (long long)ts); } GroundValue datetime_ToEpochUTC(GroundScope* scope, List args) { @@ -124,7 +124,7 @@ GroundValue datetime_ToEpochUTC(GroundScope* scope, List args) { }; time_t ts = timegm(&t); - return groundCreateValue(DOUBLE, (double)ts); + return groundCreateValue(INT, (long long)ts); } GroundValue formatDatetimeObj(GroundObject obj, char* formatString) { diff --git a/libs/datetime/datetime.c b/libs/datetime/datetime.c index a235349..3c56e4c 100644 --- a/libs/datetime/datetime.c +++ b/libs/datetime/datetime.c @@ -11,8 +11,8 @@ void ground_init(GroundScope* scope) { groundAddNativeFunction(scope, "datetime_ToISO8601Local", datetime_ToISO8601Local, STRING, 1, CUSTOM, "datetime"); groundAddNativeFunction(scope, "datetime_FromEpochUTC", datetime_FromEpochUTC, CUSTOM, 1, DOUBLE, "epoch"); groundAddNativeFunction(scope, "datetime_FromEpochLocal", datetime_FromEpochLocal, CUSTOM, 1, DOUBLE, "epoch"); - groundAddNativeFunction(scope, "datetime_ToEpochUTC", datetime_ToEpochUTC, DOUBLE, 1, CUSTOM, "datetime"); - groundAddNativeFunction(scope, "datetime_ToEpochLocal", datetime_ToEpochLocal, DOUBLE, 1, CUSTOM, "datetime"); + groundAddNativeFunction(scope, "datetime_ToEpochUTC", datetime_ToEpochUTC, INT, 1, CUSTOM, "datetime"); + groundAddNativeFunction(scope, "datetime_ToEpochLocal", datetime_ToEpochLocal, INT, 1, CUSTOM, "datetime"); groundAddNativeFunction(scope, "datetime_Diff", datetime_Diff, INT, 2, CUSTOM, "datetime1", CUSTOM, "datetime2"); groundAddNativeFunction(scope, "datetime_Add", datetime_Add, CUSTOM, 5, CUSTOM, "datetime", INT, "seconds", INT, "minutes", INT, "hours", INT, "days"); } \ No newline at end of file