|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- This file:
-- http://angg.twu.net/LUA/timestamps.lua.html
-- http://angg.twu.net/LUA/timestamps.lua
-- (find-angg "LUA/timestamps.lua")
-- Author: Eduardo Ochs <eduardoochs@gmail.com>
-- See: (find-es "lua5" "luaposix-stat-hr")
-- (find-es "angg" "timestamps")
-- «.files-and-timestamps» (to "files-and-timestamps")
posix_sys_stat = require("posix.sys.stat")
posix = require("posix")
stat = posix_sys_stat.stat
mktime = posix.mktime
strptime = posix.strptime
-- "hr": "human-readable"
mtime_int = function (fname) return stat(fname).st_mtime end
mtime_hr = function (fname) return int_to_hr(mtime_int(fname)) end
int_to_hr = function (timeint) return os.date("%F %T %z", timeint) end
ht_to_int = function (timehr) return mktime((posix.strptime(timehr, "%F %T %z"))) end
--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "timestamps.lua"
= mtime_int("/etc/")
= int_to_hr(mtime_int("/etc/"))
= ht_to_int(int_to_hr(mtime_int("/etc/")))
--]]
-- «files-and-timestamps» (to ".files-and-timestamps")
-- (find-anggfile "TH/Makefile")
--
--[[
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd
make -f ~/TH/Makefile MAKEFILEAUTO
make -f ~/TH/Makefile NEEDMAKEFILEAUTO=1 echo-tgzfiles | sort | tee ~/.files
# (find-fline "~/.files")
# (find-fline "~/.files" "lua51 ~/blogme3/blogme3.lua")
# (find-fline "~/.timestamps")
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "timestamps.lua"
chdir "~/"
bigstr = ee_readfile "~/.files"
A = {}
for _,fname in ipairs(split(bigstr)) do
-- print(fname)
table.insert(A, format("%-40s %s\n", fname, mtime_hr(fname)))
end
ee_writefile("~/.timestamps", table.concat(A, ""))
-- (find-fline "~/.timestamps")
--]]