The hardware clock is not present on all devices, but time/date mathematics is available on all platforms.

Time

clockSupported View Source

Returns whether the clock is supported.

Outputs

A

Preserved on success; error code on failure

Z

Set when the clock is supported; reset otherwise

convertTimeFromTicks View Source

Convert from ticks in seconds to time. The epoch is January 1st, 1997 (a Wednesday).

Inputs

DE

Upper word of tick value

HL

Lower word of tick value

Outputs

A

Day of the week, from 0-6 with 0 being Sunday

IX

Current year

C

Current minute (0-59)

B

Current hour, from 0-23

E

Garbage

D

Current second (0-59)

H

Current day, from 0-30

L

Current month, from 0-11

Notes

As of now, only the time is output correctly.

convertTimeToTicks View Source

Converts a time structure to seconds since epoch.

Inputs

IX

Current year

C

Current minute (0-59)

B

Current hour (0-23)

D

Current second (0-59)

H

Current day (0-30)

L

Current month (0-11)

Outputs

DE

Upper word of tick value

HL

Lower word of tick value

getClock View Source

Gets the internal clock.

Outputs

A

Preserved on success, error code on failure

Z

Set on success, reset on failure

DE

Upper word of the 32-bit tick value

HL

Lower word of the 32-bit tick value

getTime View Source

Gets the current time.

Outputs

A

Day of the week, from 0-6 with 0 being Sunday

IX

Current year

C

Current minute (0-59)

B

Current hour (0-23)

D

Current second (0-59)

H

Current day (0-30)

L

Current month (0-11)

isLeapYear View Source

Determines whether the given year is a leap year.

Inputs

HL

The year

Outputs

A

1 if it is a leap year; 0 if it is not

monthLength View Source

Computes the amount of days in a given month.

Inputs

E

The month (0-11)

HL

The year

Outputs

A

The amount of days in this month

setClock View Source

Sets the internal clock.

Inputs

DE

Upper word of a 32-bit tick value

HL

Lower word of a 32-bit tick value

Outputs

A

Preserved on success, error code on failure

Z

Set on success, reset on failure