From 9540c339ff3c2e1800c06c8fc375caf5edbe3fcb Mon Sep 17 00:00:00 2001 From: Steve Ims Date: Mon, 6 May 2024 08:24:23 -0400 Subject: [PATCH] adjust epoch to local time --- src/luerl_lib_os.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/luerl_lib_os.erl b/src/luerl_lib_os.erl index ba41408..441b5f4 100644 --- a/src/luerl_lib_os.erl +++ b/src/luerl_lib_os.erl @@ -251,8 +251,8 @@ compute_time(Map=#{<<"year">> := Y, <<"month">> := Mth, <<"day">> := D}, _, St) H = maps:get(<<"hour">>, Map, 12), Min = maps:get(<<"min">>, Map, 0), S = maps:get(<<"sec">>, Map, 0), - %% 62167219200 = calendar:datetime_to_gregorian_seconds({1970, 1, 1}, {0, 0, 0}) - Result = calendar:datetime_to_gregorian_seconds({{Y, Mth, D}, {H, Min, S}}) - 62167219200, + LocalEpoch = calendar:universal_time_to_local_time({{1970,1,1},{0,0,0}}), + Result = calendar:datetime_to_gregorian_seconds({{Y, Mth, D}, {H, Min, S}}) - calendar:datetime_to_gregorian_seconds(LocalEpoch), {[Result],St}; compute_time(_, As, St) -> badarg_error(time, As, St).