Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How long is a .NET DateTime/TimeSpan tick?

How long is a .NET DateTime/TimeSpan tick?

like image 721
Jason Kresowaty Avatar asked Jun 05 '09 15:06

Jason Kresowaty


People also ask

How long is a tick in TimeSpan?

The smallest unit of time is the tick, which is equal to 100 nanoseconds or one ten-millionth of a second. There are 10,000 ticks in a millisecond. The value of the Ticks property can be negative or positive to represent a negative or positive time interval.

What is DateTime now Ticks in C#?

What is Ticks. Ticks represents the number of 100-nanosecond intervals that have elapsed since 12:00:00 midnight, January 1, 0001, which represents DateTime. MinValue. A single tick represents one hundred nanoseconds or one ten-millionth of a second.

What is TimeSpan type in C#?

C# TimeSpan struct represents a time interval that is difference between two times measured in number of days, hours, minutes, and seconds. C# TimeSpan is used to compare two C# DateTime objects to find the difference between two dates.

What is the default value for TimeSpan in C#?

The default value is TimeSpan(30, 23, 59, 59) .


2 Answers

Although currently a tick is 100 nanoseconds, it is best not to rely on this as an absolute. Rather, use 'TimeSpan.TicksPerSecond' (or any of the other TicksPerXxx member values)

like image 112
jerryjvl Avatar answered Oct 20 '22 02:10

jerryjvl


The tick is the unit of granularity for the .NET DateTime and TimeSpan value types.

It has the following common conversions:

1 tick = 100 nanoseconds        = 0.1 microseconds        = 0.0001 milliseconds        = 0.0000001 seconds 
like image 24
Jason Kresowaty Avatar answered Oct 20 '22 02:10

Jason Kresowaty