CX time - SkycoinWikis/CX GitHub Wiki

CX HOME » NATIVE PACKAGES » TIME

Using time in CX

To use the time-Functions you first have to import it:

import "time" 

Source Code

Table of Contents

time.Sleep

By calling this function you force the code to pause the given amount of milliseconds

time.Sleep(milliseconds_to_pause i32)
Example
//time.Sleep
////input
var milliseconds_to_pause i32 = 1000
////function call
time.Sleep(milliseconds_to_pause)

time.UnixMilli

This function returns the elapsed milliseconds since 01.01.1970 UTC

time.UnixMilli()(milliseconds_since_01011970 i64)
Example
//time.UnixMilli
////output
var milliseconds_since_01011970 i64
////function call
milliseconds_since_01011970  = time.UnixMilli()

time.UnixNano

This function returns the elapsed nanoseconds since 01.01.1970 UTC

time.UnixNano()(nanoseconds_since_01011970 i64)
Example
//time.UnixNano
////output
var nanoseconds_since_01011970 i64
////function call
nanoseconds_since_01011970  = time.UnixNano()
⚠️ **GitHub.com Fallback** ⚠️