diff options
author | Björn-Egil Dahlberg <[email protected]> | 2011-06-29 15:20:38 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2011-12-02 15:41:13 +0100 |
commit | c489db32a796be2d7de7a683544c333a77d917b8 (patch) | |
tree | e7761b3c04ec76f6a7bedaf9d80c3ea9b63c541f /lib/kernel | |
parent | e7b0c8c6e72d8b0b60eb00e7e66fea2769963dc2 (diff) | |
download | otp-c489db32a796be2d7de7a683544c333a77d917b8.tar.gz otp-c489db32a796be2d7de7a683544c333a77d917b8.tar.bz2 otp-c489db32a796be2d7de7a683544c333a77d917b8.zip |
Fix undefined datetimes
Diffstat (limited to 'lib/kernel')
-rw-r--r-- | lib/kernel/src/file.erl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl index bdafcf2cfb..8f027f5a40 100644 --- a/lib/kernel/src/file.erl +++ b/lib/kernel/src/file.erl @@ -1378,10 +1378,15 @@ time_epochs_to_local(Seconds) when is_integer(Seconds) -> erlang:universaltime_to_localtime(calendar:gregorian_seconds_to_datetime(Seconds + ?SECONDS_PER_DAY * ?DAYS_FROM_0_TO_1970)). time_utc_to_epochs({_, _} = Datetime) -> - calendar:datetime_to_gregorian_seconds(Datetime) - ?SECONDS_PER_DAY * ?DAYS_FROM_0_TO_1970. + calendar:datetime_to_gregorian_seconds(Datetime) - ?SECONDS_PER_DAY * ?DAYS_FROM_0_TO_1970; +time_utc_to_epochs(undefined) -> + time_utc_to_epochs(erlang:universaltime()). + time_local_to_epochs({_, _} = Datetime) -> - calendar:datetime_to_gregorian_seconds(erlang:localtime_to_universaltime(Datetime)) - ?SECONDS_PER_DAY * ?DAYS_FROM_0_TO_1970. + calendar:datetime_to_gregorian_seconds(erlang:localtime_to_universaltime(Datetime)) - ?SECONDS_PER_DAY * ?DAYS_FROM_0_TO_1970; +time_local_to_epochs(undefined) -> + time_utc_to_epochs(erlang:universaltime()). %% file_name(FileName) |