Skip to content

Instantly share code, notes, and snippets.

@Bombe
Created August 14, 2025 08:53
Show Gist options
  • Save Bombe/7319e657209fce737c8701455b0d3995 to your computer and use it in GitHub Desktop.
Save Bombe/7319e657209fce737c8701455b0d3995 to your computer and use it in GitHub Desktop.
Outputs the current time of day as metric time (10 hours with 100 minutes with 100 seconds)
package main
import "fmt"
import "time"
func main() {
current_time := time.Now()
time_in_millis := current_time.Hour()*(3600*1000) + current_time.Minute()*(60*1000) + current_time.Second()*(1000) + (current_time.Nanosecond() / 1000000)
time_in_metric := time_in_millis * 100000 / (86400 * 1000)
fmt.Printf("%d:%02d:%02d\n", time_in_metric/10000, (time_in_metric/100)%100, time_in_metric%100)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment