get-universal-time-ms added
This commit is contained in:
11
ml.cpp
11
ml.cpp
@@ -1298,6 +1298,16 @@ MlValue get_universal_time(std::vector<MlValue> args, MlEnvironment &env) {
|
||||
return MlValue(now());
|
||||
}
|
||||
|
||||
// Get current time as miliseconds from epoch
|
||||
MlValue get_universal_time_ms(std::vector<MlValue> args, MlEnvironment &env) {
|
||||
eval_args(args, env);
|
||||
|
||||
if (!args.empty())
|
||||
throw MlError(MlValue("get-universal-time-ms", get_universal_time_ms), env, TOO_MANY_ARGS);
|
||||
|
||||
return MlValue(now_ms());
|
||||
}
|
||||
|
||||
// Get offsets in secs between local timezone and gmt
|
||||
MlValue get_localtime_offset(std::vector<MlValue> args, MlEnvironment &env) {
|
||||
eval_args(args, env);
|
||||
@@ -2294,6 +2304,7 @@ std::map<const std::string, Builtin> builtin_funcs
|
||||
|
||||
// Datetime operations
|
||||
std::make_pair("get-universal-time", builtin::get_universal_time),
|
||||
std::make_pair("get-universal-time-ms", builtin::get_universal_time_ms),
|
||||
std::make_pair("get-localtime-offset", builtin::get_localtime_offset),
|
||||
std::make_pair("date-to-str", builtin::date_to_str),
|
||||
std::make_pair("str-to-date", builtin::str_to_date),
|
||||
|
||||
Reference in New Issue
Block a user