File modification time: Difference between revisions

Added Elixir
(Added Elixir)
Line 513:
 
File visiting buffers record the modification time of the file so as to guard against changes by another program. <code>set-file-times</code> from within Emacs doesn't update those buffer times and so looks like an external change.
 
=={{header|Elixir}}==
<pre>
iex(1)> info = File.stat!("input.txt")
%File.Stat{access: :read_write, atime: {{2015, 10, 29}, {20, 44, 28}},
ctime: {{2015, 9, 20}, {9, 5, 58}}, gid: 0, inode: 0, links: 1,
major_device: 3, minor_device: 0, mode: 33206,
mtime: {{2015, 10, 29}, {20, 44, 28}}, size: 45, type: :regular, uid: 0}
iex(2)> info.mtime
{{2015, 10, 29}, {20, 44, 28}}
iex(3)> File.touch!("input.txt")
:ok
iex(4)> File.stat!("input.txt")
%File.Stat{access: :read_write, atime: {{2016, 3, 7}, {23, 12, 35}},
ctime: {{2016, 3, 7}, {23, 12, 35}}, gid: 0, inode: 0, links: 1,
major_device: 3, minor_device: 0, mode: 33206,
mtime: {{2016, 3, 7}, {23, 12, 35}}, size: 45, type: :regular, uid: 0}</lang>
</pre>
 
=={{header|Erlang}}==
Line 934 ⟶ 952:
# keep atime unchanged
# set mtime to current time</lang>
 
=={{header|Perl 6}}==
{{works with|Rakudo Star|2013-02}}
Line 1,050 ⟶ 1,069:
Return f.ModificationDate
End Function</lang>
 
 
=={{header|REXX}}==
Anonymous user