Standard library / time
time.Until()
Compute duration until t; negative results mean the target is past. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func Until(t Time) DurationParameters & Attributes
| Name | Type | Description |
|---|---|---|
| t | Time | Reference instant. |
Return Value
Duration
Compute duration until t; negative results mean the target is past.
Working Example
Example Snippetgo
package main
import ( "fmt" "time")
func main() { target := time.Now().Add(-time.Hour); fmt.Println(time.Until(target) < 0) }