my issue is that I want to be able to get two time stamps and compare if the second (later taken) one is less than 59 minutes away from the first one. Following this thread Compare two dates with JavaScript
the date object may do the job.
but first thing i am not happy with is that it takes the time from my system. is it possible to get the time from some public server or something? cause there always is a chance that the system clock gets manipulated within the time stamps, so that would be too unreliable. some outside source would be great.
then i am not too sure how to get the difference between 2 times (using 2 date objects). many issue that may pop up: time being something like 3:59 and 6:12 so just comparing minutes would give the wrong idea. so we consider hours too. biut there the issue with the modulo 24. day 3 23:59 and day 4 0:33 wouldnt be viewed proper either.
so including days too. then the modulo 30 thing, even though that on top changes month for month. so month and year to be included as well.
so we would need the whole date, everything from current year to second (because second would be nice too, for precision) and comparing them would require tons of if clauses for year, month, etc.
do the date objects have some predfeined date comparision function that actually keeps all these things in mind (havent even mentioned leap years yet, have I)?
time would be very important cause exactly at the 59 minutes mark (+-max 5 seconds wouldnt matter but getting rmeitely close to 60 is forbidden) a certain function would have to be used that without fail closes a website. script opens website at mark 0 min, does some stuff rinse and repeat style and closes page at 59 min mark.
checking the time like every few seconds would be smart.
Any good ideas how to implement such a time comparision that doesnt take too more computer power yet is efficient as in new month starting and stuff doesnt mess it up?