|
Subject:
|
TimeSpan.FromMinutes Gaining Time
|
|
Posted By:
|
rengaw
|
Post Date:
|
12/19/2005 8:59:31 AM
|
Hello, I am new to C# and found an interesting project on CodeProject which simulates a windows service(http://www.codeproject.com/aspnet/ASPNETService.asp).
Situation: This code writes a key to the cache which expires in (n) minutes. The code will call a function which executes the work then calls a web page which in turn calls the function to write a new key to the cache.
Problem: The issue is each time the key is expired and rewritten, the timespan is gaining seconds. If we fire off the code at :00 and our interval is 15 minutes, then for the first 5 - 6 rewrites the timespan will remain at h:nn:00. After the 6th time the time interval will begin gaining seconds. So after an extended amount of time the timespan will eventually become 16 mintues and so on.
Has anyone come across this type of problem before? Anyone have any suggestions as to how to correct this issue?
Thanks in advance.
Jeff
|
|
Reply By:
|
planoie
|
Reply Date:
|
12/19/2005 10:06:27 AM
|
Assuming that the processes you are executing take some measurable time to execute, you'll end up with more than an exact 15 minutes between execution starts. However, I can't imagine why any time would accumulate.
-Peter
|
|
Reply By:
|
rengaw
|
Reply Date:
|
12/19/2005 10:48:47 AM
|
Peter,
Thanks for the quick reply. I failed to mention that the step in which the work is done is in a thread. It is a fire and forget thread.
The problem isnt that it is executing 1 - 2 seconds later, its that the code will get executed 16 minutes later. This time period will continue to grow if you dont hit the webform1.aspx from the project.
Thanks again.
|