I want to run an interactive simulation and have time pass at 12x real time. There is more than one solution to this, but is there a way to make the server clock run 12x faster?
3 Answers
Related question here (although Java-based). Even if you could speed the system clock up you'd break various of things (logging, timestamps on files, time-based kernel stuff to name but three) so it would seem better if your code could be made independent of "real" time.
Perhaps you could invent a new unit of time, equal to 1/12 of a second, and code your app in terms of that?
I suppose a script that changes the clock (starting waaaay back) and every second adds +12 seconds won't be good, will it? Somewhat I suspect the application is not using gettimeofday, but has an internal counter and timers. What simulation is that?
-
It will be a django system with people trading with each other. Can fudge it, but just wondering if it's possible to make the server solve the problem. Nov 25, 2009 at 21:12
-
Must admit no familiarity with Django trading systems :) I suspect it would not help, since it involves other peers (do you plan to adjust their clock as well?). Again, sorry for not being of much help - best thing would be tweaking the simulation for that purpose, assuming it's possible at all.– lorenzogNov 25, 2009 at 22:08
-
It does seem possible to tweek the clock - see adjtime - but maybe not advisable! Nov 26, 2009 at 10:19
Try adjtime
-
This looks fun and will play with it - but am heading advice of answer above that warns of all the things I'll screw up if I mess with the click. Still if I use an new Amazon instance for each test that wouldn't matter.... Thanks for finding this. Nov 26, 2009 at 10:18
-
adjtime
is not that helpful in your case, because it applies its changes over a long period of time. It's more suited to sync'ing the system clock to an external time source. Oct 3, 2013 at 22:55