Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
TimeSpan.cs
Go to the documentation of this file.
5
6namespace System;
7
9public readonly struct TimeSpan : IComparable, IComparable<TimeSpan>, IEquatable<TimeSpan>, ISpanFormattable, IFormattable, IAdditionOperators<TimeSpan, TimeSpan, TimeSpan>, IAdditiveIdentity<TimeSpan, TimeSpan>, IComparisonOperators<TimeSpan, TimeSpan>, IEqualityOperators<TimeSpan, TimeSpan>, IDivisionOperators<TimeSpan, double, TimeSpan>, IDivisionOperators<TimeSpan, TimeSpan, double>, IMinMaxValue<TimeSpan>, IMultiplyOperators<TimeSpan, double, TimeSpan>, IMultiplicativeIdentity<TimeSpan, double>, ISpanParseable<TimeSpan>, IParseable<TimeSpan>, ISubtractionOperators<TimeSpan, TimeSpan, TimeSpan>, IUnaryNegationOperators<TimeSpan, TimeSpan>, IUnaryPlusOperators<TimeSpan, TimeSpan>
10{
11 public const long TicksPerMillisecond = 10000L;
12
13 public const long TicksPerSecond = 10000000L;
14
15 public const long TicksPerMinute = 600000000L;
16
17 public const long TicksPerHour = 36000000000L;
18
19 public const long TicksPerDay = 864000000000L;
20
21 public static readonly TimeSpan Zero = new TimeSpan(0L);
22
23 public static readonly TimeSpan MaxValue = new TimeSpan(long.MaxValue);
24
25 public static readonly TimeSpan MinValue = new TimeSpan(long.MinValue);
26
27 internal readonly long _ticks;
28
29 public long Ticks => _ticks;
30
31 public int Days => (int)(_ticks / 864000000000L);
32
33 public int Hours => (int)(_ticks / 36000000000L % 24);
34
35 public int Milliseconds => (int)(_ticks / 10000 % 1000);
36
37 public int Minutes => (int)(_ticks / 600000000 % 60);
38
39 public int Seconds => (int)(_ticks / 10000000 % 60);
40
41 public double TotalDays => (double)_ticks / 864000000000.0;
42
43 public double TotalHours => (double)_ticks / 36000000000.0;
44
45 public double TotalMilliseconds
46 {
47 get
48 {
49 double num = (double)_ticks / 10000.0;
50 if (num > 922337203685477.0)
51 {
52 return 922337203685477.0;
53 }
54 if (num < -922337203685477.0)
55 {
56 return -922337203685477.0;
57 }
58 return num;
59 }
60 }
61
62 public double TotalMinutes => (double)_ticks / 600000000.0;
63
64 public double TotalSeconds => (double)_ticks / 10000000.0;
65
66 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
68
69 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
71
72 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
74
75 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
77
78 public TimeSpan(long ticks)
79 {
80 _ticks = ticks;
81 }
82
83 public TimeSpan(int hours, int minutes, int seconds)
84 {
85 _ticks = TimeToTicks(hours, minutes, seconds);
86 }
87
88 public TimeSpan(int days, int hours, int minutes, int seconds)
89 : this(days, hours, minutes, seconds, 0)
90 {
91 }
92
93 public TimeSpan(int days, int hours, int minutes, int seconds, int milliseconds)
94 {
95 long num = ((long)days * 3600L * 24 + (long)hours * 3600L + (long)minutes * 60L + seconds) * 1000 + milliseconds;
96 if (num > 922337203685477L || num < -922337203685477L)
97 {
99 }
100 _ticks = num * 10000;
101 }
102
104 {
105 long num = _ticks + ts._ticks;
106 if (_ticks >> 63 == ts._ticks >> 63 && _ticks >> 63 != num >> 63)
107 {
109 }
110 return new TimeSpan(num);
111 }
112
113 public static int Compare(TimeSpan t1, TimeSpan t2)
114 {
115 if (t1._ticks > t2._ticks)
116 {
117 return 1;
118 }
119 if (t1._ticks < t2._ticks)
120 {
121 return -1;
122 }
123 return 0;
124 }
125
126 public int CompareTo(object? value)
127 {
128 if (value == null)
129 {
130 return 1;
131 }
132 if (!(value is TimeSpan))
133 {
135 }
136 long ticks = ((TimeSpan)value)._ticks;
137 if (_ticks > ticks)
138 {
139 return 1;
140 }
141 if (_ticks < ticks)
142 {
143 return -1;
144 }
145 return 0;
146 }
147
149 {
150 long ticks = value._ticks;
151 if (_ticks > ticks)
152 {
153 return 1;
154 }
155 if (_ticks < ticks)
156 {
157 return -1;
158 }
159 return 0;
160 }
161
162 public static TimeSpan FromDays(double value)
163 {
164 return Interval(value, 864000000000.0);
165 }
166
168 {
169 if (Ticks == MinValue.Ticks)
170 {
172 }
173 return new TimeSpan((_ticks >= 0) ? _ticks : (-_ticks));
174 }
175
176 public override bool Equals([NotNullWhen(true)] object? value)
177 {
178 if (value is TimeSpan)
179 {
180 return _ticks == ((TimeSpan)value)._ticks;
181 }
182 return false;
183 }
184
185 public bool Equals(TimeSpan obj)
186 {
187 return _ticks == obj._ticks;
188 }
189
190 public static bool Equals(TimeSpan t1, TimeSpan t2)
191 {
192 return t1._ticks == t2._ticks;
193 }
194
195 public override int GetHashCode()
196 {
197 return (int)_ticks ^ (int)(_ticks >> 32);
198 }
199
200 public static TimeSpan FromHours(double value)
201 {
202 return Interval(value, 36000000000.0);
203 }
204
205 private static TimeSpan Interval(double value, double scale)
206 {
207 if (double.IsNaN(value))
208 {
210 }
211 double ticks = value * scale;
212 return IntervalFromDoubleTicks(ticks);
213 }
214
215 private static TimeSpan IntervalFromDoubleTicks(double ticks)
216 {
217 if (ticks > 9.223372036854776E+18 || ticks < -9.223372036854776E+18 || double.IsNaN(ticks))
218 {
220 }
221 if (ticks == 9.223372036854776E+18)
222 {
223 return MaxValue;
224 }
225 return new TimeSpan((long)ticks);
226 }
227
228 public static TimeSpan FromMilliseconds(double value)
229 {
230 return Interval(value, 10000.0);
231 }
232
233 public static TimeSpan FromMinutes(double value)
234 {
235 return Interval(value, 600000000.0);
236 }
237
239 {
240 if (Ticks == MinValue.Ticks)
241 {
243 }
244 return new TimeSpan(-_ticks);
245 }
246
247 public static TimeSpan FromSeconds(double value)
248 {
249 return Interval(value, 10000000.0);
250 }
251
253 {
254 long num = _ticks - ts._ticks;
255 if (_ticks >> 63 != ts._ticks >> 63 && _ticks >> 63 != num >> 63)
256 {
258 }
259 return new TimeSpan(num);
260 }
261
262 public TimeSpan Multiply(double factor)
263 {
264 return this * factor;
265 }
266
267 public TimeSpan Divide(double divisor)
268 {
269 return this / divisor;
270 }
271
272 public double Divide(TimeSpan ts)
273 {
274 return this / ts;
275 }
276
277 public static TimeSpan FromTicks(long value)
278 {
279 return new TimeSpan(value);
280 }
281
282 [MethodImpl(MethodImplOptions.AggressiveInlining)]
283 internal static long TimeToTicks(int hour, int minute, int second)
284 {
285 long num = (long)hour * 3600L + (long)minute * 60L + second;
286 if (num > 922337203685L || num < -922337203685L)
287 {
289 }
290 return num * 10000000;
291 }
292
293 private static void ValidateStyles(TimeSpanStyles style, string parameterName)
294 {
295 if (style != 0 && style != TimeSpanStyles.AssumeNegative)
296 {
297 throw new ArgumentException(SR.Argument_InvalidTimeSpanStyles, parameterName);
298 }
299 }
300
301 public static TimeSpan Parse(string s)
302 {
303 if (s == null)
304 {
306 }
307 return TimeSpanParse.Parse(s, null);
308 }
309
310 public static TimeSpan Parse(string input, IFormatProvider? formatProvider)
311 {
312 if (input == null)
313 {
315 }
316 return TimeSpanParse.Parse(input, formatProvider);
317 }
318
319 public static TimeSpan Parse(ReadOnlySpan<char> input, IFormatProvider? formatProvider = null)
320 {
321 return TimeSpanParse.Parse(input, formatProvider);
322 }
323
324 public static TimeSpan ParseExact(string input, string format, IFormatProvider? formatProvider)
325 {
326 if (input == null)
327 {
329 }
330 if (format == null)
331 {
333 }
334 return TimeSpanParse.ParseExact(input, format, formatProvider, TimeSpanStyles.None);
335 }
336
337 public static TimeSpan ParseExact(string input, string[] formats, IFormatProvider? formatProvider)
338 {
339 if (input == null)
340 {
342 }
343 return TimeSpanParse.ParseExactMultiple(input, formats, formatProvider, TimeSpanStyles.None);
344 }
345
346 public static TimeSpan ParseExact(string input, string format, IFormatProvider? formatProvider, TimeSpanStyles styles)
347 {
348 ValidateStyles(styles, "styles");
349 if (input == null)
350 {
352 }
353 if (format == null)
354 {
356 }
357 return TimeSpanParse.ParseExact(input, format, formatProvider, styles);
358 }
359
361 {
362 ValidateStyles(styles, "styles");
363 return TimeSpanParse.ParseExact(input, format, formatProvider, styles);
364 }
365
366 public static TimeSpan ParseExact(string input, string[] formats, IFormatProvider? formatProvider, TimeSpanStyles styles)
367 {
368 ValidateStyles(styles, "styles");
369 if (input == null)
370 {
372 }
373 return TimeSpanParse.ParseExactMultiple(input, formats, formatProvider, styles);
374 }
375
376 public static TimeSpan ParseExact(ReadOnlySpan<char> input, string[] formats, IFormatProvider? formatProvider, TimeSpanStyles styles = TimeSpanStyles.None)
377 {
378 ValidateStyles(styles, "styles");
379 return TimeSpanParse.ParseExactMultiple(input, formats, formatProvider, styles);
380 }
381
382 public static bool TryParse([NotNullWhen(true)] string? s, out TimeSpan result)
383 {
384 if (s == null)
385 {
386 result = default(TimeSpan);
387 return false;
388 }
389 return TimeSpanParse.TryParse(s, null, out result);
390 }
391
392 public static bool TryParse(ReadOnlySpan<char> s, out TimeSpan result)
393 {
394 return TimeSpanParse.TryParse(s, null, out result);
395 }
396
397 public static bool TryParse([NotNullWhen(true)] string? input, IFormatProvider? formatProvider, out TimeSpan result)
398 {
399 if (input == null)
400 {
401 result = default(TimeSpan);
402 return false;
403 }
404 return TimeSpanParse.TryParse(input, formatProvider, out result);
405 }
406
407 public static bool TryParse(ReadOnlySpan<char> input, IFormatProvider? formatProvider, out TimeSpan result)
408 {
409 return TimeSpanParse.TryParse(input, formatProvider, out result);
410 }
411
412 public static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true)] string? format, IFormatProvider? formatProvider, out TimeSpan result)
413 {
414 if (input == null || format == null)
415 {
416 result = default(TimeSpan);
417 return false;
418 }
419 return TimeSpanParse.TryParseExact(input, format, formatProvider, TimeSpanStyles.None, out result);
420 }
421
423 {
424 return TimeSpanParse.TryParseExact(input, format, formatProvider, TimeSpanStyles.None, out result);
425 }
426
427 public static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true)] string?[]? formats, IFormatProvider? formatProvider, out TimeSpan result)
428 {
429 if (input == null)
430 {
431 result = default(TimeSpan);
432 return false;
433 }
434 return TimeSpanParse.TryParseExactMultiple(input, formats, formatProvider, TimeSpanStyles.None, out result);
435 }
436
437 public static bool TryParseExact(ReadOnlySpan<char> input, [NotNullWhen(true)] string?[]? formats, IFormatProvider? formatProvider, out TimeSpan result)
438 {
439 return TimeSpanParse.TryParseExactMultiple(input, formats, formatProvider, TimeSpanStyles.None, out result);
440 }
441
442 public static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true)] string? format, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
443 {
444 ValidateStyles(styles, "styles");
445 if (input == null || format == null)
446 {
447 result = default(TimeSpan);
448 return false;
449 }
450 return TimeSpanParse.TryParseExact(input, format, formatProvider, styles, out result);
451 }
452
454 {
455 ValidateStyles(styles, "styles");
456 return TimeSpanParse.TryParseExact(input, format, formatProvider, styles, out result);
457 }
458
459 public static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true)] string?[]? formats, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
460 {
461 ValidateStyles(styles, "styles");
462 if (input == null)
463 {
464 result = default(TimeSpan);
465 return false;
466 }
467 return TimeSpanParse.TryParseExactMultiple(input, formats, formatProvider, styles, out result);
468 }
469
470 public static bool TryParseExact(ReadOnlySpan<char> input, [NotNullWhen(true)] string?[]? formats, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
471 {
472 ValidateStyles(styles, "styles");
473 return TimeSpanParse.TryParseExactMultiple(input, formats, formatProvider, styles, out result);
474 }
475
476 public override string ToString()
477 {
478 return TimeSpanFormat.FormatC(this);
479 }
480
481 public string ToString(string? format)
482 {
483 return TimeSpanFormat.Format(this, format, null);
484 }
485
486 public string ToString(string? format, IFormatProvider? formatProvider)
487 {
488 return TimeSpanFormat.Format(this, format, formatProvider);
489 }
490
491 public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default(ReadOnlySpan<char>), IFormatProvider? formatProvider = null)
492 {
493 return TimeSpanFormat.TryFormat(this, destination, out charsWritten, format, formatProvider);
494 }
495
496 public static TimeSpan operator -(TimeSpan t)
497 {
498 if (t._ticks == MinValue._ticks)
499 {
501 }
502 return new TimeSpan(-t._ticks);
503 }
504
505 public static TimeSpan operator -(TimeSpan t1, TimeSpan t2)
506 {
507 return t1.Subtract(t2);
508 }
509
510 public static TimeSpan operator +(TimeSpan t)
511 {
512 return t;
513 }
514
515 public static TimeSpan operator +(TimeSpan t1, TimeSpan t2)
516 {
517 return t1.Add(t2);
518 }
519
520 public static TimeSpan operator *(TimeSpan timeSpan, double factor)
521 {
522 if (double.IsNaN(factor))
523 {
524 throw new ArgumentException(SR.Arg_CannotBeNaN, "factor");
525 }
526 double ticks = Math.Round((double)timeSpan.Ticks * factor);
527 return IntervalFromDoubleTicks(ticks);
528 }
529
530 public static TimeSpan operator *(double factor, TimeSpan timeSpan)
531 {
532 return timeSpan * factor;
533 }
534
535 public static TimeSpan operator /(TimeSpan timeSpan, double divisor)
536 {
537 if (double.IsNaN(divisor))
538 {
539 throw new ArgumentException(SR.Arg_CannotBeNaN, "divisor");
540 }
541 double ticks = Math.Round((double)timeSpan.Ticks / divisor);
542 return IntervalFromDoubleTicks(ticks);
543 }
544
545 public static double operator /(TimeSpan t1, TimeSpan t2)
546 {
547 return (double)t1.Ticks / (double)t2.Ticks;
548 }
549
550 public static bool operator ==(TimeSpan t1, TimeSpan t2)
551 {
552 return t1._ticks == t2._ticks;
553 }
554
555 public static bool operator !=(TimeSpan t1, TimeSpan t2)
556 {
557 return t1._ticks != t2._ticks;
558 }
559
560 public static bool operator <(TimeSpan t1, TimeSpan t2)
561 {
562 return t1._ticks < t2._ticks;
563 }
564
565 public static bool operator <=(TimeSpan t1, TimeSpan t2)
566 {
567 return t1._ticks <= t2._ticks;
568 }
569
570 public static bool operator >(TimeSpan t1, TimeSpan t2)
571 {
572 return t1._ticks > t2._ticks;
573 }
574
575 public static bool operator >=(TimeSpan t1, TimeSpan t2)
576 {
577 return t1._ticks >= t2._ticks;
578 }
579
580 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
582 {
583 return left + right;
584 }
585
586 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
588 {
589 return left < right;
590 }
591
592 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
593 static bool IComparisonOperators<TimeSpan, TimeSpan>.operator <=(TimeSpan left, TimeSpan right)
594 {
595 return left <= right;
596 }
597
598 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
600 {
601 return left > right;
602 }
603
604 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
605 static bool IComparisonOperators<TimeSpan, TimeSpan>.operator >=(TimeSpan left, TimeSpan right)
606 {
607 return left >= right;
608 }
609
610 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
612 {
613 return left / right;
614 }
615
616 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
618 {
619 return left / right;
620 }
621
622 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
623 static bool IEqualityOperators<TimeSpan, TimeSpan>.operator ==(TimeSpan left, TimeSpan right)
624 {
625 return left == right;
626 }
627
628 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
629 static bool IEqualityOperators<TimeSpan, TimeSpan>.operator !=(TimeSpan left, TimeSpan right)
630 {
631 return left != right;
632 }
633
634 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
636 {
637 return left * right;
638 }
639
640 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
642 {
643 return Parse(s, provider);
644 }
645
646 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
647 static bool IParseable<TimeSpan>.TryParse([NotNullWhen(true)] string s, IFormatProvider provider, out TimeSpan result)
648 {
649 return TryParse(s, provider, out result);
650 }
651
652 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
654 {
655 return Parse(s, provider);
656 }
657
658 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
660 {
661 return TryParse(s, provider, out result);
662 }
663
664 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
666 {
667 return left - right;
668 }
669
670 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
672 {
673 return -value;
674 }
675
676 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
678 {
679 return +value;
680 }
681}
static bool TryFormat(TimeSpan value, Span< char > destination, out int charsWritten, ReadOnlySpan< char > format, IFormatProvider formatProvider)
static string FormatC(TimeSpan value)
static string Format(TimeSpan value, string format, IFormatProvider formatProvider)
static TimeSpan Parse(ReadOnlySpan< char > input, IFormatProvider formatProvider)
static TimeSpan ParseExactMultiple(ReadOnlySpan< char > input, string[] formats, IFormatProvider formatProvider, TimeSpanStyles styles)
static bool TryParseExactMultiple(ReadOnlySpan< char > input, string[] formats, IFormatProvider formatProvider, TimeSpanStyles styles, out TimeSpan result)
static bool TryParseExact(ReadOnlySpan< char > input, ReadOnlySpan< char > format, IFormatProvider formatProvider, TimeSpanStyles styles, out TimeSpan result)
static TimeSpan ParseExact(ReadOnlySpan< char > input, ReadOnlySpan< char > format, IFormatProvider formatProvider, TimeSpanStyles styles)
static bool TryParse(ReadOnlySpan< char > input, IFormatProvider formatProvider, out TimeSpan result)
static decimal Round(decimal d)
Definition Math.cs:1096
static string Overflow_NegateTwosCompNum
Definition SR.cs:1776
static string Arg_MustBeTimeSpan
Definition SR.cs:300
static string Overflow_Duration
Definition SR.cs:1768
static string Argument_InvalidTimeSpanStyles
Definition SR.cs:742
static string Overflow_TimeSpanTooLong
Definition SR.cs:1784
static string Arg_CannotBeNaN
Definition SR.cs:90
Definition SR.cs:7
static void ThrowArgumentNullException(string name)
static void ThrowArgumentOutOfRange_TimeSpanTooLong()
static TResult AdditiveIdentity
static TSelf MinValue
static TSelf MaxValue
static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out TSelf result)
static TSelf Parse(string s, IFormatProvider? provider)
static bool TryParse(ReadOnlySpan< char > s, IFormatProvider? provider, out TSelf result)
static TSelf Parse(ReadOnlySpan< char > s, IFormatProvider? provider)
static TimeSpan ParseExact(string input, string format, IFormatProvider? formatProvider, TimeSpanStyles styles)
Definition TimeSpan.cs:346
TimeSpan(int days, int hours, int minutes, int seconds)
Definition TimeSpan.cs:88
static bool TryParseExact(ReadOnlySpan< char > input, [NotNullWhen(true)] string?[]? formats, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
Definition TimeSpan.cs:470
static TimeSpan operator-(TimeSpan t)
Definition TimeSpan.cs:496
const long TicksPerMinute
Definition TimeSpan.cs:15
static TimeSpan Parse(string input, IFormatProvider? formatProvider)
Definition TimeSpan.cs:310
static bool operator>=(TimeSpan t1, TimeSpan t2)
Definition TimeSpan.cs:575
bool TryFormat(Span< char > destination, out int charsWritten, ReadOnlySpan< char > format=default(ReadOnlySpan< char >), IFormatProvider? formatProvider=null)
Definition TimeSpan.cs:491
double TotalDays
Definition TimeSpan.cs:41
static TimeSpan ParseExact(ReadOnlySpan< char > input, string[] formats, IFormatProvider? formatProvider, TimeSpanStyles styles=TimeSpanStyles.None)
Definition TimeSpan.cs:376
double TotalSeconds
Definition TimeSpan.cs:64
TimeSpan(int hours, int minutes, int seconds)
Definition TimeSpan.cs:83
double TotalMilliseconds
Definition TimeSpan.cs:46
static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true)] string?[]? formats, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
Definition TimeSpan.cs:459
static readonly TimeSpan MinValue
Definition TimeSpan.cs:25
static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true)] string? format, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
Definition TimeSpan.cs:442
static int Compare(TimeSpan t1, TimeSpan t2)
Definition TimeSpan.cs:113
static TimeSpan Parse(ReadOnlySpan< char > input, IFormatProvider? formatProvider=null)
Definition TimeSpan.cs:319
static bool TryParseExact(ReadOnlySpan< char > input, ReadOnlySpan< char > format, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
Definition TimeSpan.cs:453
static void ValidateStyles(TimeSpanStyles style, string parameterName)
Definition TimeSpan.cs:293
TimeSpan(int days, int hours, int minutes, int seconds, int milliseconds)
Definition TimeSpan.cs:93
static bool TryParse(ReadOnlySpan< char > s, out TimeSpan result)
Definition TimeSpan.cs:392
static bool TryParse([NotNullWhen(true)] string? s, out TimeSpan result)
Definition TimeSpan.cs:382
static TimeSpan IMinMaxValue< TimeSpan >. MinValue
Definition TimeSpan.cs:70
static bool operator>(TimeSpan t1, TimeSpan t2)
Definition TimeSpan.cs:570
static bool TryParse(ReadOnlySpan< char > input, IFormatProvider? formatProvider, out TimeSpan result)
Definition TimeSpan.cs:407
TimeSpan Multiply(double factor)
Definition TimeSpan.cs:262
double Divide(TimeSpan ts)
Definition TimeSpan.cs:272
static TimeSpan Interval(double value, double scale)
Definition TimeSpan.cs:205
TimeSpan Negate()
Definition TimeSpan.cs:238
static bool operator<=(TimeSpan t1, TimeSpan t2)
Definition TimeSpan.cs:565
static readonly TimeSpan MaxValue
Definition TimeSpan.cs:23
static TimeSpan FromMilliseconds(double value)
Definition TimeSpan.cs:228
static TimeSpan ParseExact(string input, string[] formats, IFormatProvider? formatProvider)
Definition TimeSpan.cs:337
static bool operator<(TimeSpan t1, TimeSpan t2)
Definition TimeSpan.cs:560
TimeSpan Duration()
Definition TimeSpan.cs:167
TimeSpan(long ticks)
Definition TimeSpan.cs:78
const long TicksPerMillisecond
Definition TimeSpan.cs:11
double TotalHours
Definition TimeSpan.cs:43
double TotalMinutes
Definition TimeSpan.cs:62
static bool TryParseExact(ReadOnlySpan< char > input, [NotNullWhen(true)] string?[]? formats, IFormatProvider? formatProvider, out TimeSpan result)
Definition TimeSpan.cs:437
static TimeSpan FromSeconds(double value)
Definition TimeSpan.cs:247
static TimeSpan operator*(TimeSpan timeSpan, double factor)
Definition TimeSpan.cs:520
static TimeSpan IMinMaxValue< TimeSpan >. MaxValue
Definition TimeSpan.cs:73
static TimeSpan ParseExact(ReadOnlySpan< char > input, ReadOnlySpan< char > format, IFormatProvider? formatProvider, TimeSpanStyles styles=TimeSpanStyles.None)
Definition TimeSpan.cs:360
bool Equals(TimeSpan obj)
Definition TimeSpan.cs:185
static TimeSpan operator+(TimeSpan t)
Definition TimeSpan.cs:510
static TimeSpan ParseExact(string input, string[] formats, IFormatProvider? formatProvider, TimeSpanStyles styles)
Definition TimeSpan.cs:366
static readonly TimeSpan Zero
Definition TimeSpan.cs:21
readonly long _ticks
Definition TimeSpan.cs:27
const long TicksPerDay
Definition TimeSpan.cs:19
override int GetHashCode()
Definition TimeSpan.cs:195
static bool TryParse([NotNullWhen(true)] string? input, IFormatProvider? formatProvider, out TimeSpan result)
Definition TimeSpan.cs:397
int CompareTo(object? value)
Definition TimeSpan.cs:126
static TimeSpan FromDays(double value)
Definition TimeSpan.cs:162
const long TicksPerHour
Definition TimeSpan.cs:17
static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true)] string?[]? formats, IFormatProvider? formatProvider, out TimeSpan result)
Definition TimeSpan.cs:427
static bool operator==(TimeSpan t1, TimeSpan t2)
Definition TimeSpan.cs:550
static TimeSpan IntervalFromDoubleTicks(double ticks)
Definition TimeSpan.cs:215
int CompareTo(TimeSpan value)
Definition TimeSpan.cs:148
TimeSpan Subtract(TimeSpan ts)
Definition TimeSpan.cs:252
static bool operator!=(TimeSpan t1, TimeSpan t2)
Definition TimeSpan.cs:555
static bool TryParseExact(ReadOnlySpan< char > input, ReadOnlySpan< char > format, IFormatProvider? formatProvider, out TimeSpan result)
Definition TimeSpan.cs:422
static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true)] string? format, IFormatProvider? formatProvider, out TimeSpan result)
Definition TimeSpan.cs:412
static TimeSpan FromTicks(long value)
Definition TimeSpan.cs:277
override bool Equals([NotNullWhen(true)] object? value)
Definition TimeSpan.cs:176
static TimeSpan FromHours(double value)
Definition TimeSpan.cs:200
string ToString(string? format, IFormatProvider? formatProvider)
Definition TimeSpan.cs:486
TimeSpan Divide(double divisor)
Definition TimeSpan.cs:267
static TimeSpan Parse(string s)
Definition TimeSpan.cs:301
override string ToString()
Definition TimeSpan.cs:476
const long TicksPerSecond
Definition TimeSpan.cs:13
static TimeSpan ParseExact(string input, string format, IFormatProvider? formatProvider)
Definition TimeSpan.cs:324
static bool Equals(TimeSpan t1, TimeSpan t2)
Definition TimeSpan.cs:190
static long TimeToTicks(int hour, int minute, int second)
Definition TimeSpan.cs:283
static TimeSpan operator/(TimeSpan timeSpan, double divisor)
Definition TimeSpan.cs:535
static TimeSpan FromMinutes(double value)
Definition TimeSpan.cs:233
TimeSpan Add(TimeSpan ts)
Definition TimeSpan.cs:103
string ToString(string? format)
Definition TimeSpan.cs:481