asetime

package
v0.0.0-...-b779cef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package asetime is used to convert golang data type duration to defined ASE data type duration and the other way around.

The types, functions, and variables/constants defined in this package are mainly used in asetype/goValue.go as well as in asetype/bytes.go.

Index

Constants

View Source
const (
	Microsecond ASEDuration = 1
	Millisecond             = 1000 * Microsecond
	Second                  = 1000 * Millisecond
	Minute                  = 60 * Second
	Hour                    = 60 * Minute
	Day                     = 24 * Hour
)

Base time-units in reference to ASEDuration.

Variables

This section is empty.

Functions

func Epoch1753

func Epoch1753() time.Time

Epoch1753 returns the reference date of 01.01.1753 as the minimum date value for a datetime on a SQL Server.

func Epoch1900

func Epoch1900() time.Time

Epoch1900 returns the reference date of 01.01.1900 that is required for asetype 'DATE', 'SHORTDATE', and 'DATETIME'.

func EpochRataDie

func EpochRataDie() time.Time

EpochRataDie returns the reference date of Rata Die that is required for asetype 'BIGTIMEN'.

func MicrosecondsToTime

func MicrosecondsToTime(microseconds uint64) time.Time

MicrosecondsToTime takes the number of microseconds since time.Time{} and calculates the appropriate time.Time.

func MillisecondToFractionalSecond

func MillisecondToFractionalSecond(s int) int

MillisecondToFractionalSecond returns milliseconds as fractional second.

func TimeToMicroseconds

func TimeToMicroseconds(date time.Time) uint64

TimeToMicroseconds converts a time.Time into the number of microseconds elapsed since time.Time{}.

Types

type ASEDuration

type ASEDuration int

ASEDuration is the reference time-unit as microseconds.

func DurationAsASEDuration

func DurationAsASEDuration(d time.Duration) ASEDuration

DurationAsASEDuration returns type time.Duration as type ASEDuration.

func DurationFromDateTime

func DurationFromDateTime(t time.Time) ASEDuration

DurationFromDateTime returns duration based on passed time.Time.

func DurationFromTime

func DurationFromTime(t time.Time) ASEDuration

DurationFromTime returns duration based on passed time.Time.

func FractionalSecondToMillisecond

func FractionalSecondToMillisecond(s int) ASEDuration

FractionalSecondToMillisecond returns a fractional second as millisecond.

func (ASEDuration) Days

func (d ASEDuration) Days() int

Days returns duration in days.

func (ASEDuration) Hours

func (d ASEDuration) Hours() int

Hours returns duration in hours.

func (ASEDuration) Microseconds

func (d ASEDuration) Microseconds() int

Microseconds returns duration in microseconds.

func (ASEDuration) Milliseconds

func (d ASEDuration) Milliseconds() int

Milliseconds returns duration in milliseconds.

func (ASEDuration) Minutes

func (d ASEDuration) Minutes() int

Minutes returns duration in minutes.

func (ASEDuration) Seconds

func (d ASEDuration) Seconds() int

Seconds returns duration in seconds.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL