Ensure beep works even very soon after startup

This commit is contained in:
Kovid Goyal 2020-08-05 11:04:07 +05:30
parent dba01bc014
commit 90a097d45c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -893,7 +893,7 @@ static void
ring_audio_bell(void) { ring_audio_bell(void) {
static monotonic_t last_bell_at = -1; static monotonic_t last_bell_at = -1;
monotonic_t now = monotonic(); monotonic_t now = monotonic();
if (now - last_bell_at <= ms_to_monotonic_t(100ll)) return; if (last_bell_at >= 0 && now - last_bell_at <= ms_to_monotonic_t(100ll)) return;
last_bell_at = now; last_bell_at = now;
#ifdef __APPLE__ #ifdef __APPLE__
cocoa_system_beep(); cocoa_system_beep();