• NeonSDK
  • NeonKUBE
Search Results for

    Show / Hide Table of Contents
    • Neon
      • Build
    • Neon.Blazor
      • BlazorHelper
      • BodyOutlet
      • ClientRenderContext
      • DOMRectReadOnly
      • EventHandlers
      • FileDownloader
      • HtmlElement
      • IRenderContext
      • IntersectionChangedEventArgs
      • IntersectionObserver
      • IntersectionObserverContext
      • MobileDetector
      • NeonBlazorExtensions
      • ServerRenderContext
      • SwipeDirection
      • SwipeHandler
    • Neon.Blazor.Analyzers
      • SvgGenerator
      • SvgGenerator.Svg
    • Neon.BuildInfo
      • ThisAssembly
      • ThisAssembly.Git
      • ThisAssembly.Git.BaseVersion
      • ThisAssembly.Git.SemVer
    • Neon.CSharp
      • CSharpHelper
      • CompilerErrorException
      • MetadataReferences
    • Neon.Cassandra
      • KeyspaceStatus
      • RowSetExtensions
      • SchemaManager
      • SchemaManagerException
      • SchemaStatus
      • SessionExtensions
    • Neon.Collections
      • ArgDictionary
      • Bits
      • IObjectDictionary
      • NiceDictionary<TKey, TValue>
      • ObjectDictionary
    • Neon.Common
      • AppDomainExtensions
      • Block
      • BlockArray
      • ByteEncoding
      • ByteUnits
      • CommandLine
      • CommandLine.OptionDefinition
      • CommandLine.Redactor
      • CpuArchitecture
      • Credentials
      • DateTimeExtensions
      • EnumExtensions
      • EnvironmentParser
      • EnvironmentParser.Parser<T>
      • EnvironmentParser.Validator<T>
      • EnvironmentParser.VariableSource
      • ExceptionExtensions
      • ExecuteException
      • ExecuteResponse
      • GlobPattern
      • HexDumpOption
      • HttpClientExtensions
      • HttpResponseMessageExtensions
      • IEnumerableExtensions
      • ILabeled
      • IOExtensions
      • IServiceContainer
      • IStaticDirectoryExtensions
      • LabelSelector
      • LabelSelectorOptions
      • LabelSelector<TItem>
      • NeonAssemblyExtensions
      • NeonExtendedHelper
      • NeonHelper
      • NetFramework
      • NewtonsoftExtensions
      • NotReadyException
      • ProcessExtensions
      • ProgramEntrypoint
      • ProgramEntrypointAsync
      • ProgramExitException
      • ProgramRunner
      • RandomExtensions
      • ReflectionExtensions
      • SemanticVersion
      • ServiceContainer
      • StaticZipOptions
      • StringBuilderExtensions
      • StringExtensions
      • Stub
      • Stub.Value
      • TaskExtensions
      • TimeSpanExtensions
      • ToolException
      • TriState
      • WeakEventController
      • WindowsEdition
      • WindowsFeatureStatus
      • YamlDotNetExtensions
    • Neon.Cryptography
      • AesCipher
      • CryptoExtensions
      • CryptoHelper
      • NeonVault
      • Wildcard
    • Neon.Csv
      • CsvReader
      • CsvTableReader
      • CsvTableWriter
      • CsvWriter
    • Neon.Data
      • DateTimeJsonConverter
      • DateTimeOffsetJsonConverter
      • IEnhancedJsonConverter
      • IGeneratedServiceClient
      • IPersistableType
      • IPersistableType<T>
      • IRoundtripData
      • IntegerEnumConverter<TEnum>
      • NotifyPropertyChanged
      • RoundtripDataFactory
      • RoundtripDataHelper
      • TimeSpanJsonConverter
      • VersionJsonConverter
    • Neon.Deployment
      • AwsCli
      • DeploymentException
      • DeploymentHelper
      • DownloadManifest
      • DownloadPart
      • DownloadProgressDelegate
      • DownloadProgressType
      • GitHub
      • GitHubActionsApi
      • GitHubPackage
      • GitHubPackageApi
      • GitHubPackageType
      • GitHubPackageVersion
      • GitHubPackageVisibility
      • GitHubReleaseApi
      • GitHubRepoPath
      • GitHubTagApi
      • IProfileClient
      • IProfileRequest
      • IProfileResponse
      • MaintainerProfile
      • NotifyClient
      • OnePassword
      • OnePasswordException
      • ProfileException
      • ProfileHandlerResult
      • ProfileRequest
      • ProfileResponse
      • ProfileServer
      • ProfileStatus
      • XenServer
    • Neon.Deployment.CodeSigning
      • AzureProfile
      • CodeSigner
      • UsbTokenProfile
    • Neon.Diagnostics
      • AssertException
      • ConfigExtensions
      • ConsoleJsonLogExporter
      • ConsoleJsonLogExporterOptions
      • ConsoleTextLogExporter
      • ConsoleTextLogExporterOptions
      • ExceptionInfo
      • FileLogExporter
      • FileLogExporterFormat
      • FileLogExporterOptions
      • LogAsTraceProcessor
      • LogAsTraceProcessorOptions
      • LogAttributeNames
      • LogAttributes
      • LogEvent
      • LogEventInterceptor
      • LoggerExtensions
      • NullLogger
      • TelemetryHub
      • TelemetrySpanEventNames
      • TelemetrySpanExtensions
    • Neon.Docker
      • DockerClient
      • DockerNetwork
      • DockerNetworkContainer
      • DockerNetworkIpam
      • DockerNode
      • DockerNodeManagerStatus
      • DockerResponse
      • DockerSettings
      • DockerVolume
      • NetworkCreateResponse
      • ServiceBindOptions
      • ServiceConfig
      • ServiceContainerSpec
      • ServiceCredentialSpec
      • ServiceDetails
      • ServiceDiscreteResourceSpec
      • ServiceDnsConfig
      • ServiceEndpoint
      • ServiceEndpointMode
      • ServiceEndpointPortConfig
      • ServiceEndpointSpec
      • ServiceFile
      • ServiceGenericResources
      • ServiceGlobalSchedulingMode
      • ServiceHealthCheck
      • ServiceIsolationMode
      • ServiceListResponse
      • ServiceLogDriver
      • ServiceMode
      • ServiceMount
      • ServiceMountBindPropagation
      • ServiceMountConsistency
      • ServiceMountType
      • ServiceNamedResourceSpec
      • ServiceNetwork
      • ServicePlacement
      • ServicePlacementPreferences
      • ServicePlacementSpreadSettings
      • ServicePlatform
      • ServicePortMode
      • ServicePortProtocol
      • ServicePrivileges
      • ServiceReplicatedSchedulingMode
      • ServiceResourceSettings
      • ServiceResources
      • ServiceRestartCondition
      • ServiceRestartPolicy
      • ServiceRollbackConfig
      • ServiceRollbackFailureAction
      • ServiceRollbackOrder
      • ServiceSELinuxContext
      • ServiceSchedulingMode
      • ServiceSecret
      • ServiceSpec
      • ServiceTaskTemplate
      • ServiceTmpfsOptions
      • ServiceUpdateConfig
      • ServiceUpdateFailureAction
      • ServiceUpdateOrder
      • ServiceUpdateState
      • ServiceUpdateStatus
      • ServiceVersion
      • ServiceVirtualIP
      • ServiceVolumeDriverConfig
      • ServiceVolumeOptions
      • VolumeListResponse
    • Neon.GitHub
      • GitExtensions
      • GitHubCredentials
      • GitHubRepo
      • LocalRepoApi
      • NoLocalRepositoryException
      • RemoteRepoApi
      • RemoteRepoBranchApi
      • RemoteRepoIssueApi
      • RemoteRepoIssueCommentApi
      • RemoteRepoPath
      • RemoteRepoReleaseApi
      • RemoteRepoTagApi
    • Neon.HyperV
      • HyperVClient
      • HyperVDriverType
      • HyperVException
      • NetAdapter
      • VirtualDrive
      • VirtualIPAddress
      • VirtualMachine
      • VirtualMachineNetworkAdapter
      • VirtualMachineState
      • VirtualNat
      • VirtualSwitch
      • VirtualSwitchType
    • Neon.IO
      • BlockStream
      • FixedLengthStream
      • IStaticDirectory
      • IStaticFile
      • LineEnding
      • LinuxPath
      • LinuxPermissions
      • PreprocessReader
      • RelayStream
      • StaticDirectoryBase
      • StaticFileBase
      • SubStream
      • TempFile
      • TempFolder
    • Neon.JsonConverters
      • JsonDateTimeConverter
      • JsonGenericConverter<T>
      • JsonNullableDateTimeConverter
    • Neon.ModelGen
      • ActionResult<T>
      • ApiVersion
      • ApiVersionAttribute
      • BodyStreamAttribute
      • ControllerValidationAttribute
      • DataModelAttribute
      • EnumMember
      • FromBodyAttribute
      • FromHeaderAttribute
      • FromQueryAttribute
      • FromRouteAttribute
      • GeneratedClientAttribute
      • GeneratedMethodAttribute
      • GeneratedParamAttribute
      • HashSourceAttribute
      • HttpAttribute
      • HttpDeleteAttribute
      • HttpGetAttribute
      • HttpHeadAttribute
      • HttpOptionsAttribute
      • HttpPatchAttribute
      • HttpPostAttribute
      • HttpPutAttribute
      • IActionResult
      • ModelGenerator
      • ModelGeneratorOutput
      • ModelGeneratorSettings
      • NoCodeGenAttribute
      • NoControllerValidationAttribute
      • PassAs
      • PersistableAttribute
      • PersistableKeyAttribute
      • RouteAttribute
      • ServiceModelAttribute
      • TargetAttribute
      • UxFrameworks
    • Neon.Net
      • HttpApiException
      • HttpException
      • JsonClient
      • JsonClientPayload
      • JsonResponse
      • Jwt
      • LocalHostSection
      • NetConst
      • NetHelper
      • NetworkCidr
      • NetworkConfiguration
      • NetworkException
      • NetworkPorts
      • Pinger
      • ReachableHost
      • ReachableHostMode
      • StreamDocument
    • Neon.Postgres
      • ConnectionExtensions
      • DatabaseStatus
      • PreparedCommand
      • ReaderAsyncEnumerator
      • ReaderEnumerator
      • ReaderExtensions
      • SchemaManager
      • SchemaManagerException
      • SchemaStatus
    • Neon.Retry
      • ExponentialRetryPolicy
      • IRetryPolicy
      • LinearRetryPolicy
      • NoRetryPolicy
      • RetryPolicy
      • RetryPolicyBase
      • RetryTransientArgs
      • TransientDetector
      • TransientException
    • Neon.Roslyn
      • DisplayFormat
      • DocumentationComment
      • DocumentationItem
      • MetadataLoadContext
      • RoslynAssembly
      • RoslynConstructorInfo
      • RoslynCustomAttributeData
      • RoslynExtensions
      • RoslynFieldInfo
      • RoslynMethodInfo
      • RoslynParameterInfo
      • RoslynPropertyInfo
      • RoslynType
      • SharedUtilities
    • Neon.Roslyn.Xunit
      • AdditionalSourceText
      • CompilationOptions
      • CompilationOptionsProvider
      • TestCompilation
      • TestCompilationAssertions
      • TestCompilationBuilder
      • TestCompilationBuilderExtensions
      • TestCompilationExtensions
    • Neon.SSH
      • CommandBundle
      • CommandFile
      • CommandResponse
      • HostFolders
      • IBashCommandFormatter
      • ILinuxSshProxy
      • LinuxDiskInfo
      • LinuxDiskPartition
      • LinuxSshProxy
      • LinuxSshProxy<TMetadata>
      • NamespaceDoc
      • RemoteCommandException
      • RunOptions
      • SshCredentials
      • SshExtensions
      • SshProxyException
    • Neon.Service
      • LogMetricsProcessor
      • MetricsMode
      • MetricsOptions
      • NeonService
      • NeonServiceOptions
      • NeonServiceStatus
      • OtelConfigExtensions
      • OtlpCollectorChecker
      • ProcessTerminator
      • ServiceApiContact
      • ServiceApiInfo
      • ServiceApiLicense
      • ServiceDependencies
      • ServiceDescription
      • ServiceEndpoint
      • ServiceEndpointProtocol
      • ServiceEndpoints
      • ServiceMap
    • Neon.SignalR
      • DependencyInjectionExtensions
      • DnsCache
      • GroupAction
      • GroupCommand
      • IDnsCache
      • Invocation
      • NatsHubLifetimeManager<THub>
      • ProxyConfig
      • ServiceCollectionExtensions
      • ServiceDiscovey
      • SignalrProxyMiddleware
      • SignalrProxyMiddlewareExtensions
      • TracerProviderBuilderExtensions
    • Neon.Tailwind
      • ClickOffEventHandler
      • ComponentEventArgs<TSender>
      • ComponentEventArgs<TSender, TEventArgs>
      • DisclosureState
      • EventHandlerComponentBase<TComponent>
      • HeadlessButton
      • HeadlessDialog
      • HeadlessDialogPanel
      • HeadlessDisclosure
      • HeadlessDisclosureButton
      • HeadlessDisclosurePanel
      • HeadlessListboxButton<TValue>
      • HeadlessListboxLabel<TValue>
      • HeadlessListboxOption<TValue>
      • HeadlessListboxOptions<TValue>
      • HeadlessListbox<TValue>
      • HeadlessMenu
      • HeadlessMenuButton
      • HeadlessMenuItem
      • HeadlessMenuItems
      • HeadlessSwitch
      • HeadlessSwitchGroup
      • HeadlessSwitchLabel
      • IPortalBinder
      • KeyDownEventHandler
      • KeyboardKey
      • ListboxFocus
      • ListboxState
      • MenuFocus
      • MenuState
      • Portal
      • PortalBinder
      • PortalContent
      • SearchAssistant
      • TailwindExtensions
      • Transition
      • TransitionGroup
      • TransitionState
    • Neon.Tasks
      • Async
      • AsyncAutoResetEvent
      • AsyncManualResetEvent
      • AsyncMutex
      • AsyncPeriodicTask
      • AsyncReaderWriterLock
      • AsyncReentrantMutex
      • AsyncTimer
      • IAsyncFuture
      • IAsyncFuture<T>
      • NonDisposableTask
      • NonDisposableTask<T>
      • SyncContext
      • SyncContextMode
    • Neon.Temporal
      • ActivityHelper
      • ActivityLogEnricher
      • TemporalEnricherTagNames
      • WorkflowLogEnricher
    • Neon.Time
      • GatedTimer
      • GoDuration
      • PolledTimer
      • RecurringTimer
      • RecurringTimerType
      • SysTime
      • TimeOfDay
    • Neon.WSL
      • Wsl2Proxy
    • Neon.Web
      • AesProtector
      • DataProtectionExtensions
      • NeonController
      • NeonControllerBase
      • RoundTripJsonInputFormatter
      • RoundTripJsonOutputFormatter
      • TracerProviderBuilderExtensions
      • WebHelper
    • Neon.WinTTY
      • ConsoleTTY
    • Neon.Windows
      • MEMORYSTATUSEX
      • PowerShellException
      • Win32
    • Neon.XenServer
      • IXenClient
      • XenClient
      • XenClient.MachineOperations
      • XenClient.StorageOperations
      • XenClient.TemplateOperations
      • XenException
      • XenHostInfo
      • XenObject
      • XenResponse
      • XenStorageRepository
      • XenTempIso
      • XenTemplate
      • XenVirtualDisk
      • XenVirtualMachine
      • XenVmPowerState
    • Neon.Xunit
      • AnsiblePlayResults
      • AnsiblePlayer
      • AnsibleTaskResult
      • AspNetFixture
      • BasicFixture
      • CodeFixture
      • CollectionComparer<T>
      • ComposedFixture
      • ContainerFixture
      • ContainerLimits
      • DockerComposeFixture
      • DockerFixture
      • DockerFixture.ConfigInfo
      • DockerFixture.ContainerInfo
      • DockerFixture.NetworkInfo
      • DockerFixture.SecretInfo
      • DockerFixture.ServiceInfo
      • DockerFixture.StackDefinition
      • DockerFixture.StackInfo
      • DockerFixture.StackService
      • EnvironmentFixture
      • HostsFixture
      • ITestFixture
      • IncompatibleServiceException
      • MaintainerFactAttribute
      • MaintainerTheoryAttribute
      • MockHttpServer
      • MockHttpServerExtensions
      • NatsFixture
      • NatsStreamingFixture
      • NeonServiceFixture<TService>
      • PlatformFactAttribute
      • RepeatAttribute
      • TargetPlatforms
      • TestArea
      • TestCollection
      • TestContext
      • TestFixture
      • TestFixtureStatus
      • TestHelper
      • TestHttpClient
      • TestOutputWriter
      • TestTrait
      • XunitExtensions
    • Neon.Xunit.YugaByte
      • YugaByteFixture
    • Neon.YugaByte
      • YugaByteHelper

    Struct GoDuration

    Implements support for GO Language formatted durations. This class is useful for integrating with GO applications.

    Namespace: Neon.Time
    Assembly: Neon.Common.dll
    Syntax
    public struct GoDuration
    Remarks
    note

    GoDuration measures time down 1 nanosecond resolution whereas TimeSpan's resolution is 100ns and both implementations use a signed 64-bit integer as the underlying representation. This means that GoDuration can represent of maximum duration of about 290 years (positive and negative) where TimeSpan can handle about 29,000 years.

    This class will throw a ArgumentOutOfRangeException when converting a TimeSpan that is beyound the capability of a GoDuration.

    Constructors

    GoDuration(long)

    Constructs a GoDuration from nanoseconds.

    Declaration
    public GoDuration(long nanoseconds)
    Parameters
    Type Name Description
    long nanoseconds

    The duration in nanoseconds.

    GoDuration(TimeSpan)

    Constructs an instance from a TimeSpan.

    Declaration
    public GoDuration(TimeSpan timespan)
    Parameters
    Type Name Description
    TimeSpan timespan

    The time span.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if the input is outside the capability of a GoDuration.

    Fields

    PartialRegEx

    The partial regular expression that can be used to validate GOLANG duration strings. This does not include the start/end anchors and is suitable for situations where these are implied.

    Declaration
    public const string PartialRegEx = "0|(((\\d+(\\.\\d+)?h)(\\d+(\\.\\d+)?m)?(\\d+(\\.\\d+)?s)?(\\d+(\\.\\d+)?ms)?((\\d+(\\.\\d+)?us)|(\\d+(.\\d+)?µs))?(\\d+(\\.\\d+)?ns)?)|((\\d+(\\.\\d+)?h)?(\\d+(\\.\\d+)?m)(\\d+(\\.\\d+)?s)?(\\d+(\\.\\d+)?ms)?((\\d+(\\.\\d+)?us)|(\\d+(.\\d+)?µs))?(\\d+(\\.\\d+)?ns)?)|((\\d+(\\.\\d+)?h)?(\\d+(\\.\\d+)?m)?(\\d+(\\.\\d+)?s)(\\d+(\\.\\d+)?ms)?((\\d+(\\.\\d+)?us)|(\\d+(.\\d+)?µs))?(\\d+(\\.\\d+)?ns)?)|((\\d+(\\.\\d+)?h)?(\\d+(\\.\\d+)?m)?(\\d+(\\.\\d+)?s)?(\\d+(\\.\\d+)?ms)((\\d+(\\.\\d+)?us)|(\\d+(.\\d+)?µs))?(\\d+(\\.\\d+)?ns)?)|((\\d+(\\.\\d+)?h)?(\\d+(\\.\\d+)?m)?(\\d+(\\.\\d+)?s)?(\\d+(\\.\\d+)?ms)?((\\d+(\\.\\d+)?us)|(\\d+(.\\d+)?µs))(\\d+(\\.\\d+)?ns)?)|((\\d+(\\.\\d+)?h)?(\\d+(\\.\\d+)?m)?(\\d+(\\.\\d+)?s)?(\\d+(\\.\\d+)?ms)?((\\d+(\\.\\d+)?us)|(\\d+(.\\d+)?µs))?(\\d+(\\.\\d+)?ns)))"
    Field Value
    Type Description
    string

    RegEx

    The full regular expression (including start/end anchors) use to validate GOLANG duration strings.

    Declaration
    public const string RegEx = "^(0|(((\\d+(\\.\\d+)?h)(\\d+(\\.\\d+)?m)?(\\d+(\\.\\d+)?s)?(\\d+(\\.\\d+)?ms)?((\\d+(\\.\\d+)?us)|(\\d+(.\\d+)?µs))?(\\d+(\\.\\d+)?ns)?)|((\\d+(\\.\\d+)?h)?(\\d+(\\.\\d+)?m)(\\d+(\\.\\d+)?s)?(\\d+(\\.\\d+)?ms)?((\\d+(\\.\\d+)?us)|(\\d+(.\\d+)?µs))?(\\d+(\\.\\d+)?ns)?)|((\\d+(\\.\\d+)?h)?(\\d+(\\.\\d+)?m)?(\\d+(\\.\\d+)?s)(\\d+(\\.\\d+)?ms)?((\\d+(\\.\\d+)?us)|(\\d+(.\\d+)?µs))?(\\d+(\\.\\d+)?ns)?)|((\\d+(\\.\\d+)?h)?(\\d+(\\.\\d+)?m)?(\\d+(\\.\\d+)?s)?(\\d+(\\.\\d+)?ms)((\\d+(\\.\\d+)?us)|(\\d+(.\\d+)?µs))?(\\d+(\\.\\d+)?ns)?)|((\\d+(\\.\\d+)?h)?(\\d+(\\.\\d+)?m)?(\\d+(\\.\\d+)?s)?(\\d+(\\.\\d+)?ms)?((\\d+(\\.\\d+)?us)|(\\d+(.\\d+)?µs))(\\d+(\\.\\d+)?ns)?)|((\\d+(\\.\\d+)?h)?(\\d+(\\.\\d+)?m)?(\\d+(\\.\\d+)?s)?(\\d+(\\.\\d+)?ms)?((\\d+(\\.\\d+)?us)|(\\d+(.\\d+)?µs))?(\\d+(\\.\\d+)?ns))))$"
    Field Value
    Type Description
    string

    TicksPerHour

    The number of nanosecond ticks per minute.

    Declaration
    public const long TicksPerHour = 3600000000000
    Field Value
    Type Description
    long

    TicksPerMicrosecond

    The number of nanosecond ticks per micrososecond.

    Declaration
    public const long TicksPerMicrosecond = 1000
    Field Value
    Type Description
    long

    TicksPerMillisecond

    The number of nanosecond ticks per millisecond.

    Declaration
    public const long TicksPerMillisecond = 1000000
    Field Value
    Type Description
    long

    TicksPerMinute

    The number of nanosecond ticks per minute.

    Declaration
    public const long TicksPerMinute = 60000000000
    Field Value
    Type Description
    long

    TicksPerSecond

    The number of nanosecond ticks per second;

    Declaration
    public const long TicksPerSecond = 1000000000
    Field Value
    Type Description
    long

    Properties

    Hours

    Returns the hours component of the duration.

    Declaration
    public long Hours { get; }
    Property Value
    Type Description
    long

    MaxValue

    Returns the maximum possible GoDuration.

    Declaration
    public static GoDuration MaxValue { get; }
    Property Value
    Type Description
    GoDuration

    Microseconds

    Returns the microsecond component of the duration.

    Declaration
    public long Microseconds { get; }
    Property Value
    Type Description
    long

    Milliseconds

    Returns the millisecond component of the duration.

    Declaration
    public long Milliseconds { get; }
    Property Value
    Type Description
    long

    MinValue

    Returns the minimum possible GoDuration.

    Declaration
    public static GoDuration MinValue { get; }
    Property Value
    Type Description
    GoDuration

    Minutes

    Returns the minutes component of the duration.

    Declaration
    public long Minutes { get; }
    Property Value
    Type Description
    long

    Nanoseconds

    Returns the nanosecond component of the duration.

    Declaration
    public long Nanoseconds { get; }
    Property Value
    Type Description
    long

    Seconds

    Returns the second component of the duration.

    Declaration
    public long Seconds { get; }
    Property Value
    Type Description
    long

    Ticks

    The duration expressed as nanosecond ticks.

    Declaration
    public readonly long Ticks { get; }
    Property Value
    Type Description
    long

    TimeSpan

    Returns the equivalent TimeSpan.

    Declaration
    public TimeSpan TimeSpan { get; }
    Property Value
    Type Description
    TimeSpan

    TotalHours

    Returns the total number of hours.

    Declaration
    public double TotalHours { get; }
    Property Value
    Type Description
    double

    TotalMicroseconds

    Returns the total number of microseconds.

    Declaration
    public double TotalMicroseconds { get; }
    Property Value
    Type Description
    double

    TotalMilliseconds

    Returns the total number of milliseconds.

    Declaration
    public double TotalMilliseconds { get; }
    Property Value
    Type Description
    double

    TotalMinutes

    Returns the total number of minutes.

    Declaration
    public double TotalMinutes { get; }
    Property Value
    Type Description
    double

    TotalNanoseconds

    Returns the duration as nanoseconds.

    Declaration
    public double TotalNanoseconds { get; }
    Property Value
    Type Description
    double

    TotalSeconds

    Returns the total number of seconds.

    Declaration
    public double TotalSeconds { get; }
    Property Value
    Type Description
    double

    Zero

    Returns a zero GoDuration .

    Declaration
    public static GoDuration Zero { get; }
    Property Value
    Type Description
    GoDuration

    Methods

    FromHours(double)

    Returns a GoDuration from hours.

    Declaration
    public static GoDuration FromHours(double hours)
    Parameters
    Type Name Description
    double hours

    The duration in hours.

    Returns
    Type Description
    GoDuration

    The new GoDuration.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if the input is outside the capability of a GoDuration.

    FromMicroseconds(double)

    Returns a GoDuration from microseconds.

    Declaration
    public static GoDuration FromMicroseconds(double milliseconds)
    Parameters
    Type Name Description
    double milliseconds

    The duration in microseconds.

    Returns
    Type Description
    GoDuration

    The new GoDuration.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if the input is outside the capability of a GoDuration.

    FromMilliseconds(double)

    Returns a GoDuration from milliseconds.

    Declaration
    public static GoDuration FromMilliseconds(double milliseconds)
    Parameters
    Type Name Description
    double milliseconds

    The duration in milliseconds.

    Returns
    Type Description
    GoDuration

    The new GoDuration.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if the input is outside the capability of a GoDuration.

    FromMinutes(double)

    Returns a GoDuration from minutes.

    Declaration
    public static GoDuration FromMinutes(double minutes)
    Parameters
    Type Name Description
    double minutes

    The duration in minutes.

    Returns
    Type Description
    GoDuration

    The new GoDuration.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if the input is outside the capability of a GoDuration.

    FromNanoseconds(long)

    Returns a GoDuration from nanoseconds.

    Declaration
    public static GoDuration FromNanoseconds(long nanoseconds)
    Parameters
    Type Name Description
    long nanoseconds

    The duration in nanoseconds.

    Returns
    Type Description
    GoDuration

    The new GoDuration.

    FromSeconds(double)

    Returns a GoDuration from seconds.

    Declaration
    public static GoDuration FromSeconds(double seconds)
    Parameters
    Type Name Description
    double seconds

    The duration in seconds.

    Returns
    Type Description
    GoDuration

    The new GoDuration.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if the input is outside the capability of a GoDuration.

    FromTimeSpan(TimeSpan)

    Creates a GoDuration from a TimeSpan.

    Declaration
    public static GoDuration FromTimeSpan(TimeSpan timespan)
    Parameters
    Type Name Description
    TimeSpan timespan

    The input time span.

    Returns
    Type Description
    GoDuration

    The new GoDuration.

    Parse(string)

    Parses a GoDuration from a string.

    Declaration
    public static GoDuration Parse(string input)
    Parameters
    Type Name Description
    string input

    The input string.

    Returns
    Type Description
    GoDuration

    The parsed GoDuration.

    Remarks

    The input is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".

    note

    null or empty strings are parsed as Zero.

    note

    GO timespans are limited to about 290 years (the maximum number of nanoseconds that can be represented in a signed 64-bit integer).

    Exceptions
    Type Condition
    FormatException

    Thrown if the input is not valid.

    ToPretty()

    Renders the duration into a string including hour, minute, and seconds with fractions as required, avoiding millisecond, microsecond, and nanosecond units.

    Declaration
    public string ToPretty()
    Returns
    Type Description
    string

    The pretty string.

    ToString()

    Renders the time span as a GO Duration compatible string.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    The GO duration.

    Overrides
    ValueType.ToString()

    TryParse(string, out GoDuration)

    Attempts to parse a GO formatted timespan.

    Declaration
    public static bool TryParse(string input, out GoDuration goTimeSpan)
    Parameters
    Type Name Description
    string input

    The input string.

    GoDuration goTimeSpan

    Returns as the parsed timespan on success.

    Returns
    Type Description
    bool

    true on success.

    Remarks

    The input is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".

    note

    GO timespans are limited to about 290 years (the maximum number of nanoseconds that can be represented in a signed 64-bit integer).

    Operators

    implicit operator TimeSpan(GoDuration)

    Implicitly converts a GoDuration into a TimeSpan.

    Declaration
    public static implicit operator TimeSpan(GoDuration goTimeSpan)
    Parameters
    Type Name Description
    GoDuration goTimeSpan

    The input GoDuration.

    Returns
    Type Description
    TimeSpan

    The equivalent TimeSpan.

    implicit operator GoDuration(TimeSpan)

    Implicitly converts a TimeSpan into a GoDuration.

    Declaration
    public static implicit operator GoDuration(TimeSpan timespan)
    Parameters
    Type Name Description
    TimeSpan timespan

    The input TimeSpan.

    Returns
    Type Description
    GoDuration

    The equivalent GoDuration.

    In this article
    Back to top © Copyright 2005-2023 by NEONFORGE LLC