Author: ayoung
Date: Wed Oct 6 04:44:12 2010
New Revision: 9152
URL: http://svn.slimdevices.com/jive?rev=9152&view=rev
Log:
task : SN test harness
Add LOADTEST_TIME_OFFSET to allow script runs to simulate a different time of
day
Modified:
7.6/trunk/squeezeplay/src/squeezeplay_desktop/share/applets/ScriptPlay/ScriptPlayApplet.lua
Modified:
7.6/trunk/squeezeplay/src/squeezeplay_desktop/share/applets/ScriptPlay/ScriptPlayApplet.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay_desktop/share/applets/ScriptPlay/ScriptPlayApplet.lua?rev=9152&r1=9151&r2=9152&view=diff
==============================================================================
---
7.6/trunk/squeezeplay/src/squeezeplay_desktop/share/applets/ScriptPlay/ScriptPlayApplet.lua
(original)
+++
7.6/trunk/squeezeplay/src/squeezeplay_desktop/share/applets/ScriptPlay/ScriptPlayApplet.lua
Wed Oct 6 04:44:12 2010
@@ -1,4 +1,4 @@
-local assert, loadfile, ipairs, package, pairs, require, tostring, type =
assert, loadfile, ipairs, package, pairs, require,tostring, type
+local assert, loadfile, ipairs, package, pairs, require, tostring, type,
tonumber = assert, loadfile, ipairs, package, pairs, require,tostring, type,
tonumber
local oo = require("loop.simple")
local io = require("io")
@@ -29,6 +29,11 @@
end
jnt:subscribe(self)
self.running = false
+
+ local offset = os.getenv("LOADTEST_TIME_OFFSET")
+ if offset ~= nil and tonumber(offset) > 0 then
+ self.timeOffset = tonumber(offset)
+ end
end
local function loadconfigfile(file)
@@ -127,6 +132,11 @@
function _new_getNextTrack(self)
local t = os.date("!*t")
local secondsSinceMidnight = t.sec + t.min * 60 + t.hour * 3600
+
+ if self.timeOffset then
+ secondsSinceMidnight = (secondsSinceMidnight + self.timeOffset)
% (3600 * 24)
+ end
+
local ticsOffset = Framework:getTicks() / 1000 - secondsSinceMidnight
local start, duration, pstart, pduration
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins