Commit 544448e
committed
Replace date with perl to fix get_time() on macOS
The BSD date on macOS doesn't support %N. It just prints a literal N
(e.g. '1738285044.N'), which breaks the awk command in get_cache_val(),
stopping cached values from being updated.
Instead, I found this perl command at [1]. Tested on macOS, Arch Linux,
and OpenWRT (which has a minimal perl distribution. By the way, BusyBox
date doesn't support %N either but it just prints e.g. '1738285044.'
without an 'N'. So while the awk command works, [2] didn't really
improve the time precision here).
[1] https://apple.stackexchange.com/a/359718/254536
[2] https://github.com/tmux-plugins/tmux-cpu/pull/56/files#diff-e015cc3ac522b202bb23852488a7ac2c019e2c82568ecb387b97b60ebbecdf4bR72-R741 parent bcb110d commit 544448e
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
0 commit comments