Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 19th, 2005, 09:59 AM
Registered User
 
Join Date: Dec 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default TimeSpan.FromMinutes Gaining Time

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

 
Old December 19th, 2005, 11:06 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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
 
Old December 19th, 2005, 11:48 AM
Registered User
 
Join Date: Dec 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.






Similar Threads
Thread Thread Starter Forum Replies Last Post
synchronizing pocket pc time with desktop time bobbyrayudu83 C# 1 April 2nd, 2011 04:28 AM
Time Shift time in minus time out lechalas Beginning VB 6 1 August 11th, 2008 01:56 PM
time zone & day light time rajn ASP.NET 1.0 and 1.1 Professional 0 August 7th, 2007 05:02 PM
Using xs:time to generate time in desired format krayan001 XSLT 0 June 27th, 2005 04:28 PM
timespan operations marclena General .NET 1 February 25th, 2005 07:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.