Send feedback on this topic.
Teradata.Client.Provider
TdIntervalSecond Constructor(Int32,Int32,Byte,Byte)



Teradata.Client.Provider Namespace > TdIntervalSecond Structure > TdIntervalSecond Constructor : TdIntervalSecond Constructor(Int32,Int32,Byte,Byte)
Number of seconds.
The fractional number of seconds.
Number of significant digits of the second.
The number of decimal places for the second.
An instance of TdIntervalSecond is created from time components specified as integers while precision and scale components are specified as bytes.
Syntax
'Declaration
 
Public Function New( _
   ByVal seconds As Integer, _
   ByVal microseconds As Integer, _
   ByVal precision As Byte, _
   ByVal scale As Byte _
)
'Usage
 
Dim seconds As Integer
Dim microseconds As Integer
Dim precision As Byte
Dim scale As Byte
 
Dim instance As New TdIntervalSecond(seconds, microseconds, precision, scale)
public TdIntervalSecond( 
   int seconds,
   int microseconds,
   byte precision,
   byte scale
)
public:
TdIntervalSecond( 
   int seconds,
   int microseconds,
   byte precision,
   byte scale
)

Parameters

seconds
Number of seconds.
microseconds
The fractional number of seconds.
precision
Number of significant digits of the second.
scale
The number of decimal places for the second.
Exceptions
ExceptionDescription
The parameters specify a TdIntervalSecond value less than TdIntervalSecond.MinValue or greater than TdIntervalSecond.MaxValue.
The precision or scale parameters are outside the minimum or maximum range of values.
The precision parameter is not large enough to represent the number of seconds.
Remarks

The number of seconds and microseconds are constructed into a TdIntervalSecond. The microseconds parameter represents 10 ^-6 seconds and the microsecond parameter is divided by 10^-6 (.000001) to create a fractional number of seconds. The supplied scale is used to used to truncate any fractional seconds at the position indicated by the scale.

For example, a microseconds value of 12345678 and a scale of 6 will be divided by 10^-6 and truncated at the 6th position resulting in a value of .123456. A microseconds value of 123 and a scale of 6 will result in a value of .000123.

All values are constructed into a TdIntervalSecond to determine if the TdIntervalSecond.MinValue or the TdIntervalSecond.MaxValue values are exceeded. If the values are not exceeded but the resulting seconds component exceeds the supplied precision value, an exception is generated.

For example a constructor for TdIntervalSecond(444, 90, 2, 6) requests 444 seconds and 90 microseconds with a precision of 2 and a scale of 6. The resulting TdIntervalSecond literal value of '444.000090' contains a seconds value which cannot be represented in 2 digits. Therefore an exception is generated, even though the MinValue and the MaxValue values have not been exceeded.

Negative constructor parameters may be supplied to represent negative durations of time. Mixed positive and negative constructor parameters are added together that result in a negative or positive TdIntervalSecond. For instance, a second value of -4900, a microsecond value of 30, a second precision of 4 and a scale of 6 will result in a TdIntervalSecond interval value of -'4899.000070'.

Requirements

Target Platforms: Windows 8.1, Windows 10, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019

See Also

Reference

TdIntervalSecond Structure
TdIntervalSecond Members
Overload List