Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Oh My Zsh
Commits
7034b01c
Commit
7034b01c
authored
Nov 06, 2014
by
Robby Russell
Browse files
Merge pull request #3213 from nikhgupta/features/fix-emoji-clock
added support for GNU version of `date`
parents
8a51bfd7
71ee0d7b
Changes
1
Show whitespace changes
Inline
Side-by-side
plugins/emoji-clock/emoji-clock.plugin.zsh
View file @
7034b01c
...
@@ -8,21 +8,25 @@
...
@@ -8,21 +8,25 @@
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
function
emoji-clock
()
{
function
emoji-clock
()
{
hour
=
$(
date
-v
'+15M'
'+%I'
)
# Add 15 minutes to the current time and save the value as $minutes.
minutes
=
$(
date
-v
'+15M'
'+%M'
)
((
minutes
=
$(
date
'+%M'
)
+ 15
))
((
hour
=
$(
date
'+%I'
)
+ minutes / 60
))
# make sure minutes and hours don't exceed 60 nor 12 respectively
((
minutes %
=
60
))
;
((
hour %
=
12
))
case
$hour
in
case
$hour
in
01
)
clock
=
"🕐"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕜"
;;
0
)
clock
=
"🕛"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕧"
;;
02
)
clock
=
"🕑"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕝"
;;
1
)
clock
=
"🕐"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕜"
;;
03
)
clock
=
"🕒"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕞"
;;
2
)
clock
=
"🕑"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕝"
;;
04
)
clock
=
"🕓"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕟"
;;
3
)
clock
=
"🕒"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕞"
;;
05
)
clock
=
"🕔"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕠"
;;
4
)
clock
=
"🕓"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕟"
;;
06
)
clock
=
"🕕"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕡"
;;
5
)
clock
=
"🕔"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕠"
;;
07
)
clock
=
"🕖"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕢"
;;
6
)
clock
=
"🕕"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕡"
;;
08
)
clock
=
"🕗"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕣"
;;
7
)
clock
=
"🕖"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕢"
;;
09
)
clock
=
"🕘"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕤"
;;
8
)
clock
=
"🕗"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕣"
;;
9
)
clock
=
"🕘"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕤"
;;
10
)
clock
=
"🕙"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕥"
;;
10
)
clock
=
"🕙"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕥"
;;
11
)
clock
=
"🕚"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕦"
;;
11
)
clock
=
"🕚"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕦"
;;
12
)
clock
=
"🕛"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕧"
;;
*
)
clock
=
"⌛"
;;
*
)
clock
=
"⌛"
;;
esac
esac
echo
$clock
echo
$clock
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment