Merge pull request #34 from tnt-dev/fix-floor

Rename floor/1 to flooring/1
This commit is contained in:
Jesse Gumm 2017-11-22 05:35:24 -06:00 committed by GitHub
commit 4c91fc4c01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1070,7 +1070,7 @@ deregister_format(Key) ->
unixtime_to_now(T) when is_integer(T) -> unixtime_to_now(T) when is_integer(T) ->
MegaSec = floor(T/1000000), MegaSec = flooring(T/1000000),
Secs = T - MegaSec*1000000, Secs = T - MegaSec*1000000,
{MegaSec,Secs,0}. {MegaSec,Secs,0}.
@ -1078,10 +1078,10 @@ unixtime_to_date(T) ->
Now = unixtime_to_now(T), Now = unixtime_to_now(T),
calendar:now_to_datetime(Now). calendar:now_to_datetime(Now).
floor(N) when N >= 0 -> flooring(N) when N >= 0 ->
trunc(N); erlang:trunc(N);
floor(N) when N < 0 -> flooring(N) when N < 0 ->
Int = trunc(N), Int = erlang:trunc(N),
if if
Int==N -> Int; Int==N -> Int;
true -> Int-1 true -> Int-1
@ -1323,7 +1323,7 @@ compressed_parser(_) ->
microsoft_parser(FloatDate) when is_float(FloatDate) -> microsoft_parser(FloatDate) when is_float(FloatDate) ->
try try
DaysSince1900 = floor(FloatDate), DaysSince1900 = flooring(FloatDate),
Days0to1900 = calendar:date_to_gregorian_days(1900,1,1), Days0to1900 = calendar:date_to_gregorian_days(1900,1,1),
GregorianDays = Days0to1900 + DaysSince1900, GregorianDays = Days0to1900 + DaysSince1900,
Date = calendar:gregorian_days_to_date(GregorianDays), Date = calendar:gregorian_days_to_date(GregorianDays),