I've a small web app which displays time in different time zones. Time calculation seems to be correct. I use the timer
control to generate postback.
<asp:Timer ID="Timer1" runat="server" Interval="60000" OnTick="Refresh_Time">
</asp:Timer>
Question:
The problem is the page refresh is not synchronized with the server clock. For example, if I've started the app at 9.55.30 AM
, the next postback is at 9.56.30 AM
So, right now, I've to watch the server clock and start the app at the when it is 0 seconds. Something like 9.57.00 AM
. Obviously, it is never 100% accurate.
Ideally, what I'm looking for is, no matter when I run the app 9.55.15 AM
or 9.55.45 AM
, the next postback should happen at 9.56.00 AM
. Any help is appreciated.
EDIT
The code that solve the problem
protected void Page_Load(object sender, EventArgs e)
{
Timer1.Interval = 1000*(60 - DateTime.Now.Second);
}