Assumedly that was very clear script to understand, but you're right. When I started programming,
I remember some basic stuff (that now seems to be so obvious for me) was quite hard for long time.
I use variable keywords (var) only when there is a must for it, otherwise I avoid them completely.
So you got 15 : 00 : 03? I have no idea why there is 15 at beginning for you. For me it's 00 : 00 : 03
It's because I used 3 seconds delay by $.sleep(3000), so in the place you normally would use main()
If you'd like to see how result will look like with more time than 3 seconds let me explain some rules:
1 second = 1'000
1 minute = 60'000
1 hour = 3'600'000
So if for ex. process of your script takes 2 hours 8 minutes 6 seconds you had to put:
7686000 ie. (2 * 3600000) + (8 * 60000) + (6 * 1000) instead of nD into this test script:
function SLC(v1, v2, v3) {
function slc(v) {
return eval("('0' + (new Date(new Date() - (new Date() - 7686000)).get" + v + ")).slice(-2)")
}
return slc(v1) + ' : ' + slc(v2) + ' : ' + slc(v3)
}
alert(SLC('Hours() - 1', 'Minutes()', 'Seconds()'))
As you see I removed nD = new Date(), $.sleep(3000), part. This way avoiding waiting I could get instant result.
Tell me will be your result 02 : 08 : 06. If I'm right for some reason it can be increased of 15 hours, so 17 : 08 : 06
If so then in original script (from previous post of me) just change 'Hours() - 1 to 'Hours() - 16