readutmp: Make the header file includable from C++

2023-08-10 Thread Bruno Haible
Pretty trivial: 2023-08-10 Bruno Haible readutmp: Make the header file includable from C++. * lib/readutmp.h: Add extern "C" block. diff --git a/lib/readutmp.h b/lib/readutmp.h index b74d37cde3..8db549a393 100644 --- a/lib/readutmp.h +++ b/lib/readutmp.h @@ -56,6 +56,11 @@ #

Re: boot time on Linux

2023-08-10 Thread Bruno Haible
I wrote: > It works well enough, that I'm adding it to Gnulib, through the attached > patch. A small tweak, to make it respect the 'options' parameter and to make it more future-proof: 2023-08-10 Bruno Haible readutmp: Tweak the Android specific addition. * lib/readutmp.c (r

Re: boot time on Linux

2023-08-10 Thread Bruno Haible
Natanael Copa wrote: > There are machines without RTC (Raspberry PI for example), and in > this case the time stamp may end up to be the same every reboot (if > correctly set up it should save the shutdown time for the reboot and set > time to this on next boot, but there is no guarantee). Indeed,

Re: boot time on Linux

2023-08-10 Thread Bruno Haible
Po Lu wrote: > >> Both clock_gettime (CLOCK_BOOTIME, ... sysinfo fail with AVC denial > >> errors and errno set to EACCESS. > > > > Was this inside Termux, or inside the Emacs app? > > Inside the Emacs app. Emacs does not have the following in AndroidManifest.xml, which Termux has: May

Re: boot time on Linux

2023-08-10 Thread Po Lu
Bruno Haible writes: > Po Lu wrote: >> Both clock_gettime (CLOCK_BOOTIME, ... sysinfo fail with AVC denial >> errors and errno set to EACCESS. > > Was this inside Termux, or inside the Emacs app? Inside the Emacs app. I'll try Termux soon: maybe the target SDK version is the culprit.

Re: bug#64937: "who" reports funny dates

2023-08-10 Thread Thorsten Kukuk
On Thu, Aug 10, Bruno Haible wrote: > This is merely a warning, and it's already gone after today's refactorings > in Gnulib. To get past it, either remove '-Werror' from the Makefile, or > bootstrap against the current Gnulib: Thanks, I know how to get past it, else I couldn't have tested the re

Re: boot time on Linux

2023-08-10 Thread Natanael Copa
Hi, I had a quick look at the thread, and I have a few comments. 1) it is openrc's bootmisc ( https://github.com/OpenRC/openrc/blob/86efc43d0e0d7569f5d2e7a58b8c461ac9f7dae8/init.d/bootmisc.in#L197) that creates /var/run/utmp. There is no guarantee that this exists. You can for example run emacs in

Re: bug#64937: "who" reports funny dates

2023-08-10 Thread Bruno Haible
Thorsten Kukuk wrote: > Not sure how relevant this code still is, but currently I get with this: > > lib/readutmp.c: In function 'get_boot_time_uncached': > lib/readutmp.c:326:35: error: declaration of 'up' shadows a previous local > [-Werror=shadow] > 326 | struct timespec up

Re: boot time on Linux

2023-08-10 Thread Bruno Haible
Po Lu wrote: > Both clock_gettime (CLOCK_BOOTIME, ... sysinfo fail with AVC denial > errors and errno set to EACCESS. Was this inside Termux, or inside the Emacs app? Bruno

Re: boot time on Linux

2023-08-10 Thread Po Lu
Bruno Haible writes: > I wrote: >> > No, it isn't. The attached file, when compiled and run under Termux (which >> > doesn't have particular permissions), prints e.g.: >> > >> > from clock : 1691616762.476870660 = 2023-08-09 21:32:42.476870660 >> > from sysinfo: 1691616762.329261637 = 2023-08-09

Re: bug#64937: "who" reports funny dates

2023-08-10 Thread Thorsten Kukuk
Hi, currently testing current coreutils git checkout on a utmp/wtmp free machine, looks good so far. Except there is a compile problem with this patch: On Tue, Aug 08, Bruno Haible wrote: > 2023-08-08 Bruno Haible > > readutmp: Get the boot time with higher precision. > Suggest

new module 'boot-time'

2023-08-10 Thread Bruno Haible
After the efforts we've made to get a stable boot time out of read_utmp(), it's worth to export this facility through a simpler API. The new module 'boot-time' does this. It has a link dependency on libsystemd, if --enable-systemd was used. Since libsystemd does not contribute to producing the boo

Re: boot time on Linux

2023-08-10 Thread Bruno Haible
I wrote: > > No, it isn't. The attached file, when compiled and run under Termux (which > > doesn't have particular permissions), prints e.g.: > > > > from clock : 1691616762.476870660 = 2023-08-09 21:32:42.476870660 > > from sysinfo: 1691616762.329261637 = 2023-08-09 21:32:42.329261637 > > > > No

Re: boot time on Linux

2023-08-10 Thread Natanael Copa
On Thu, 10 Aug 2023 17:38:10 +0800 Po Lu wrote: > Natanael Copa writes: > > > 2) Even if it does exist, there is no guarantee that the timestamp is > > correct. There are machines without RTC (Raspberry PI for example), > > and in this case the time stamp may end up to be the same every reboot

Re: boot time on Linux

2023-08-10 Thread Po Lu
Natanael Copa writes: > 2) Even if it does exist, there is no guarantee that the timestamp is > correct. There are machines without RTC (Raspberry PI for example), > and in this case the time stamp may end up to be the same every reboot > (if correctly set up it should save the shutdown time for