5 ms·
It's worth noting that OP's example works in any Bourne-compatible shell. I don't think `date +%s` is costly enough to warrant losing the portability.
by anothergoogler 8y ago
It's worth noting that OP's example works in any Bourne-compatible shell. I don't think `date +%s` is costly enough to warrant losing the portability.
- kadoban 8y agoI wouldn't be worried about the performance cost of using `date +%s` personally, I'd be concerned about what happens when the user or an automated process changes the system time. For example, what will happen in the debounce function if the user sets the system time backwards by a week after a limit has been set?
- anothergoogler 8y agoGood point, didn't think of that.
- cryptonector 8y agoThe title said bash. Replace "local" with "typeset" and what I wrote is compatible with KSH too -- not Bourne nor POSIX, I know, but still.