C# Класс NFluent.Helpers.TimeHelper

Static class hosting various time helper.
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
Convert ( System.TimeSpan value, TimeUnit unit ) : double

Expresses a TimeSpan duration in the desired TimeUnit.

DiscoverUnit ( System.TimeSpan timeSpan ) : TimeUnit

Discover the most appropriate TimeUnit to express the given duration.

GetFromNanoSeconds ( double duration, TimeUnit timeUnit ) : double

Converts a duration in nanoseconds to the desired TimeUnit.

GetInNanoSeconds ( double value, TimeUnit unit ) : double

Converts a duration in nanoseconds.

ToTimeSpan ( double value, TimeUnit timeUnit ) : System.TimeSpan

Creates a TimeSpan representing the duration expressed in TimeUnit.

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

Метод Описание
GetConversionFactor ( TimeUnit unit ) : long

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

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

Expresses a TimeSpan duration in the desired TimeUnit.
Raised if time unit is not recognized.
public static Convert ( System.TimeSpan value, TimeUnit unit ) : double
value System.TimeSpan Duration to convert.
unit TimeUnit to convert to.
Результат double

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

Discover the most appropriate TimeUnit to express the given duration.
public static DiscoverUnit ( System.TimeSpan timeSpan ) : TimeUnit
timeSpan System.TimeSpan /// Duration to analyze. ///
Результат TimeUnit

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

Converts a duration in nanoseconds to the desired TimeUnit.
/// Raised if time unit is not recognized. ///
public static GetFromNanoSeconds ( double duration, TimeUnit timeUnit ) : double
duration double /// The duration in nanoseconds. ///
timeUnit TimeUnit /// The time unit desired. ///
Результат double

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

Converts a duration in nanoseconds.
Raised if time unit is not recognized.
public static GetInNanoSeconds ( double value, TimeUnit unit ) : double
value double Number of time units.
unit TimeUnit Time unit in which duration is expressed.
Результат double

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

Creates a TimeSpan representing the duration expressed in TimeUnit.
Raised if time unit is not recognized.
public static ToTimeSpan ( double value, TimeUnit timeUnit ) : System.TimeSpan
value double /// Duration duration. ///
timeUnit TimeUnit /// Duration unit. ///
Результат System.TimeSpan