Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions api_list.include.md
Original file line number Diff line number Diff line change
Expand Up @@ -1473,11 +1473,11 @@

* `bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.tryformat?view=net-11.0#system-timespan-tryformat(system-span((system-byte))-system-int32@-system-readonlyspan((system-char))-system-iformatprovider))
* `bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.tryformat?view=net-11.0#system-timespan-tryformat(system-span((system-char))-system-int32@-system-readonlyspan((system-char))-system-iformatprovider))
* `TimeSpan FromDays(int, int, int, int, int, int)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromdays?view=net-11.0#system-timespan-fromdays(system-int32-system-int32-system-int32-system-int32-system-int32-system-int32))
* `TimeSpan FromHours(int, int, int, int, int)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromhours?view=net-11.0#system-timespan-fromhours(system-int32-system-int32-system-int32-system-int32-system-int32))
* `TimeSpan FromDays(int, int, long, long, long, long)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromdays?view=net-11.0#system-timespan-fromdays(system-int32-system-int32-system-int64-system-int64-system-int64-system-int64))
* `TimeSpan FromHours(int, long, long, long, long)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromhours?view=net-11.0#system-timespan-fromhours(system-int32-system-int64-system-int64-system-int64-system-int64))
* `TimeSpan FromMicroseconds(long)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.frommicroseconds?view=net-11.0#system-timespan-frommicroseconds(system-int64))
* `TimeSpan FromMilliseconds(long, long)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.frommilliseconds?view=net-11.0#system-timespan-frommilliseconds(system-int64-system-int64))
* `TimeSpan FromMinutes(int, int, int, int)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromminutes?view=net-11.0#system-timespan-fromminutes(system-int32-system-int32-system-int32-system-int32))
* `TimeSpan FromMinutes(long, long, long, long)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromminutes?view=net-11.0#system-timespan-fromminutes(system-int64-system-int64-system-int64-system-int64))
* `TimeSpan FromSeconds(long, long, long)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromseconds?view=net-11.0#system-timespan-fromseconds(system-int64-system-int64-system-int64))
* `int HoursPerDay` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.hoursperday?view=net-11.0)
* Note: A property rather than a const, since extension members cannot declare constants, so it cannot be used in a constant expression.
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2184,11 +2184,11 @@ The class `Polyfill` includes the following extension methods:

* `bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.tryformat?view=net-11.0#system-timespan-tryformat(system-span((system-byte))-system-int32@-system-readonlyspan((system-char))-system-iformatprovider))
* `bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.tryformat?view=net-11.0#system-timespan-tryformat(system-span((system-char))-system-int32@-system-readonlyspan((system-char))-system-iformatprovider))
* `TimeSpan FromDays(int, int, int, int, int, int)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromdays?view=net-11.0#system-timespan-fromdays(system-int32-system-int32-system-int32-system-int32-system-int32-system-int32))
* `TimeSpan FromHours(int, int, int, int, int)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromhours?view=net-11.0#system-timespan-fromhours(system-int32-system-int32-system-int32-system-int32-system-int32))
* `TimeSpan FromDays(int, int, long, long, long, long)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromdays?view=net-11.0#system-timespan-fromdays(system-int32-system-int32-system-int64-system-int64-system-int64-system-int64))
* `TimeSpan FromHours(int, long, long, long, long)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromhours?view=net-11.0#system-timespan-fromhours(system-int32-system-int64-system-int64-system-int64-system-int64))
* `TimeSpan FromMicroseconds(long)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.frommicroseconds?view=net-11.0#system-timespan-frommicroseconds(system-int64))
* `TimeSpan FromMilliseconds(long, long)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.frommilliseconds?view=net-11.0#system-timespan-frommilliseconds(system-int64-system-int64))
* `TimeSpan FromMinutes(int, int, int, int)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromminutes?view=net-11.0#system-timespan-fromminutes(system-int32-system-int32-system-int32-system-int32))
* `TimeSpan FromMinutes(long, long, long, long)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromminutes?view=net-11.0#system-timespan-fromminutes(system-int64-system-int64-system-int64-system-int64))
* `TimeSpan FromSeconds(long, long, long)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromseconds?view=net-11.0#system-timespan-fromseconds(system-int64-system-int64-system-int64))
* `int HoursPerDay` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.timespan.hoursperday?view=net-11.0)
* Note: A property rather than a const, since extension members cannot declare constants, so it cannot be used in a constant expression.
Expand Down
3 changes: 3 additions & 0 deletions src/Consume/Consume.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2145,6 +2145,9 @@ void TimeSpan_Methods()
timeSpan = TimeSpan.FromHours(1, 30);
timeSpan = TimeSpan.FromMinutes(1);
timeSpan = TimeSpan.FromMinutes(1, 30);
timeSpan = TimeSpan.FromDays(1, 2, 3L, 4L, 5L, 6L);
timeSpan = TimeSpan.FromHours(1, 2L, 3L, 4L, 5L);
timeSpan = TimeSpan.FromMinutes(1L, 2L, 3L, 4L);
timeSpan = TimeSpan.FromSeconds(1L);
timeSpan = TimeSpan.FromSeconds(1L, 500L);
timeSpan = TimeSpan.FromMicroseconds(1000L);
Expand Down
12 changes: 6 additions & 6 deletions src/Polyfill/TimeSpanPolyfill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ static TimeSpan TicksFromMicroseconds(decimal totalMicroseconds)
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of days, hours, minutes, seconds, milliseconds, and microseconds.
/// </summary>
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromdays?view=net-11.0#system-timespan-fromdays(system-int32-system-int32-system-int32-system-int32-system-int32-system-int32)
public static TimeSpan FromDays(int days, int hours = 0, int minutes = 0, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromdays?view=net-11.0#system-timespan-fromdays(system-int32-system-int32-system-int64-system-int64-system-int64-system-int64)
public static TimeSpan FromDays(int days, int hours = 0, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)days * MicrosecondsPerDay +
(decimal)hours * MicrosecondsPerHour +
Expand All @@ -177,8 +177,8 @@ public static TimeSpan FromDays(int days, int hours = 0, int minutes = 0, int se
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of hours, minutes, seconds, milliseconds, and microseconds.
/// </summary>
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromhours?view=net-11.0#system-timespan-fromhours(system-int32-system-int32-system-int32-system-int32-system-int32)
public static TimeSpan FromHours(int hours, int minutes = 0, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromhours?view=net-11.0#system-timespan-fromhours(system-int32-system-int64-system-int64-system-int64-system-int64)
public static TimeSpan FromHours(int hours, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)hours * MicrosecondsPerHour +
(decimal)minutes * MicrosecondsPerMinute +
Expand All @@ -189,8 +189,8 @@ public static TimeSpan FromHours(int hours, int minutes = 0, int seconds = 0, in
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of minutes, seconds, milliseconds, and microseconds.
/// </summary>
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromminutes?view=net-11.0#system-timespan-fromminutes(system-int32-system-int32-system-int32-system-int32)
public static TimeSpan FromMinutes(int minutes, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.timespan.fromminutes?view=net-11.0#system-timespan-fromminutes(system-int64-system-int64-system-int64-system-int64)
public static TimeSpan FromMinutes(long minutes, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)minutes * MicrosecondsPerMinute +
(decimal)seconds * MicrosecondsPerSecond +
Expand Down
6 changes: 3 additions & 3 deletions src/Split/net461/TimeSpanPolyfill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static TimeSpan TicksFromMicroseconds(decimal totalMicroseconds)
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of days, hours, minutes, seconds, milliseconds, and microseconds.
/// </summary>
public static TimeSpan FromDays(int days, int hours = 0, int minutes = 0, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
public static TimeSpan FromDays(int days, int hours = 0, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)days * MicrosecondsPerDay +
(decimal)hours * MicrosecondsPerHour +
Expand All @@ -114,7 +114,7 @@ public static TimeSpan FromDays(int days, int hours = 0, int minutes = 0, int se
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of hours, minutes, seconds, milliseconds, and microseconds.
/// </summary>
public static TimeSpan FromHours(int hours, int minutes = 0, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
public static TimeSpan FromHours(int hours, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)hours * MicrosecondsPerHour +
(decimal)minutes * MicrosecondsPerMinute +
Expand All @@ -124,7 +124,7 @@ public static TimeSpan FromHours(int hours, int minutes = 0, int seconds = 0, in
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of minutes, seconds, milliseconds, and microseconds.
/// </summary>
public static TimeSpan FromMinutes(int minutes, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
public static TimeSpan FromMinutes(long minutes, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)minutes * MicrosecondsPerMinute +
(decimal)seconds * MicrosecondsPerSecond +
Expand Down
6 changes: 3 additions & 3 deletions src/Split/net462/TimeSpanPolyfill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static TimeSpan TicksFromMicroseconds(decimal totalMicroseconds)
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of days, hours, minutes, seconds, milliseconds, and microseconds.
/// </summary>
public static TimeSpan FromDays(int days, int hours = 0, int minutes = 0, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
public static TimeSpan FromDays(int days, int hours = 0, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)days * MicrosecondsPerDay +
(decimal)hours * MicrosecondsPerHour +
Expand All @@ -114,7 +114,7 @@ public static TimeSpan FromDays(int days, int hours = 0, int minutes = 0, int se
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of hours, minutes, seconds, milliseconds, and microseconds.
/// </summary>
public static TimeSpan FromHours(int hours, int minutes = 0, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
public static TimeSpan FromHours(int hours, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)hours * MicrosecondsPerHour +
(decimal)minutes * MicrosecondsPerMinute +
Expand All @@ -124,7 +124,7 @@ public static TimeSpan FromHours(int hours, int minutes = 0, int seconds = 0, in
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of minutes, seconds, milliseconds, and microseconds.
/// </summary>
public static TimeSpan FromMinutes(int minutes, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
public static TimeSpan FromMinutes(long minutes, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)minutes * MicrosecondsPerMinute +
(decimal)seconds * MicrosecondsPerSecond +
Expand Down
6 changes: 3 additions & 3 deletions src/Split/net47/TimeSpanPolyfill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static TimeSpan TicksFromMicroseconds(decimal totalMicroseconds)
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of days, hours, minutes, seconds, milliseconds, and microseconds.
/// </summary>
public static TimeSpan FromDays(int days, int hours = 0, int minutes = 0, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
public static TimeSpan FromDays(int days, int hours = 0, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)days * MicrosecondsPerDay +
(decimal)hours * MicrosecondsPerHour +
Expand All @@ -114,7 +114,7 @@ public static TimeSpan FromDays(int days, int hours = 0, int minutes = 0, int se
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of hours, minutes, seconds, milliseconds, and microseconds.
/// </summary>
public static TimeSpan FromHours(int hours, int minutes = 0, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
public static TimeSpan FromHours(int hours, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)hours * MicrosecondsPerHour +
(decimal)minutes * MicrosecondsPerMinute +
Expand All @@ -124,7 +124,7 @@ public static TimeSpan FromHours(int hours, int minutes = 0, int seconds = 0, in
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of minutes, seconds, milliseconds, and microseconds.
/// </summary>
public static TimeSpan FromMinutes(int minutes, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
public static TimeSpan FromMinutes(long minutes, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)minutes * MicrosecondsPerMinute +
(decimal)seconds * MicrosecondsPerSecond +
Expand Down
6 changes: 3 additions & 3 deletions src/Split/net471/TimeSpanPolyfill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static TimeSpan TicksFromMicroseconds(decimal totalMicroseconds)
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of days, hours, minutes, seconds, milliseconds, and microseconds.
/// </summary>
public static TimeSpan FromDays(int days, int hours = 0, int minutes = 0, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
public static TimeSpan FromDays(int days, int hours = 0, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)days * MicrosecondsPerDay +
(decimal)hours * MicrosecondsPerHour +
Expand All @@ -114,7 +114,7 @@ public static TimeSpan FromDays(int days, int hours = 0, int minutes = 0, int se
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of hours, minutes, seconds, milliseconds, and microseconds.
/// </summary>
public static TimeSpan FromHours(int hours, int minutes = 0, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
public static TimeSpan FromHours(int hours, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)hours * MicrosecondsPerHour +
(decimal)minutes * MicrosecondsPerMinute +
Expand All @@ -124,7 +124,7 @@ public static TimeSpan FromHours(int hours, int minutes = 0, int seconds = 0, in
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of minutes, seconds, milliseconds, and microseconds.
/// </summary>
public static TimeSpan FromMinutes(int minutes, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
public static TimeSpan FromMinutes(long minutes, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)minutes * MicrosecondsPerMinute +
(decimal)seconds * MicrosecondsPerSecond +
Expand Down
6 changes: 3 additions & 3 deletions src/Split/net472/TimeSpanPolyfill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static TimeSpan TicksFromMicroseconds(decimal totalMicroseconds)
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of days, hours, minutes, seconds, milliseconds, and microseconds.
/// </summary>
public static TimeSpan FromDays(int days, int hours = 0, int minutes = 0, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
public static TimeSpan FromDays(int days, int hours = 0, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)days * MicrosecondsPerDay +
(decimal)hours * MicrosecondsPerHour +
Expand All @@ -114,7 +114,7 @@ public static TimeSpan FromDays(int days, int hours = 0, int minutes = 0, int se
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of hours, minutes, seconds, milliseconds, and microseconds.
/// </summary>
public static TimeSpan FromHours(int hours, int minutes = 0, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
public static TimeSpan FromHours(int hours, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)hours * MicrosecondsPerHour +
(decimal)minutes * MicrosecondsPerMinute +
Expand All @@ -124,7 +124,7 @@ public static TimeSpan FromHours(int hours, int minutes = 0, int seconds = 0, in
/// <summary>
/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of minutes, seconds, milliseconds, and microseconds.
/// </summary>
public static TimeSpan FromMinutes(int minutes, int seconds = 0, int milliseconds = 0, int microseconds = 0) =>
public static TimeSpan FromMinutes(long minutes, long seconds = 0, long milliseconds = 0, long microseconds = 0) =>
TicksFromMicroseconds(
(decimal)minutes * MicrosecondsPerMinute +
(decimal)seconds * MicrosecondsPerSecond +
Expand Down
Loading
Loading