C# Class SmartFormat.Utilities.TimeSpanUtility

Mostrar archivo Open project: scottrippey/SmartFormat.NET

Public Methods

Method Description
Ceiling ( this FromTime, long intervalTicks ) : System.TimeSpan

Returns the smallest TimeSpan greater than or equal to the specified interval.

For example: Ceiling("00:57:00", TimeSpan.TicksPerMinute * 5) => "01:00:00"

Floor ( this FromTime, long intervalTicks ) : System.TimeSpan

Returns the largest TimeSpan less than or equal to the specified interval.

For example: Floor("00:57:00", TimeSpan.TicksPerMinute * 5) => "00:55:00"

Round ( this FromTime, long intervalTicks ) : System.TimeSpan

Returns the TimeSpan closest to the specified interval.

For example: Round("00:57:00", TimeSpan.TicksPerMinute * 5) => "00:55:00"

ToTimeString ( this FromTime, TimeSpanFormatOptions options, TimeTextInfo timeTextInfo ) : string

Turns a TimeSpan into a human-readable text.

Uses the specified timeSpanFormatOptions.

For example: "31.23:59:00.555" = "31 days 23 hours 59 minutes 0 seconds 555 milliseconds"

Private Methods

Method Description
TimeSpanUtility ( ) : System

Method Details

Ceiling() public static method

Returns the smallest TimeSpan greater than or equal to the specified interval.

For example: Ceiling("00:57:00", TimeSpan.TicksPerMinute * 5) => "01:00:00"

public static Ceiling ( this FromTime, long intervalTicks ) : System.TimeSpan
FromTime this A TimeSpan to be rounded.
intervalTicks long Specifies the interval for rounding. Use TimeSpan.TicksPer____.
return System.TimeSpan

Floor() public static method

Returns the largest TimeSpan less than or equal to the specified interval.

For example: Floor("00:57:00", TimeSpan.TicksPerMinute * 5) => "00:55:00"

public static Floor ( this FromTime, long intervalTicks ) : System.TimeSpan
FromTime this A TimeSpan to be rounded.
intervalTicks long Specifies the interval for rounding. Use TimeSpan.TicksPer____.
return System.TimeSpan

Round() public static method

Returns the TimeSpan closest to the specified interval.

For example: Round("00:57:00", TimeSpan.TicksPerMinute * 5) => "00:55:00"

public static Round ( this FromTime, long intervalTicks ) : System.TimeSpan
FromTime this A TimeSpan to be rounded.
intervalTicks long Specifies the interval for rounding. Use TimeSpan.TicksPer____.
return System.TimeSpan

ToTimeString() public static method

Turns a TimeSpan into a human-readable text.

Uses the specified timeSpanFormatOptions.

For example: "31.23:59:00.555" = "31 days 23 hours 59 minutes 0 seconds 555 milliseconds"

public static ToTimeString ( this FromTime, TimeSpanFormatOptions options, TimeTextInfo timeTextInfo ) : string
FromTime this
options TimeSpanFormatOptions /// A combination of flags that determine the formatting options. /// These will be combined with the default timeSpanFormatOptions. ///
timeTextInfo TimeTextInfo An object that supplies the text to use for output
return string