Skip to content

Commit 4329de3

Browse files
committed
Use new TimeSpan.From overloads.
1 parent 31b0ea9 commit 4329de3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/MySqlConnector/ColumnReaders/BinaryTimeColumnReader.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public override object ReadValue(ReadOnlySpan<byte> data, ColumnDefinitionPayloa
2828
microseconds = -microseconds;
2929
}
3030

31-
#if NET7_0_OR_GREATER
31+
#if NET9_0_OR_GREATER
32+
return TimeSpan.FromDays(days, hours, minutes, seconds, microseconds: microseconds);
33+
#elif NET7_0_OR_GREATER
3234
return new TimeSpan(days, hours, minutes, seconds, microseconds / 1000, microseconds % 1000);
3335
#else
3436
return new TimeSpan(days, hours, minutes, seconds) + TimeSpan.FromTicks(microseconds * 10);

src/MySqlConnector/Utilities/Utility.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,9 @@ public static TimeSpan ParseTimeSpan(ReadOnlySpan<byte> value)
451451
seconds = -seconds;
452452
microseconds = -microseconds;
453453
}
454-
#if NET7_0_OR_GREATER
454+
#if NET9_0_OR_GREATER
455+
return TimeSpan.FromHours(hours, minutes, seconds, microseconds: microseconds);
456+
#elif NET7_0_OR_GREATER
455457
return new TimeSpan(0, hours, minutes, seconds, microseconds / 1000, microseconds % 1000);
456458
#else
457459
return new TimeSpan(0, hours, minutes, seconds, microseconds / 1000) + TimeSpan.FromTicks(microseconds % 1000 * 10);

0 commit comments

Comments
 (0)