forked from ground/ground
first version of datetime lib
This commit is contained in:
18
libs/datetime/datetime.c
Normal file
18
libs/datetime/datetime.c
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "time_functions.h"
|
||||
#include "date_functions.h"
|
||||
|
||||
|
||||
void ground_init(GroundScope* scope) {
|
||||
groundAddNativeFunction(scope, "datetime_NowEpoch", datetime_NowEpoch, DOUBLE, 0);
|
||||
groundAddNativeFunction(scope, "datetime_Now", datetime_Now, CUSTOM, 0);
|
||||
groundAddNativeFunction(scope, "datetime_Format", datetime_Format, STRING, 2, CUSTOM, "datetime", STRING, "format");
|
||||
groundAddNativeFunction(scope, "datetime_FromFormatted", datetime_FromFormatted, CUSTOM, 2, STRING, "datetimeString", STRING, "format");
|
||||
groundAddNativeFunction(scope, "datetime_ToISO8601UTC", datetime_ToISO8601UTC, STRING, 1, CUSTOM, "datetime");
|
||||
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_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");
|
||||
}
|
||||
Reference in New Issue
Block a user