Skip to content

Commit 8c08432

Browse files
authored
Merge pull request #286 from kurczynski/add-utc-time-formatting
Add utc time formatting
2 parents 2e867e0 + 78caa29 commit 8c08432

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

AUTHORS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Please append you name/nick here when you have contributed with something!
1+
Please append your name/nick here when you have contributed with something!
22

33
Erik Westrup <[email protected]>
44
Suvash Thapaliya <[email protected]>
@@ -34,3 +34,4 @@ Stanislaw Pusep <[email protected]>
3434
Austin Beam
3535
Ingo Heimbach
3636
MSempere
37+
kurczynski

segments/utc_time.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
# Prints the current time in UTC.
22

3+
TMUX_POWERLINE_SEG_UTC_TIME_FORMAT_DEFAULT="%H:%M %Z"
4+
5+
generate_segmentrc() {
6+
read -d '' rccontents << EORC
7+
# date(1) format for the UTC time.
8+
export TMUX_POWERLINE_SEG_UTC_TIME_FORMAT="${TMUX_POWERLINE_SEG_UTC_TIME_FORMAT_DEFAULT}"
9+
EORC
10+
echo "$rccontents"
11+
}
12+
13+
__process_settings() {
14+
if [ -z "$TMUX_POWERLINE_SEG_UTC_TIME_FORMAT" ]; then
15+
export TMUX_POWERLINE_SEG_UTC_TIME_FORMAT="${TMUX_POWERLINE_SEG_UTC_TIME_FORMAT_DEFAULT}"
16+
fi
17+
}
18+
319
run_segment() {
4-
date -u +"%H:%M"
20+
__process_settings
21+
date -u +"$TMUX_POWERLINE_SEG_UTC_TIME_FORMAT"
522
return 0
623
}

0 commit comments

Comments
 (0)