mscorlib(4.0.0.0) API with additions
TimeSpan.cs
4 using System.Security;
5 
6 namespace System
7 {
10  [ComVisible(true)]
11  [__DynamicallyInvokable]
12  public struct TimeSpan : IComparable, IComparable<TimeSpan>, IEquatable<TimeSpan>, IFormattable
13  {
15  [__DynamicallyInvokable]
16  public const long TicksPerMillisecond = 10000L;
17 
18  private const double MillisecondsPerTick = 0.0001;
19 
21  [__DynamicallyInvokable]
22  public const long TicksPerSecond = 10000000L;
23 
24  private const double SecondsPerTick = 1E-07;
25 
27  [__DynamicallyInvokable]
28  public const long TicksPerMinute = 600000000L;
29 
30  private const double MinutesPerTick = 1.6666666666666667E-09;
31 
33  [__DynamicallyInvokable]
34  public const long TicksPerHour = 36000000000L;
35 
36  private const double HoursPerTick = 2.7777777777777777E-11;
37 
39  [__DynamicallyInvokable]
40  public const long TicksPerDay = 864000000000L;
41 
42  private const double DaysPerTick = 1.1574074074074074E-12;
43 
44  private const int MillisPerSecond = 1000;
45 
46  private const int MillisPerMinute = 60000;
47 
48  private const int MillisPerHour = 3600000;
49 
50  private const int MillisPerDay = 86400000;
51 
52  internal const long MaxSeconds = 922337203685L;
53 
54  internal const long MinSeconds = -922337203685L;
55 
56  internal const long MaxMilliSeconds = 922337203685477L;
57 
58  internal const long MinMilliSeconds = -922337203685477L;
59 
60  internal const long TicksPerTenthSecond = 1000000L;
61 
63  [__DynamicallyInvokable]
64  public static readonly TimeSpan Zero = new TimeSpan(0L);
65 
67  [__DynamicallyInvokable]
68  public static readonly TimeSpan MaxValue = new TimeSpan(long.MaxValue);
69 
71  [__DynamicallyInvokable]
72  public static readonly TimeSpan MinValue = new TimeSpan(long.MinValue);
73 
74  internal long _ticks;
75 
76  private static volatile bool _legacyConfigChecked;
77 
78  private static volatile bool _legacyMode;
79 
82  [__DynamicallyInvokable]
83  public long Ticks
84  {
85  [__DynamicallyInvokable]
86  get
87  {
88  return _ticks;
89  }
90  }
91 
94  [__DynamicallyInvokable]
95  public int Days
96  {
97  [__DynamicallyInvokable]
98  get
99  {
100  return (int)(_ticks / 864000000000L);
101  }
102  }
103 
106  [__DynamicallyInvokable]
107  public int Hours
108  {
109  [__DynamicallyInvokable]
110  get
111  {
112  return (int)(_ticks / 36000000000L % 24);
113  }
114  }
115 
118  [__DynamicallyInvokable]
119  public int Milliseconds
120  {
121  [__DynamicallyInvokable]
122  get
123  {
124  return (int)(_ticks / 10000 % 1000);
125  }
126  }
127 
130  [__DynamicallyInvokable]
131  public int Minutes
132  {
133  [__DynamicallyInvokable]
134  get
135  {
136  return (int)(_ticks / 600000000 % 60);
137  }
138  }
139 
142  [__DynamicallyInvokable]
143  public int Seconds
144  {
145  [__DynamicallyInvokable]
146  get
147  {
148  return (int)(_ticks / 10000000 % 60);
149  }
150  }
151 
154  [__DynamicallyInvokable]
155  public double TotalDays
156  {
157  [__DynamicallyInvokable]
158  get
159  {
160  return (double)_ticks * 1.1574074074074074E-12;
161  }
162  }
163 
166  [__DynamicallyInvokable]
167  public double TotalHours
168  {
169  [__DynamicallyInvokable]
170  get
171  {
172  return (double)_ticks * 2.7777777777777777E-11;
173  }
174  }
175 
178  [__DynamicallyInvokable]
179  public double TotalMilliseconds
180  {
181  [__DynamicallyInvokable]
182  get
183  {
184  double num = (double)_ticks * 0.0001;
185  if (num > 922337203685477.0)
186  {
187  return 922337203685477.0;
188  }
189  if (num < -922337203685477.0)
190  {
191  return -922337203685477.0;
192  }
193  return num;
194  }
195  }
196 
199  [__DynamicallyInvokable]
200  public double TotalMinutes
201  {
202  [__DynamicallyInvokable]
203  get
204  {
205  return (double)_ticks * 1.6666666666666667E-09;
206  }
207  }
208 
211  [__DynamicallyInvokable]
212  public double TotalSeconds
213  {
214  [__DynamicallyInvokable]
215  get
216  {
217  return (double)_ticks * 1E-07;
218  }
219  }
220 
221  private static bool LegacyMode
222  {
223  get
224  {
225  if (!_legacyConfigChecked)
226  {
227  _legacyMode = GetLegacyFormatMode();
228  _legacyConfigChecked = true;
229  }
230  return _legacyMode;
231  }
232  }
233 
236  [__DynamicallyInvokable]
237  public TimeSpan(long ticks)
238  {
239  _ticks = ticks;
240  }
241 
247  [__DynamicallyInvokable]
248  public TimeSpan(int hours, int minutes, int seconds)
249  {
250  _ticks = TimeToTicks(hours, minutes, seconds);
251  }
252 
259  [__DynamicallyInvokable]
260  public TimeSpan(int days, int hours, int minutes, int seconds)
261  {
262  this = new TimeSpan(days, hours, minutes, seconds, 0);
263  }
264 
272  [__DynamicallyInvokable]
273  public TimeSpan(int days, int hours, int minutes, int seconds, int milliseconds)
274  {
275  long num = ((long)days * 3600L * 24 + (long)hours * 3600L + (long)minutes * 60L + seconds) * 1000 + milliseconds;
276  if (num > 922337203685477L || num < -922337203685477L)
277  {
278  throw new ArgumentOutOfRangeException(null, Environment.GetResourceString("Overflow_TimeSpanTooLong"));
279  }
280  _ticks = num * 10000;
281  }
282 
288  [__DynamicallyInvokable]
289  public TimeSpan Add(TimeSpan ts)
290  {
291  long num = _ticks + ts._ticks;
292  if (_ticks >> 63 == ts._ticks >> 63 && _ticks >> 63 != num >> 63)
293  {
294  throw new OverflowException(Environment.GetResourceString("Overflow_TimeSpanTooLong"));
295  }
296  return new TimeSpan(num);
297  }
298 
306  [__DynamicallyInvokable]
307  public static int Compare(TimeSpan t1, TimeSpan t2)
308  {
309  if (t1._ticks > t2._ticks)
310  {
311  return 1;
312  }
313  if (t1._ticks < t2._ticks)
314  {
315  return -1;
316  }
317  return 0;
318  }
319 
326  public int CompareTo(object value)
327  {
328  if (value == null)
329  {
330  return 1;
331  }
332  if (!(value is TimeSpan))
333  {
334  throw new ArgumentException(Environment.GetResourceString("Arg_MustBeTimeSpan"));
335  }
336  long ticks = ((TimeSpan)value)._ticks;
337  if (_ticks > ticks)
338  {
339  return 1;
340  }
341  if (_ticks < ticks)
342  {
343  return -1;
344  }
345  return 0;
346  }
347 
351  [__DynamicallyInvokable]
352  public int CompareTo(TimeSpan value)
353  {
354  long ticks = value._ticks;
355  if (_ticks > ticks)
356  {
357  return 1;
358  }
359  if (_ticks < ticks)
360  {
361  return -1;
362  }
363  return 0;
364  }
365 
375  [__DynamicallyInvokable]
376  public static TimeSpan FromDays(double value)
377  {
378  return Interval(value, 86400000);
379  }
380 
384  [__DynamicallyInvokable]
386  {
387  if (Ticks == MinValue.Ticks)
388  {
389  throw new OverflowException(Environment.GetResourceString("Overflow_Duration"));
390  }
391  return new TimeSpan((_ticks >= 0) ? _ticks : (-_ticks));
392  }
393 
398  [__DynamicallyInvokable]
399  public override bool Equals(object value)
400  {
401  if (value is TimeSpan)
402  {
403  return _ticks == ((TimeSpan)value)._ticks;
404  }
405  return false;
406  }
407 
412  [__DynamicallyInvokable]
413  public bool Equals(TimeSpan obj)
414  {
415  return _ticks == obj._ticks;
416  }
417 
423  [__DynamicallyInvokable]
424  public static bool Equals(TimeSpan t1, TimeSpan t2)
425  {
426  return t1._ticks == t2._ticks;
427  }
428 
431  [__DynamicallyInvokable]
432  public override int GetHashCode()
433  {
434  return (int)_ticks ^ (int)(_ticks >> 32);
435  }
436 
446  [__DynamicallyInvokable]
447  public static TimeSpan FromHours(double value)
448  {
449  return Interval(value, 3600000);
450  }
451 
452  private static TimeSpan Interval(double value, int scale)
453  {
454  if (double.IsNaN(value))
455  {
456  throw new ArgumentException(Environment.GetResourceString("Arg_CannotBeNaN"));
457  }
458  double num = value * (double)scale;
459  double num2 = num + ((value >= 0.0) ? 0.5 : (-0.5));
460  if (num2 > 922337203685477.0 || num2 < -922337203685477.0)
461  {
462  throw new OverflowException(Environment.GetResourceString("Overflow_TimeSpanTooLong"));
463  }
464  return new TimeSpan((long)num2 * 10000);
465  }
466 
476  [__DynamicallyInvokable]
477  public static TimeSpan FromMilliseconds(double value)
478  {
479  return Interval(value, 1);
480  }
481 
491  [__DynamicallyInvokable]
492  public static TimeSpan FromMinutes(double value)
493  {
494  return Interval(value, 60000);
495  }
496 
500  [__DynamicallyInvokable]
501  public TimeSpan Negate()
502  {
503  if (Ticks == MinValue.Ticks)
504  {
505  throw new OverflowException(Environment.GetResourceString("Overflow_NegateTwosCompNum"));
506  }
507  return new TimeSpan(-_ticks);
508  }
509 
519  [__DynamicallyInvokable]
520  public static TimeSpan FromSeconds(double value)
521  {
522  return Interval(value, 1000);
523  }
524 
530  [__DynamicallyInvokable]
532  {
533  long num = _ticks - ts._ticks;
534  if (_ticks >> 63 != ts._ticks >> 63 && _ticks >> 63 != num >> 63)
535  {
536  throw new OverflowException(Environment.GetResourceString("Overflow_TimeSpanTooLong"));
537  }
538  return new TimeSpan(num);
539  }
540 
544  [__DynamicallyInvokable]
545  public static TimeSpan FromTicks(long value)
546  {
547  return new TimeSpan(value);
548  }
549 
550  internal static long TimeToTicks(int hour, int minute, int second)
551  {
552  long num = (long)hour * 3600L + (long)minute * 60L + second;
553  if (num > 922337203685L || num < -922337203685L)
554  {
555  throw new ArgumentOutOfRangeException(null, Environment.GetResourceString("Overflow_TimeSpanTooLong"));
556  }
557  return num * 10000000;
558  }
559 
569  [__DynamicallyInvokable]
570  public static TimeSpan Parse(string s)
571  {
572  return TimeSpanParse.Parse(s, null);
573  }
574 
585  [__DynamicallyInvokable]
586  public static TimeSpan Parse(string input, IFormatProvider formatProvider)
587  {
588  return TimeSpanParse.Parse(input, formatProvider);
589  }
590 
602  [__DynamicallyInvokable]
603  public static TimeSpan ParseExact(string input, string format, IFormatProvider formatProvider)
604  {
605  return TimeSpanParse.ParseExact(input, format, formatProvider, TimeSpanStyles.None);
606  }
607 
619  [__DynamicallyInvokable]
620  public static TimeSpan ParseExact(string input, string[] formats, IFormatProvider formatProvider)
621  {
622  return TimeSpanParse.ParseExactMultiple(input, formats, formatProvider, TimeSpanStyles.None);
623  }
624 
639  [__DynamicallyInvokable]
640  public static TimeSpan ParseExact(string input, string format, IFormatProvider formatProvider, TimeSpanStyles styles)
641  {
642  TimeSpanParse.ValidateStyles(styles, "styles");
643  return TimeSpanParse.ParseExact(input, format, formatProvider, styles);
644  }
645 
660  [__DynamicallyInvokable]
661  public static TimeSpan ParseExact(string input, string[] formats, IFormatProvider formatProvider, TimeSpanStyles styles)
662  {
663  TimeSpanParse.ValidateStyles(styles, "styles");
664  return TimeSpanParse.ParseExactMultiple(input, formats, formatProvider, styles);
665  }
666 
672  [__DynamicallyInvokable]
673  public static bool TryParse(string s, out TimeSpan result)
674  {
675  return TimeSpanParse.TryParse(s, null, out result);
676  }
677 
684  [__DynamicallyInvokable]
685  public static bool TryParse(string input, IFormatProvider formatProvider, out TimeSpan result)
686  {
687  return TimeSpanParse.TryParse(input, formatProvider, out result);
688  }
689 
697  [__DynamicallyInvokable]
698  public static bool TryParseExact(string input, string format, IFormatProvider formatProvider, out TimeSpan result)
699  {
700  return TimeSpanParse.TryParseExact(input, format, formatProvider, TimeSpanStyles.None, out result);
701  }
702 
710  [__DynamicallyInvokable]
711  public static bool TryParseExact(string input, string[] formats, IFormatProvider formatProvider, out TimeSpan result)
712  {
713  return TimeSpanParse.TryParseExactMultiple(input, formats, formatProvider, TimeSpanStyles.None, out result);
714  }
715 
724  [__DynamicallyInvokable]
725  public static bool TryParseExact(string input, string format, IFormatProvider formatProvider, TimeSpanStyles styles, out TimeSpan result)
726  {
727  TimeSpanParse.ValidateStyles(styles, "styles");
728  return TimeSpanParse.TryParseExact(input, format, formatProvider, styles, out result);
729  }
730 
739  [__DynamicallyInvokable]
740  public static bool TryParseExact(string input, string[] formats, IFormatProvider formatProvider, TimeSpanStyles styles, out TimeSpan result)
741  {
742  TimeSpanParse.ValidateStyles(styles, "styles");
743  return TimeSpanParse.TryParseExactMultiple(input, formats, formatProvider, styles, out result);
744  }
745 
748  [__DynamicallyInvokable]
749  public override string ToString()
750  {
751  return TimeSpanFormat.Format(this, null, null);
752  }
753 
758  [__DynamicallyInvokable]
759  public string ToString(string format)
760  {
761  return TimeSpanFormat.Format(this, format, null);
762  }
763 
769  [__DynamicallyInvokable]
770  public string ToString(string format, IFormatProvider formatProvider)
771  {
772  if (LegacyMode)
773  {
774  return TimeSpanFormat.Format(this, null, null);
775  }
776  return TimeSpanFormat.Format(this, format, formatProvider);
777  }
778 
783  [__DynamicallyInvokable]
784  public static TimeSpan operator -(TimeSpan t)
785  {
786  if (t._ticks == MinValue._ticks)
787  {
788  throw new OverflowException(Environment.GetResourceString("Overflow_NegateTwosCompNum"));
789  }
790  return new TimeSpan(-t._ticks);
791  }
792 
798  [__DynamicallyInvokable]
799  public static TimeSpan operator -(TimeSpan t1, TimeSpan t2)
800  {
801  return t1.Subtract(t2);
802  }
803 
807  [__DynamicallyInvokable]
808  public static TimeSpan operator +(TimeSpan t)
809  {
810  return t;
811  }
812 
818  [__DynamicallyInvokable]
819  public static TimeSpan operator +(TimeSpan t1, TimeSpan t2)
820  {
821  return t1.Add(t2);
822  }
823 
829  [__DynamicallyInvokable]
830  public static bool operator ==(TimeSpan t1, TimeSpan t2)
831  {
832  return t1._ticks == t2._ticks;
833  }
834 
840  [__DynamicallyInvokable]
841  public static bool operator !=(TimeSpan t1, TimeSpan t2)
842  {
843  return t1._ticks != t2._ticks;
844  }
845 
851  [__DynamicallyInvokable]
852  public static bool operator <(TimeSpan t1, TimeSpan t2)
853  {
854  return t1._ticks < t2._ticks;
855  }
856 
862  [__DynamicallyInvokable]
863  public static bool operator <=(TimeSpan t1, TimeSpan t2)
864  {
865  return t1._ticks <= t2._ticks;
866  }
867 
873  [__DynamicallyInvokable]
874  public static bool operator >(TimeSpan t1, TimeSpan t2)
875  {
876  return t1._ticks > t2._ticks;
877  }
878 
884  [__DynamicallyInvokable]
885  public static bool operator >=(TimeSpan t1, TimeSpan t2)
886  {
887  return t1._ticks >= t2._ticks;
888  }
889 
890  [MethodImpl(MethodImplOptions.InternalCall)]
891  [SecurityCritical]
892  private static extern bool LegacyFormatMode();
893 
894  [SecuritySafeCritical]
895  private static bool GetLegacyFormatMode()
896  {
897  if (LegacyFormatMode())
898  {
899  return true;
900  }
901  return CompatibilitySwitches.IsNetFx40TimeSpanLegacyFormatMode;
902  }
903  }
904 }
static TimeSpan FromDays(double value)
Returns a T:System.TimeSpan that represents a specified number of days, where the specification is ac...
Definition: TimeSpan.cs:376
int Days
Gets the days component of the time interval represented by the current T:System.TimeSpan structure.
Definition: TimeSpan.cs:96
int Milliseconds
Gets the milliseconds component of the time interval represented by the current T:System....
Definition: TimeSpan.cs:120
static TimeSpan ParseExact(string input, string format, IFormatProvider formatProvider, TimeSpanStyles styles)
Converts the string representation of a time interval to its T:System.TimeSpan equivalent by using th...
Definition: TimeSpan.cs:640
static bool TryParseExact(string input, string[] formats, IFormatProvider formatProvider, out TimeSpan result)
Converts the specified string representation of a time interval to its T:System.TimeSpan equivalent b...
Definition: TimeSpan.cs:711
TimeSpan(long ticks)
Initializes a new instance of the T:System.TimeSpan structure to the specified number of ticks.
Definition: TimeSpan.cs:237
static TimeSpan Parse(string input, IFormatProvider formatProvider)
Converts the string representation of a time interval to its T:System.TimeSpan equivalent by using th...
Definition: TimeSpan.cs:586
static bool Equals(TimeSpan t1, TimeSpan t2)
Returns a value that indicates whether two specified instances of T:System.TimeSpan are equal.
Definition: TimeSpan.cs:424
bool Equals(TimeSpan obj)
Returns a value indicating whether this instance is equal to a specified T:System....
Definition: TimeSpan.cs:413
Definition: __Canon.cs:3
The exception that is thrown when the value of an argument is outside the allowable range of values a...
const long TicksPerDay
Represents the number of ticks in 1 day. This field is constant.
Definition: TimeSpan.cs:40
static bool operator >=(TimeSpan t1, TimeSpan t2)
Indicates whether a specified T:System.TimeSpan is greater than or equal to another specified T:Syste...
Definition: TimeSpan.cs:885
static bool TryParseExact(string input, string format, IFormatProvider formatProvider, out TimeSpan result)
Converts the string representation of a time interval to its T:System.TimeSpan equivalent by using th...
Definition: TimeSpan.cs:698
override int GetHashCode()
Returns a hash code for this instance.
Definition: TimeSpan.cs:432
double TotalMilliseconds
Gets the value of the current T:System.TimeSpan structure expressed in whole and fractional milliseco...
Definition: TimeSpan.cs:180
static TimeSpan FromSeconds(double value)
Returns a T:System.TimeSpan that represents a specified number of seconds, where the specification is...
Definition: TimeSpan.cs:520
Provides a mechanism for retrieving an object to control formatting.
TimeSpanStyles
Defines the formatting options that customize string parsing for the Overload:System....
double TotalMinutes
Gets the value of the current T:System.TimeSpan structure expressed in whole and fractional minutes.
Definition: TimeSpan.cs:201
static TimeSpan FromMilliseconds(double value)
Returns a T:System.TimeSpan that represents a specified number of milliseconds.
Definition: TimeSpan.cs:477
override bool Equals(object value)
Returns a value indicating whether this instance is equal to a specified object.
Definition: TimeSpan.cs:399
int Hours
Gets the hours component of the time interval represented by the current T:System....
Definition: TimeSpan.cs:108
static bool TryParse(string input, IFormatProvider formatProvider, out TimeSpan result)
Converts the string representation of a time interval to its T:System.TimeSpan equivalent by using th...
Definition: TimeSpan.cs:685
static bool operator<=(TimeSpan t1, TimeSpan t2)
Indicates whether a specified T:System.TimeSpan is less than or equal to another specified T:System....
Definition: TimeSpan.cs:863
Defines a generalized type-specific comparison method that a value type or class implements to order ...
Definition: IComparable.cs:8
static TimeSpan FromMinutes(double value)
Returns a T:System.TimeSpan that represents a specified number of minutes, where the specification is...
Definition: TimeSpan.cs:492
The exception that is thrown when an arithmetic, casting, or conversion operation in a checked contex...
static int Compare(TimeSpan t1, TimeSpan t2)
Compares two T:System.TimeSpan values and returns an integer that indicates whether the first value i...
Definition: TimeSpan.cs:307
long Ticks
Gets the number of ticks that represent the value of the current T:System.TimeSpan structure.
Definition: TimeSpan.cs:84
static TimeSpan ParseExact(string input, string[] formats, IFormatProvider formatProvider, TimeSpanStyles styles)
Converts the string representation of a time interval to its T:System.TimeSpan equivalent by using th...
Definition: TimeSpan.cs:661
int CompareTo(object value)
Compares this instance to a specified object and returns an integer that indicates whether this insta...
Definition: TimeSpan.cs:326
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
const long TicksPerSecond
Represents the number of ticks in 1 second.
Definition: TimeSpan.cs:22
static TimeSpan FromTicks(long value)
Returns a T:System.TimeSpan that represents a specified time, where the specification is in units of ...
Definition: TimeSpan.cs:545
TimeSpan(int days, int hours, int minutes, int seconds)
Initializes a new instance of the T:System.TimeSpan structure to a specified number of days,...
Definition: TimeSpan.cs:260
double TotalSeconds
Gets the value of the current T:System.TimeSpan structure expressed in whole and fractional seconds.
Definition: TimeSpan.cs:213
int CompareTo(TimeSpan value)
Compares this instance to a specified T:System.TimeSpan object and returns an integer that indicates ...
Definition: TimeSpan.cs:352
static bool TryParse(string s, out TimeSpan result)
Converts the string representation of a time interval to its T:System.TimeSpan equivalent and returns...
Definition: TimeSpan.cs:673
int Minutes
Gets the minutes component of the time interval represented by the current T:System....
Definition: TimeSpan.cs:132
static TimeSpan operator -(TimeSpan t)
Returns a T:System.TimeSpan whose value is the negated value of the specified instance.
Definition: TimeSpan.cs:784
static bool operator==(TimeSpan t1, TimeSpan t2)
Indicates whether two T:System.TimeSpan instances are equal.
Definition: TimeSpan.cs:830
TimeSpan Duration()
Returns a new T:System.TimeSpan object whose value is the absolute value of the current T:System....
Definition: TimeSpan.cs:385
static TimeSpan operator+(TimeSpan t)
Returns the specified instance of T:System.TimeSpan.
Definition: TimeSpan.cs:808
static readonly TimeSpan Zero
Represents the zero T:System.TimeSpan value. This field is read-only.
Definition: TimeSpan.cs:64
MethodImplOptions
Defines the details of how a method is implemented.
TimeSpan Negate()
Returns a new T:System.TimeSpan object whose value is the negated value of this instance.
Definition: TimeSpan.cs:501
static TimeSpan FromHours(double value)
Returns a T:System.TimeSpan that represents a specified number of hours, where the specification is a...
Definition: TimeSpan.cs:447
static bool TryParseExact(string input, string[] formats, IFormatProvider formatProvider, TimeSpanStyles styles, out TimeSpan result)
Converts the specified string representation of a time interval to its T:System.TimeSpan equivalent b...
Definition: TimeSpan.cs:740
static readonly TimeSpan MaxValue
Represents the maximum T:System.TimeSpan value. This field is read-only.
Definition: TimeSpan.cs:68
static bool operator >(TimeSpan t1, TimeSpan t2)
Indicates whether a specified T:System.TimeSpan is greater than another specified T:System....
Definition: TimeSpan.cs:874
The exception that is thrown when one of the arguments provided to a method is not valid.
static TimeSpan ParseExact(string input, string format, IFormatProvider formatProvider)
Converts the string representation of a time interval to its T:System.TimeSpan equivalent by using th...
Definition: TimeSpan.cs:603
override string ToString()
Converts the value of the current T:System.TimeSpan object to its equivalent string representation.
Definition: TimeSpan.cs:749
static readonly TimeSpan MinValue
Represents the minimum T:System.TimeSpan value. This field is read-only.
Definition: TimeSpan.cs:72
static TimeSpan Parse(string s)
Converts the string representation of a time interval to its T:System.TimeSpan equivalent.
Definition: TimeSpan.cs:570
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition: IEquatable.cs:6
string ToString(string format, IFormatProvider formatProvider)
Converts the value of the current T:System.TimeSpan object to its equivalent string representation by...
Definition: TimeSpan.cs:770
static bool operator !=(TimeSpan t1, TimeSpan t2)
Indicates whether two T:System.TimeSpan instances are not equal.
Definition: TimeSpan.cs:841
Represents a time interval.To browse the .NET Framework source code for this type,...
Definition: TimeSpan.cs:12
static bool operator<(TimeSpan t1, TimeSpan t2)
Indicates whether a specified T:System.TimeSpan is less than another specified T:System....
Definition: TimeSpan.cs:852
TimeSpan(int hours, int minutes, int seconds)
Initializes a new instance of the T:System.TimeSpan structure to a specified number of hours,...
Definition: TimeSpan.cs:248
Specifies that the class can be serialized.
static bool TryParseExact(string input, string format, IFormatProvider formatProvider, TimeSpanStyles styles, out TimeSpan result)
Converts the string representation of a time interval to its T:System.TimeSpan equivalent by using th...
Definition: TimeSpan.cs:725
const long TicksPerMillisecond
Represents the number of ticks in 1 millisecond. This field is constant.
Definition: TimeSpan.cs:16
string ToString(string format)
Converts the value of the current T:System.TimeSpan object to its equivalent string representation by...
Definition: TimeSpan.cs:759
static TimeSpan ParseExact(string input, string[] formats, IFormatProvider formatProvider)
Converts the string representation of a time interval to its T:System.TimeSpan equivalent by using th...
Definition: TimeSpan.cs:620
TimeSpan(int days, int hours, int minutes, int seconds, int milliseconds)
Initializes a new instance of the T:System.TimeSpan structure to a specified number of days,...
Definition: TimeSpan.cs:273
int Seconds
Gets the seconds component of the time interval represented by the current T:System....
Definition: TimeSpan.cs:144
double TotalHours
Gets the value of the current T:System.TimeSpan structure expressed in whole and fractional hours.
Definition: TimeSpan.cs:168
static TimeSpan operator -(TimeSpan t1, TimeSpan t2)
Subtracts a specified T:System.TimeSpan from another specified T:System.TimeSpan.
Definition: TimeSpan.cs:799
Provides functionality to format the value of an object into a string representation.
Definition: IFormattable.cs:8
TimeSpan Add(TimeSpan ts)
Returns a new T:System.TimeSpan object whose value is the sum of the specified T:System....
Definition: TimeSpan.cs:289
const long TicksPerMinute
Represents the number of ticks in 1 minute. This field is constant.
Definition: TimeSpan.cs:28
TimeSpan Subtract(TimeSpan ts)
Returns a new T:System.TimeSpan object whose value is the difference between the specified T:System....
Definition: TimeSpan.cs:531
const long TicksPerHour
Represents the number of ticks in 1 hour. This field is constant.
Definition: TimeSpan.cs:34
double TotalDays
Gets the value of the current T:System.TimeSpan structure expressed in whole and fractional days.
Definition: TimeSpan.cs:156