1 # git-gui date processing support
2 # Copyright (C) 2007 Shawn Pearce
17 proc parse_git_date
{s
} {
23 {^...
(...
) (\d
{1,2}) (\d
\d
):(\d
\d
):(\d
\d
) (\d
{4}) ([+-]?
)(\d
\d
)(\d
\d
)$} $s s
\
24 month day hr mm ss yr ew tz_h tz_m
]} {
25 error [mc
"Invalid date from Git: %s" $s]
28 set s
[clock scan [format {%4.4i
%2.2i
%2.2iT
%2s
%2s
%2s
} \
29 $yr $::git_month($month) $day \
33 regsub ^
0 $tz_h {} tz_h
34 regsub ^
0 $tz_m {} tz_m
41 return [expr "$s $ew ($tz_h * 3600 + $tz_m * 60)"]
44 proc format_date
{s
} {
48 return [clock format $s -format {%a
%b
%e
%H
:%M
:%S
%Y
}]
51 proc reformat_date
{s
} {
52 return [format_date
[parse_git_date
$s]]