aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2011-12-07 15:53:21 +0100
committerBjörn-Egil Dahlberg <[email protected]>2011-12-08 14:12:03 +0100
commita37f854be3aaee3786d555a28bb4c8d53384a852 (patch)
tree567e23d85a3802e48bb0a40c6318a26f51eef87b
parent9158448a508e3e919739dbee0e8e0cad32445941 (diff)
downloadotp-a37f854be3aaee3786d555a28bb4c8d53384a852.tar.gz
otp-a37f854be3aaee3786d555a28bb4c8d53384a852.tar.bz2
otp-a37f854be3aaee3786d555a28bb4c8d53384a852.zip
Change options to prim_file:*_file_info/*
* 'utc' changed to 'universal' * 'epoch' changed to 'posix' This change conforms to other naming already in OTP, e.g. erlang:universaltime_to_localtime/1.
-rw-r--r--erts/preloaded/src/prim_file.erl16
-rw-r--r--lib/kernel/test/prim_file_SUITE.erl20
2 files changed, 18 insertions, 18 deletions
diff --git a/erts/preloaded/src/prim_file.erl b/erts/preloaded/src/prim_file.erl
index 2567388a6a..e5cb1d5c03 100644
--- a/erts/preloaded/src/prim_file.erl
+++ b/erts/preloaded/src/prim_file.erl
@@ -810,9 +810,9 @@ write_file_info_int(Port, File,
file_info_validate_atime(Atime, _) when Atime =/= undefined -> Atime;
-file_info_validate_atime(undefined, local) -> erlang:localtime();
-file_info_validate_atime(undefined, utc) -> erlang:universaltime();
-file_info_validate_atime(undefined, epoch) -> erlang:universaltime_to_seconds((erlang:universaltime())).
+file_info_validate_atime(undefined, local) -> erlang:localtime();
+file_info_validate_atime(undefined, universal) -> erlang:universaltime();
+file_info_validate_atime(undefined, posix) -> erlang:universaltime_to_seconds((erlang:universaltime())).
file_info_validate_mtime(undefined, Atime) -> Atime;
file_info_validate_mtime(Mtime, _) -> Mtime.
@@ -1343,19 +1343,19 @@ plgv(_, [], D) -> D.
%%
%% We don't actually want this here
-%% We want to use epochs in all prim but erl_prim_loader makes that tricky
+%% We want to use posix time in all prim but erl_prim_loader makes that tricky
%% It is probably needed to redo the whole erl_prim_loader
-from_seconds(Seconds, epoch) when is_integer(Seconds) ->
+from_seconds(Seconds, posix) when is_integer(Seconds) ->
Seconds;
-from_seconds(Seconds, utc) when is_integer(Seconds) ->
+from_seconds(Seconds, universal) when is_integer(Seconds) ->
erlang:seconds_to_universaltime(Seconds);
from_seconds(Seconds, local) when is_integer(Seconds) ->
erlang:universaltime_to_localtime(erlang:seconds_to_universaltime(Seconds)).
-to_seconds(Seconds, epoch) when is_integer(Seconds) ->
+to_seconds(Seconds, posix) when is_integer(Seconds) ->
Seconds;
-to_seconds({_,_} = Datetime, utc) ->
+to_seconds({_,_} = Datetime, universal) ->
erlang:universaltime_to_seconds(Datetime);
to_seconds({_,_} = Datetime, local) ->
erlang:universaltime_to_seconds(erlang:localtime_to_universaltime(Datetime)).
diff --git a/lib/kernel/test/prim_file_SUITE.erl b/lib/kernel/test/prim_file_SUITE.erl
index 035817a8bc..e6e0974a95 100644
--- a/lib/kernel/test/prim_file_SUITE.erl
+++ b/lib/kernel/test/prim_file_SUITE.erl
@@ -1098,7 +1098,7 @@ file_write_file_info_opts(Config) when is_list(Config) ->
ok = ?PRIM_FILE_call(write_file_info, Handle, [Name, FI, Opts])
end, [
{#file_info{ mode=8#600, atime = Time, mtime = Time, ctime = Time}, Opts} ||
- Opts <- [[{time, epoch}]],
+ Opts <- [[{time, posix}]],
Time <- [ 0,1,-1,100,-100,1000,-1000,10000,-10000 ]
]),
@@ -1107,7 +1107,7 @@ file_write_file_info_opts(Config) when is_list(Config) ->
ok = ?PRIM_FILE_call(write_file_info, Handle, [Name, FI, Opts])
end, [
{#file_info{ mode=8#400, atime = Time, mtime = Time, ctime = Time}, Opts} ||
- Opts <- [[{time, utc}],[{time, local}]],
+ Opts <- [[{time, universal}],[{time, local}]],
Time <- [
{{1970,1,1},{0,0,0}},
{{1970,1,1},{0,0,1}},
@@ -1135,7 +1135,7 @@ file_read_file_info_opts(Config) when is_list(Config) ->
lists:foreach(fun
(Opts) ->
{ok,_} = ?PRIM_FILE_call(read_file_info, Handle, [Name, Opts])
- end, [[{time, Type}] || Type <- [local, utc, epoch]]),
+ end, [[{time, Type}] || Type <- [local, universal, posix]]),
ok = ?PRIM_FILE:stop(Handle),
test_server:timetrap_cancel(Dog),
ok.
@@ -1154,14 +1154,14 @@ file_write_read_file_info_opts(Config) when is_list(Config) ->
ok = ?PRIM_FILE:write_file(Name, "hello_opts2"),
ok = file_write_read_file_info_opts(Handle, Name, {{1989, 04, 28}, {19,30,22}}, [{time, local}]),
- ok = file_write_read_file_info_opts(Handle, Name, {{1989, 04, 28}, {19,30,22}}, [{time, utc}]),
+ ok = file_write_read_file_info_opts(Handle, Name, {{1989, 04, 28}, {19,30,22}}, [{time, universal}]),
ok = file_write_read_file_info_opts(Handle, Name, {{1930, 04, 28}, {19,30,22}}, [{time, local}]),
- ok = file_write_read_file_info_opts(Handle, Name, {{1930, 04, 28}, {19,30,22}}, [{time, utc}]),
- ok = file_write_read_file_info_opts(Handle, Name, 1, [{time, epoch}]),
- ok = file_write_read_file_info_opts(Handle, Name, -1, [{time, epoch}]),
- ok = file_write_read_file_info_opts(Handle, Name, 300000, [{time, epoch}]),
- ok = file_write_read_file_info_opts(Handle, Name, -300000, [{time, epoch}]),
- ok = file_write_read_file_info_opts(Handle, Name, 0, [{time, epoch}]),
+ ok = file_write_read_file_info_opts(Handle, Name, {{1930, 04, 28}, {19,30,22}}, [{time, universal}]),
+ ok = file_write_read_file_info_opts(Handle, Name, 1, [{time, posix}]),
+ ok = file_write_read_file_info_opts(Handle, Name, -1, [{time, posix}]),
+ ok = file_write_read_file_info_opts(Handle, Name, 300000, [{time, posix}]),
+ ok = file_write_read_file_info_opts(Handle, Name, -300000, [{time, posix}]),
+ ok = file_write_read_file_info_opts(Handle, Name, 0, [{time, posix}]),
ok = ?PRIM_FILE:stop(Handle),
test_server:timetrap_cancel(Dog),