C# Класс SmartFormat.Utilities.TimeSpanUtility

Показать файл Открыть проект

Открытые методы

Метод Описание
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"

Приватные методы

Метод Описание
TimeSpanUtility ( ) : System

Описание методов

Ceiling() публичный статический Метод

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____.
Результат System.TimeSpan

Floor() публичный статический Метод

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____.
Результат System.TimeSpan

Round() публичный статический Метод

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____.
Результат System.TimeSpan

ToTimeString() публичный статический Метод

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
Результат string