Skip to content

Commit

Permalink
adjust epoch to local time
Browse files Browse the repository at this point in the history
  • Loading branch information
steveims committed May 6, 2024
1 parent 9b4fd36 commit 9540c33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/luerl_lib_os.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit 9540c33

Please sign in to comment.