Skip to content

time.c

time_frac

Synopsis

varargs float time_frac(int nanoseconds)

Parameters

  • int nanoseconds - The time value in nanoseconds. Defaults to the current time in nanoseconds if not provided.

Returns

float - The time value converted to a fractional value in seconds.

Description

Converts a time value from nanoseconds to a fractional value in seconds. This function takes a time value in nanoseconds and converts it to a fractional value representing seconds by dividing the input by 1,000,000,000.

time_ms

Synopsis

varargs int time_ms(int nanoseconds)

Parameters

  • int nanoseconds - The time value in nanoseconds. Defaults to the current time in nanoseconds if not provided.

Returns

int - The time value converted to milliseconds.

Description

Converts a time value from nanoseconds to milliseconds. This function takes a time value in nanoseconds and converts it to milliseconds by dividing the input by 1,000,000.

ltime

Synopsis

varargs string ltime(int x, int brief)

Parameters

  • int [x=time()] - The timestamp to format. Defaults to the current time.
  • int [brief=0] - If set to 1, returns a brief time format (HH:MM). Otherwise, returns a full time format (HH:MM:SS).

Returns

string - The formatted time string.

Description

Returns a formatted time string.

ldate

Synopsis

varargs string ldate(int x, int brief)

Parameters

  • int [x=time()] - The timestamp to format. Defaults to the current time.
  • int [brief=0] - If set to 1, returns a brief date format (MM-DD). Otherwise, returns a full date format (YYYY-MM-DD).

Returns

string - The formatted date string.

Description

Returns a formatted date string.