ID:272074
 
Well, I'm trying to coordinate certain events with real times. Specifically:
1) A train that departs on a schedule, (specifically every 15 minutes)

2) Changing something at midnight every day.


For 2, I have it mostly planned out, all I really need to figure out is how to calculate the time until midnight CST, and theres the problem.

When I use time2text proc, it seems to automatically convert the world.timeofday to CST. But when I try to calucate the time until a certain time, it's calculating in GMT.
Plus, if this game is hosted by someone in a diferent timezone, how will this be affected?

Sorry, I'm being a little vague here, I'm just a little confused. I could probably get something working, but I want a way that works everytime.
For #1, you'd probably just set up a loop that iterates once every 15 minutes. You can check world.timeofday in world/New() to initialize all these loops to ensure they happen on the quarter-hour, if you are really concerned with that. Game lag might result in ticks lasting longer than 1/10th of a second, which you can loosely solve by calculating the time until the next quarter-hour and sleeping until then (instead of sleeping for 10*60*15 every time).

For #2, just use world.timeofday again. It will be 0 at midnight GMT. Add 10*60*60 for each hour off of GMT that you are.