Table of Contents

CLOCK_HOUR

X16

Defined in X16.BAS.

Returns the hour portion of the current date/time, a number between 0 and 23.

Function header

FUNCTION CLOCK_HOUR AS BYTE () SHARED STATIC

Example

INCLUDE "x16.bas"

DIM k AS BYTE
DECLARE FUNCTION PAD$ AS STRING * 2 (num AS BYTE) STATIC

' Set clock to 2022-12-30 12:56:00
CALL SETCLOCK(122, 12, 30, 12, 56, 0)

PRINT "{CLR}"
PRINT "displaying clock. press any key to exit"
  
DO
  PRINT "{HOME}"; PAD$(CLOCK_HOUR());
  PRINT ":"; PAD$(CLOCK_MIN());
  PRINT ":"; PAD$(CLOCK_SEC());
  GET k
LOOP WHILE k = 0

FUNCTION PAD$ AS STRING * 2 (num AS BYTE) STATIC
  IF num > 9 THEN RETURN STR$(num)
  RETURN "0" + STR$(num)
END FUNCTION

See also