Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ TryCreateTimeSpan()

static bool System.Buffers.Text.Utf8Parser.TryCreateTimeSpan ( bool isNegative,
uint days,
uint hours,
uint minutes,
uint seconds,
uint fraction,
out TimeSpan timeSpan )
inlinestaticprivate

Definition at line 3837 of file Utf8Parser.cs.

3838 {
3839 if (hours > 23 || minutes > 59 || seconds > 59)
3840 {
3841 timeSpan = default(TimeSpan);
3842 return false;
3843 }
3844 long num = ((long)days * 3600L * 24 + (long)hours * 3600L + (long)minutes * 60L + seconds) * 1000;
3845 long ticks;
3846 if (isNegative)
3847 {
3848 num = -num;
3849 if (num < -922337203685477L)
3850 {
3851 timeSpan = default(TimeSpan);
3852 return false;
3853 }
3854 long num2 = num * 10000;
3855 if (num2 < long.MinValue + fraction)
3856 {
3857 timeSpan = default(TimeSpan);
3858 return false;
3859 }
3860 ticks = num2 - fraction;
3861 }
3862 else
3863 {
3864 if (num > 922337203685477L)
3865 {
3866 timeSpan = default(TimeSpan);
3867 return false;
3868 }
3869 long num3 = num * 10000;
3870 if (num3 > long.MaxValue - (long)fraction)
3871 {
3872 timeSpan = default(TimeSpan);
3873 return false;
3874 }
3875 ticks = num3 + fraction;
3876 }
3877 timeSpan = new TimeSpan(ticks);
3878 return true;
3879 }

References System.L.

Referenced by System.Buffers.Text.Utf8Parser.TryParseTimeSpanBigG(), System.Buffers.Text.Utf8Parser.TryParseTimeSpanC(), and System.Buffers.Text.Utf8Parser.TryParseTimeSpanLittleG().