aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/calendar_SUITE.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2018-04-26 15:21:41 +0200
committerHans Bolinder <[email protected]>2018-04-26 15:21:41 +0200
commitbfde922a6308a7f0956cf688ab38cbdbffbba41d (patch)
tree84eacd924ce5babf063ff81a2d6910a11de23511 /lib/stdlib/test/calendar_SUITE.erl
parent9779a7fe2dd318f9b1e5a2d4b3b4e413200d0f9c (diff)
parent83515e39e7c321910082fa3ef8a06a659c51f70a (diff)
downloadotp-bfde922a6308a7f0956cf688ab38cbdbffbba41d.tar.gz
otp-bfde922a6308a7f0956cf688ab38cbdbffbba41d.tar.bz2
otp-bfde922a6308a7f0956cf688ab38cbdbffbba41d.zip
Merge branch 'hasse/stdlib/calendar_systemtime/OTP-13413'
* hasse/stdlib/calendar_systemtime/OTP-13413: stdlib: Add system time functions to module calendar
Diffstat (limited to 'lib/stdlib/test/calendar_SUITE.erl')
-rw-r--r--lib/stdlib/test/calendar_SUITE.erl24
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/stdlib/test/calendar_SUITE.erl b/lib/stdlib/test/calendar_SUITE.erl
index 20053dfe54..52c3cc68eb 100644
--- a/lib/stdlib/test/calendar_SUITE.erl
+++ b/lib/stdlib/test/calendar_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2016. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2018. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -30,7 +30,8 @@
leap_years/1,
last_day_of_the_month/1,
local_time_to_universal_time_dst/1,
- iso_week_number/1]).
+ iso_week_number/1,
+ system_time/1]).
-define(START_YEAR, 1947).
-define(END_YEAR, 2012).
@@ -40,7 +41,8 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
[gregorian_days, gregorian_seconds, day_of_the_week,
day_of_the_week_calibrate, leap_years,
- last_day_of_the_month, local_time_to_universal_time_dst, iso_week_number].
+ last_day_of_the_month, local_time_to_universal_time_dst,
+ iso_week_number, system_time].
groups() ->
[].
@@ -157,6 +159,22 @@ local_time_to_universal_time_dst_x(Config) when is_list(Config) ->
iso_week_number(Config) when is_list(Config) ->
check_iso_week_number().
+system_time(Config) when is_list(Config) ->
+ EpochDate = {{1970,1,1}, {0,0,0}},
+ Epoch = calendar:datetime_to_gregorian_seconds(EpochDate),
+ Y0 = {{0,1,1},{0,0,0}},
+
+ EpochDate = calendar:system_time_to_universal_time(0, second),
+ 0 = calendar:datetime_to_gregorian_seconds(Y0),
+ Y0 = calendar:system_time_to_universal_time(-Epoch, second),
+
+ T = erlang:system_time(second),
+ UDate = calendar:system_time_to_universal_time(T, second),
+ LDate = erlang:universaltime_to_localtime(UDate),
+ LDate = calendar:system_time_to_local_time(T, second),
+
+ ok.
+
%%
%% LOCAL FUNCTIONS
%%