GNU bug report logs - #57346
undeclared identifier 'CLOCK_MONOTONIC'

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Mon, 22 Aug 2022 20:47:02 UTC

Severity: normal

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #24 received at 57346 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Po Lu <luangruo <at> yahoo.com>, rgm <at> gnu.org, 57346 <at> debbugs.gnu.org
Subject: Re: bug#57346: undeclared identifier 'CLOCK_MONOTONIC'
Date: Tue, 23 Aug 2022 11:29:06 +0000
>> Right, the internet says OS X doesn't have clock_gettime.
>>
>> Does gnulib provide it?
>
> Not AFAICT.
>

It should be easy to emulate it with what Mac OS X/macOS provides, 
however:

int
clock_gettime (clockid_t ignored /* assuming CLOCK_MONOTONIC */,
               struct timespec *tp)
{
  clock_serv_t cs;
  mach_timespec_t mts;
  kern_return_t ret;
  host_get_clock_service (mach_host_self (), SYSTEM_CLOCK, &cs);
  ret = clock_get_time (cs, &mts);
  mach_port_deallocate(mach_task_self (), cs);
  if (ret) return ret;
  tp->tv_sec = mts.tv_sec;
  tp->tv_nsec = mts.tv_nsec;
}




This bug report was last modified 2 years and 263 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.