time: Duration.debug prints only a minus sign at min_i64

Open Beginner friendly
#32,794 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@james-yusuke is already working on this.

Since Nov 23, 2026.

  • #32795 by @james-yusuke — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c
Domain
cli

Research direction

The bug is in the time module's Duration.debug() method, which negates the signed nanosecond count to get a magnitude, so min_i64 overflows. Start by reading Duration.debug in vlib/time and reproduce with the snippet in the issue using ./v -gc none run repro.v. Done when min_i64 prints the full magnitude (106751days, 23h, 47m, 16s, 854ms, 775us, 808ns) and a regression test covers it.

Written by the indexing model from the issue text.

Description

On dev at 9cc1ed5b96, run this with ./v -gc none run repro.v:

import time

fn main() {
	println(time.Duration(min_i64).debug())
}

It prints Duration: - . The expected output is Duration: - 106751days, 23h, 47m, 16s, 854ms, 775us, 808ns.

Duration.debug() negates the signed nanosecond count to get its magnitude. The magnitude of min_i64 fits in u64, but negating it as i64 overflows. Clang's signed-integer-overflow sanitizer reports the negation.

[!NOTE]
You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Dominant language
V
Stars
38.1k
Forks
2.3k
Avg merge
22h 8m
Merged PRs (30d)
636

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vlang/v

All issues in vlang/v

Similar issues

More CLI issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.