Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- // Startdate is when we open the file
- StartDate = parseInt(new Date().getTime());
- // I'll just butcher this function a bit because I haven't defined Game and Beautify
- SayTime = function(time,detail)
- {
- var str='';
- var detail=detail||0;
- time=Math.floor(time);
- if (time>=60*60*24*2 && detail<2) str=time/(60*60*24)+' days';
- else if (time>=60*60*24 && detail<2) str='1 day';
- else if (time>=60*60*2 && detail<3) str=time/(60*60)+' hours';
- else if (time>=60*60 && detail<3) str='1 hour';
- else if (time>=60*2 && detail<4) str=time/(60)+' minutes';
- else if (time>=60 && detail<4) str='1 minute';
- else if (time>=2 && detail<5) str=time/(1)+' seconds';
- else if (time>=1 && detail<5) str='1 second';
- return str;
- }
- // We simulate playtime by watching an alert. Fun.
- alert("Please wait a few seconds to close this alert. Count along, too.")
- // Now we calculate the difference before and after the alert.
- var date=new Date();
- date.setTime(new Date().getTime()-StartDate);
- // We convert the difference to milliseconds with parseInt in the following two steps
- // We divide the amount of milliseconds by 60 and then write it in base 4. Uhhhh...?
- dateORT=SayTime(parseInt(date.getTime())/60,4);
- // Or we can just divide the amount of milliseconds by 1000 to get seconds.
- dateFIX=SayTime(parseInt(date.getTime())/1000);
- document.write("Time passed according to Orteil: "+dateORT+"<br />Time passed like it should be: "+dateFIX)
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement