Skip to content

Microseconds

Narta Xaymar Dirks edited this page Oct 27, 2026 · 6 revisions
BlitzLLVM

Microseconds 〔BlitzLLVM〕

Microseconds:UInt64

Returns: A number of microseconds that keeps growing while the program runs, as a UInt64. It does not wrap around like MilliSecs does, and its start is not fixed, so use the difference between two calls to measure time.

Description

〔BlitzLLVM〕 This command does not exist in the original Blitz products. BlitzLLVM adds it.

Like MilliSecs, but counts microseconds (millionths of a second) and returns a UInt64, because the count needs far more than 32 bits. This is a BlitzLLVM extension: the originals only have MilliSecs.

  • Keep the result in a variable declared with :UInt64 (for example start:UInt64 = Microseconds()). A variable with no type or with % is an Int, which keeps only the lowest 32 bits and may come out negative; # is a Float, which rounds.
  • Str and Print write all digits, and an expression with a UInt64 and an Int is calculated as a UInt64, so Microseconds() - start is the elapsed time. Comparisons are unsigned, and Int() and Float() convert the value (the Int loses the upper bits).
  • The start of the count is not fixed, like MilliSecs: only differences between two calls mean something. The clock is the system clock, so it can jump when the time is set.
  • A 32-bit Int would overflow after 35 minutes, and a Float (24 bits of precision) stops counting single microseconds after 16 seconds. See Types everywhere for the other new types.

Differences

  • The value is a UInt64, which no original command returns. Assign it to a variable declared with :UInt64 to keep all of its digits, as an Int or a Float only holds part of them.

Examples

start:UInt64 = Microseconds()
Delay 50
Print Microseconds() - start >= 45000
1

Related Commands

Delay, FreeTimer, MilliSecs, WaitTimer

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally