diff options
author | onefang | 2019-12-29 11:20:44 +1000 |
---|---|---|
committer | onefang | 2019-12-29 11:20:44 +1000 |
commit | 8e5ac033701c27360112f5fc13f1aa78c1326c11 (patch) | |
tree | 6ee28f40370d9b7ce4af8882df903059591c4e62 | |
parent | Refactor nested pairs() calls. (diff) | |
download | apt-panopticon-8e5ac033701c27360112f5fc13f1aa78c1326c11.zip apt-panopticon-8e5ac033701c27360112f5fc13f1aa78c1326c11.tar.gz apt-panopticon-8e5ac033701c27360112f5fc13f1aa78c1326c11.tar.bz2 apt-panopticon-8e5ac033701c27360112f5fc13f1aa78c1326c11.tar.xz |
Fix up some time stuff.
-rwxr-xr-x | apt-panopticon-report-email-web.lua | 2 | ||||
-rwxr-xr-x | apt-panopticon-update-data.lua | 9 | ||||
-rwxr-xr-x | apt-panopticon.lua | 4 |
3 files changed, 4 insertions, 11 deletions
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua index 5598515..a08b901 100755 --- a/apt-panopticon-report-email-web.lua +++ b/apt-panopticon-report-email-web.lua | |||
@@ -608,7 +608,7 @@ if nil == web then C("opening mirrors file - " .. e) else | |||
608 | "You can get the cgp graphing <a href='https://sledjhamr.org/cgit/apt-panopticon_cgp/about/'>source code here (main repo)</a>" .. | 608 | "You can get the cgp graphing <a href='https://sledjhamr.org/cgit/apt-panopticon_cgp/about/'>source code here (main repo)</a>" .. |
609 | "and <a href='https://git.devuan.org/onefang/apt-panopticon_cgp'>here (Devuan repo)</a>.</p>\n" | 609 | "and <a href='https://git.devuan.org/onefang/apt-panopticon_cgp'>here (Devuan repo)</a>.</p>\n" |
610 | ) | 610 | ) |
611 | local whn = APT.exe('TZ="GMT" ls -l1 --time-style="+%s" results/stamp | cut -d " " -f 6-6'):Do().result:sub(2, -2) | 611 | local whn = APT.exe('TZ="GMT" ls -dl1 --time-style="+%s" results/stamp | cut -d " " -f 6-6'):Do().result:sub(2, -2) |
612 | web:write( "<p>This run took " .. (os.time() - tonumber("0" .. whn)) .. " seconds.</p>" .. | 612 | web:write( "<p>This run took " .. (os.time() - tonumber("0" .. whn)) .. " seconds.</p>" .. |
613 | "\n</body></html>\n") | 613 | "\n</body></html>\n") |
614 | web:close() | 614 | web:close() |
diff --git a/apt-panopticon-update-data.lua b/apt-panopticon-update-data.lua index 105a1c7..9d7e1ff 100755 --- a/apt-panopticon-update-data.lua +++ b/apt-panopticon-update-data.lua | |||
@@ -50,7 +50,7 @@ local files = io.popen('ls -1 results_*/results_*.tar.xz 2>/dev/null; ls -1 resu | |||
50 | for l in files:lines() do | 50 | for l in files:lines() do |
51 | local lsub = l:sub(1, -8) | 51 | local lsub = l:sub(1, -8) |
52 | 52 | ||
53 | local dt = os.date('!%s', os.time{year = l:sub(-23, -20), month = l:sub(-18, -17), day = l:sub(-15, -14), hour = l:sub(-12, -11), minute = l:sub(-9, -8)}) - (60 * 60) | 53 | local dt = os.date('!%s', os.time{year = l:sub(-23, -20), month = l:sub(-18, -17), day = l:sub(-15, -14), hour = l:sub(-12, -11), min = l:sub(-9, -8)}) - (60 * 60) |
54 | if dt < oldest then oldest = dt; print('\nOldest time is ' .. oldest) end | 54 | if dt < oldest then oldest = dt; print('\nOldest time is ' .. oldest) end |
55 | 55 | ||
56 | if -1 < APT.verbosity then io.stdout:write('\r' .. 'tar -xf ' .. l); io.stdout:flush() end | 56 | if -1 < APT.verbosity then io.stdout:write('\r' .. 'tar -xf ' .. l); io.stdout:flush() end |
@@ -106,12 +106,7 @@ local files = io.popen('ls -d1 results_*') | |||
106 | for l in files:lines() do | 106 | for l in files:lines() do |
107 | if ('results_old' ~= l) and ('.tar.xz' ~= l:sub(25, -1)) then | 107 | if ('results_old' ~= l) and ('.tar.xz' ~= l:sub(25, -1)) then |
108 | if APT.checkFile(l .. '/stamp') then | 108 | if APT.checkFile(l .. '/stamp') then |
109 | -- local status, whn = APT.execute('TZ="GMT" ls -d1 --time-style="+%s" ' .. l .. ' | cut -d " " -f 6-6') | 109 | APT.now = os.date('!%s', os.time{year = l:sub(9, 12), month = l:sub(14, 15), day = l:sub(17, 18), hour = l:sub(20, 21), min = l:sub(23, 24)}) |
110 | local whn = APT.exe('TZ="GMT" ls -d1 --time-style="+%s" ' .. l .. ' | cut -d " " -f 6-6'):Do() | ||
111 | whn = whn:sub(2, -2) | ||
112 | -- local status, new = APT.execute('TZ="GMT" date -d "' .. whn:sub(9, 18) .. ' ' .. whn:sub(20, 21) .. ':' .. whn:sub(23, 24) .. '" "+%s"') | ||
113 | local new = APT.exe('TZ="GMT" date -d "' .. whn:sub(9, 18) .. ' ' .. whn:sub(20, 21) .. ':' .. whn:sub(23, 24) .. '" "+%s"'):Do() | ||
114 | APT.now = tonumber("0" .. new:sub(2, -2)) | ||
115 | if 0 ~= APT.now then | 110 | if 0 ~= APT.now then |
116 | if APT.checkFile(l .. '/mirrors.lua') then | 111 | if APT.checkFile(l .. '/mirrors.lua') then |
117 | if -1 < APT.verbosity then io.stdout:write('\r' .. l .. ' -> ' .. APT.now); io.stdout:flush() end | 112 | if -1 < APT.verbosity then io.stdout:write('\r' .. l .. ' -> ' .. APT.now); io.stdout:flush() end |
diff --git a/apt-panopticon.lua b/apt-panopticon.lua index 675754d..7ef300c 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua | |||
@@ -1078,9 +1078,7 @@ else | |||
1078 | :And('rm -fr ' .. adt):noErr():fork() | 1078 | :And('rm -fr ' .. adt):noErr():fork() |
1079 | end | 1079 | end |
1080 | local dt = os.date('!%F-%H-%M') | 1080 | local dt = os.date('!%F-%H-%M') |
1081 | local fodt = io.popen('TZ="GMT" date -r results/stamp +%F-%H-%M 2>/dev/null', 'r') | 1081 | local odt = APT.exe('TZ="GMT" date -r results/stamp +%F-%H-%M 2>/dev/null', 'r').result:sub(2, -2) |
1082 | local odt = fodt:read('*l') | ||
1083 | fodt:close() | ||
1084 | if nil ~= odt then os.execute(' rm -f results_old; ln -s results_' .. odt .. ' results_old 2>/dev/null') end | 1082 | if nil ~= odt then os.execute(' rm -f results_old; ln -s results_' .. odt .. ' results_old 2>/dev/null') end |
1085 | if nil ~= dt then os.execute('mkdir -p results_' .. dt .. '; rm -f results; ln -s results_' .. dt .. ' results 2>/dev/null') end | 1083 | if nil ~= dt then os.execute('mkdir -p results_' .. dt .. '; rm -f results; ln -s results_' .. dt .. ' results 2>/dev/null') end |
1086 | os.execute('if [ -f results/stamp ]; then mv results/stamp results/stamp.old; else touch results/stamp.old -t 199901010000; fi; touch results/stamp') | 1084 | os.execute('if [ -f results/stamp ]; then mv results/stamp results/stamp.old; else touch results/stamp.old -t 199901010000; fi; touch results/stamp') |