Skip to content

Commit f533b5e

Browse files
committed
tools:vup_println_latest_commit_time_as_local
1 parent d06e111 commit f533b5e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cmd/tools/vup.v

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module main
33
import os
44
import v.util.version
55
import v.util.recompilation
6+
import time
67

78
const vexe = os.real_path(os.getenv_opt('VEXE') or { @VEXE })
89

@@ -134,9 +135,14 @@ fn (app App) show_current_v_version() {
134135
mut vversion := vout.output.trim_space()
135136
if vout.exit_code == 0 {
136137
latest_v_commit := vversion.split(' ').last().all_after('.')
137-
latest_v_commit_time := os.execute('git show -s --format=%ci ${latest_v_commit}')
138+
latest_v_commit_time := os.execute('git show -s --format=%cI ${latest_v_commit}')
138139
if latest_v_commit_time.exit_code == 0 {
139-
vversion += ', timestamp: ' + latest_v_commit_time.output.trim_space()
140+
parsed_time := if t := time.parse_iso8601(latest_v_commit_time.output.trim_space()) {
141+
t.as_utc().utc_to_local().custom_format('YYYY-MM-DD HH:mm:ss ZZ')
142+
} else {
143+
latest_v_commit_time.output.trim_space()
144+
}
145+
vversion += ', timestamp: ' + parsed_time
140146
}
141147
}
142148
println('Current V version: ${vversion}')

0 commit comments

Comments
 (0)