473,662 Members | 2,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bug In System.TimeSpan Object?

Is it possible there is a bug with the System.TimeSpan object in .NET?
I am using it to track times and am seeing an unusual situation.

From what I understand, there are 1000 milliseconds in a second. I
have a test I ran using the TimeSpan object which when I use
TimeSpan.Millis econds I got 658 but if I use TimeSpan.Second s I get 5.

If it took 658 milliseconds that should be less than 1 second right?
658 milliseconds should not convert to 5 seconds should it?
Jul 21 '05 #1
1 1827
"Doug" <dn******@dtgne t.com> wrote in message
news:ff******** *************** ***@posting.goo gle.com...
Is it possible there is a bug with the System.TimeSpan object in .NET?
I am using it to track times and am seeing an unusual situation.

From what I understand, there are 1000 milliseconds in a second. I
have a test I ran using the TimeSpan object which when I use
TimeSpan.Millis econds I got 658 but if I use TimeSpan.Second s I get 5.

If it took 658 milliseconds that should be less than 1 second right?
658 milliseconds should not convert to 5 seconds should it?


You are confusing TimeSpan.Millis econds and TimeSpan.TotalM illiseconds. If
your time span was 5.658 seconds long, then:

TimeSpan.Second s = 5
TimeSpan.Millis econds = 658
TimeSpan.TotalM illiseconds = 5658

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
523
by: violin wang | last post by:
hi When I set up a timer in my program, I used public Timer(TimerCallback, object, TimeSpan, TimeSpan) constructor. I want the timer to fire after a mount of time, so I wrote "new Timer(new TimeCallback (some_function), null, timeDiff, new TimeSpan)".When I ran the program, VS.NET popped a MsgBox that told me the timer interval must be less than 2^32-2.Actually, the argument "timeDiff" could be very large(maybe 2 or 3 years).How can I...
2
7894
by: Justin Grieves | last post by:
Hello all, I've been trying to determine the difference in minutes between two DateTime objects (startTime and endTime) in C# using the TimeSpan object (ts). I am populating the two DateTime objects from the click of two buttons (start and stop) that I have placed on an ASP.NET webform. I have attempted to follow the many examples that are available on the web yet I'm finding that instead of returning the difference in minutes, my code is...
3
13545
by: Ivan A. | last post by:
Hi! Why I can't serialize TimeSpan structure with XmlSerializer? This is what I do: using System; using System.IO; using System.Xml; using System.Xml.Serialization;
5
6578
by: Deiussum | last post by:
I'm running into an issue where I have a timer that appears to be timing out immediately, when it shouldn't be timing out for about int.MaxValue milliseconds. I have written a small app that isolates the problem and was wondering if anyone had any ideas on what I am doing wrong, or if there is some known bug, or I am exceeding some known maximum (which I can't seen to find in documentation anywhere...) Anyway, the following code used to...
4
4481
by: DWW | last post by:
System.DateTime returns a string with the date and time. I want to convert the time to an integer, for example, convert 10:24:45 to 102445. Much research has turned up a myriad of variations on formatting using Parse and DateTimeFormatInfo, but nothing that returns the time as an integer. Any ideas? Thanks. DW
2
19101
by: DWalker | last post by:
In Visual Studio (Visual Basic) .NET 2002, I noticed that this: Dim Elapsed as DateTime = Now - Now gives a "compile time" error (error in the IDE), saying that the '-' operator is not defined for the Date datatype. On the other hand, Dim Elapsed as DateTime = Now + Now does not give a compile time error but it thinks you're trying to
1
350
by: Doug | last post by:
Is it possible there is a bug with the System.TimeSpan object in .NET? I am using it to track times and am seeing an unusual situation. From what I understand, there are 1000 milliseconds in a second. I have a test I ran using the TimeSpan object which when I use TimeSpan.Milliseconds I got 658 but if I use TimeSpan.Seconds I get 5. If it took 658 milliseconds that should be less than 1 second right? 658 milliseconds should not...
3
2881
by: Rob Meade | last post by:
Hi all, I'm having a bit of trouble with the following function.... Private Function GetSystemUpTime() As TimeSpan ' declare variables Dim Result As TimeSpan Dim PerformanceCounter As PerformanceCounter
5
4967
by: Brian | last post by:
Hello all. I have a simple application that I was using to test and understand the System.Timers.Timer and noticed that when I stop the application, on occasion, it throughs the following exception. An exception of type 'System.ObjectDisposedException' occurred in System.Windows.Forms.dll but was not handled in user code Additional information: Cannot access a disposed object.
0
8435
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7368
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1754
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.