clockNow function
Tree-sitter 0.25.10 clock_now, adapted to Dart's monotonic stopwatch.
Implementation
TSClock clockNow() {
// Reserve the all-zero pair for `clock_null`, as the native monotonic clock
// does in practice. Microsecond resolution is sufficient because native
// timeout durations are expressed in microseconds on this branch.
final microseconds = BigInt.from(_monotonicClock.elapsedMicroseconds + 1);
return TSClock._(
microseconds ~/ BigInt.from(_microsecondsPerSecond),
(microseconds % BigInt.from(_microsecondsPerSecond)).toInt() *
_nanosecondsPerMicrosecond,
);
}