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?

  • Which server OS are we talking about here? – RainyRat Nov 25 '09 at 20:36
  • 1
    Linux - current server is Ubuntu Hardy – user19196 Nov 25 '09 at 21:13

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. – user19196 Nov 25 '09 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. – lorenzog Nov 25 '09 at 22:08
  • It does seem possible to tweek the clock - see adjtime - but maybe not advisable! – user19196 Nov 26 '09 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. – user19196 Nov 26 '09 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. – slowpoison Oct 3 '13 at 22:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.