Code worked for almost a year; a few days ago it stopped working.
The variable “factor” is used to create a decimal 1.00-0.00 for a ratio of the amount of seconds that have passed since the start of the current class period (46 min = 2760 seconds.)
`
local factor = round(((current - start) / 2760),2);
function round(val, decimalPoints) {
local f = math.pow(10, decimalPoints) * 1.0;
local newVal = val * f;
newVal = math.floor(newVal + 0.5)
newVal = (newVal * 1.0) / f;
return newVal;
}
`
Even when I test:
server.log((current - start) / 2760); server.log((45843 - 44400) / 2760);
2016-09-07 12:42:56 UTC-5 [Device] 0
2016-09-07 12:42:56 UTC-5 [Device] 0
Thank you for any thoughts