Skip to content
Closed
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
12 changes: 12 additions & 0 deletions src/libraries/System.Private.CoreLib/src/System/TimeSpan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,18 @@ private static TimeSpan IntervalFromDoubleTicks(double ticks)

public static TimeSpan FromMilliseconds(double value) => Interval(value, TicksPerMillisecond);

public static TimeSpan FromMilliseconds(long milliseconds)
{
return new TimeSpan(milliseconds * TicksPerMillisecond);
}

public static TimeSpan FromMilliseconds(long milliseconds, long microseconds = 0)
{
long totalTicks = milliseconds * TicksPerMillisecond
+ microseconds * TicksPerMicrosecond;
return new TimeSpan(totalTicks);
}

/// <summary>
/// Returns a <see cref="TimeSpan"/> that represents a specified number of microseconds.
/// </summary>
Expand Down
11 changes: 11 additions & 0 deletions src/libraries/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5606,6 +5606,17 @@ public TimeoutException(string? message, System.Exception? innerException) { }
public static System.TimeSpan FromMilliseconds(double value) { throw null; }
public static System.TimeSpan FromMinutes(double value) { throw null; }
public static System.TimeSpan FromSeconds(double value) { throw null; }
public static System.TimeSpan FromDays(int days) { throw null; }
public static System.TimeSpan FromDays(int days, int hours = 0, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0) { throw null; }
public static System.TimeSpan FromHours(int hours) { throw null; }
public static System.TimeSpan FromHours(int hours, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0) { throw null; }
public static System.TimeSpan FromMinutes(long minutes) { throw null; }
public static System.TimeSpan FromMinutes(long minutes, long seconds = 0, long milliseconds = 0, long microseconds = 0) { throw null; }
public static System.TimeSpan FromSeconds(long seconds) { throw null; }
public static System.TimeSpan FromSeconds(long seconds, long milliseconds = 0, long microseconds = 0) { throw null; }
public static System.TimeSpan FromMilliseconds(long milliseconds) { throw null; }
public static System.TimeSpan FromMilliseconds(long milliseconds, long microseconds = 0) { throw null; }
public static System.TimeSpan FromMicroseconds(long microseconds) { throw null; }
public static System.TimeSpan FromTicks(long value) { throw null; }
public override int GetHashCode() { throw null; }
public System.TimeSpan Multiply(double factor) { throw null; }
Expand Down