Basics
Guides
API Reference
Basics
Guides
API Reference
[15:7] extends: object
GTimer records a start time, and counts microseconds elapsed since that
time. This is done somewhat differently on different platforms, and can be
tricky to get exactly right, so GTimer provides a portable/convenient
interface.
GTimer (Handle = null)
Creates a new
Timerby wrapping a native handle or another wrapper.
Handle is the native handle or another wrapper whose handle to adopt.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.FnContinue ()
Resumes a timer that has previously been stopped with g_timer_stop(). g_timer_stop() must be called before using this function.
None.destroy ()
Destroys a timer, freeing associated resources.
None.elapsed (int microseconds)
If @timer has been started but not stopped, obtains the time since the timer was started. If @timer has been stopped, obtains the elapsed time between the time it was started and the time it was stopped. The return value is the number of seconds elapsed, including any fractional part. The @microseconds out parameter is essentially useless.
microseconds is return location for the fractional part of seconds elapsed, in microseconds (that is, the total number of microseconds elapsed, modulo 1000000), or %NULL.seconds elapsed as a floating point value, including any fractional part..is_active ()
Exposes whether the timer is currently active.
%TRUE if the timer is running, %FALSE otherwise.reset ()
This function is useless; it's fine to call g_timer_start() on an already-started timer to reset the start time, so g_timer_reset() serves no purpose.
None.start ()
Marks a start time, so that future calls to g_timer_elapsed() will report the time since g_timer_start() was called. g_timer_new() automatically marks the start time, so no need to call g_timer_start() immediately after creating the timer.
None.stop ()
Marks an end time, so calls to g_timer_elapsed() will return the difference between this end time and the start time.
None.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.