DK-time
DK time - library for working with time
Install
Exec command
$ npm install --save dk-time
API
OOP - not used in api
Types
*Time_t
An object pointer is a data buffer
Please do not process this indicator, as the data may change at any time.
Variable | Type | Desc |
---|---|---|
id | Any_id | Id library |
is | Any_is | System library |
sec | Num_32 | Time unix seconds |
ms | Num_24u | Time milliseconds (3) |
key | Num_ty | Id setTimeOut |
repeat | Num_ty | Quantity repeat (> 0 - quantity < 0 - time in sec) |
Time_num => Num_2u
Float seconds.milliseconds (4.2)
Constants
Default library
Name | Type | Value | Desc |
---|---|---|---|
TIME_NAME | Str_std | dk-time | Name library |
TIME_KEY | Str_std | time | Key library |
TIME_ID | Any_id | 12 | Id library |
TIME_VER | Str_std | 1.0.0-pa.24 | Version library |
TIME_STD_KEY | Str_std | date | Name JS object |
Format time
Name | Type | Value | Desc |
---|---|---|---|
TIME_FV | Num_u8 | Format millisecond | |
TIME_FS | Num_u8 | Format second | |
TIME_FI | Num_u8 | Format minute | |
TIME_FH | Num_u8 | Format hour | |
TIME_FD | Num_u8 | Format day | |
TIME_FW | Num_u8 | Format week | |
TIME_FM | Num_u8 | Format month | |
TIME_FY | Num_u8 | Format year |
Functions
Normal
time_sys (): Time_num
Get system time (unix)
time_nil (): Time_s
Make empty (null) new pointer
time_new (num: Time_num): Time_s
Make new time
if sec are empty gets the current date
time_parse (date: Str_s): Time_s
Parse string date and make new Time_s
if sec are empty gets the current date
time_str (time: Time_s): Str_s
Get string for date
time_convert (time: Time_s, format: num_T8u, groups: Num_1): Str_s
Convert time by format
time_duration (time: Time_s): Str_s
get duration time
time_passed (time: Time_s): Str_s
get passed time
time_sleep (delay: Num_2u, handler: Func_s): Time_s
make setTimeout
time_repeat (quantity: Num_2u, delay: Num_3u, handler: Func_s): Time_s
make setInterval
time_stop (time: Time_s): Err_s
Stopping sleep ()setTimeout / setInterval)
time_diff (time: Time_s): Time_s
Difference old time and current
time_set (time: Time_s, num: Time_num): Err_s
Set seconds and milliseconds
time_offset (time: Time_s, num: Time_num, isNext:Bool_s): Err_s
Offset time forward or backward
time_clear (time: Time_s): Err_s
clear all data
About
Notes
- This project adheres to Semantic Versioning