all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Natanael Copa <natanael.copa@gmail.com>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: "Bruno Haible" <bruno@clisp.org>,
	"Robert Pluim" <rpluim@gmail.com>,
	bug-gnulib@gnu.org, "Pádraig Brady" <P@draigbrady.com>,
	"Sven Joachim" <svenjoac@gmx.de>,
	64937@debbugs.gnu.org, "Po Lu" <luangruo@yahoo.com>,
	"Emacs Development" <Emacs-devel@gnu.org>,
	"Thorsten Kukuk" <kukuk@suse.com>,
	"Natanael Copa" <ncopa@alpinelinux.org>
Subject: Re: boot time on Linux
Date: Thu, 10 Aug 2023 11:30:19 +0200	[thread overview]
Message-ID: <CAJT+8eyiBvfCD6oxV44R6p=ywuv=XbDkx=d=g5EUd3AkXNNVww@mail.gmail.com> (raw)
In-Reply-To: <c8c927bb-5e44-f26d-837e-ae6b73e60add@cs.ucla.edu>

[-- Attachment #1: Type: text/plain, Size: 2250 bytes --]

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 a alpine docker container.
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 the reboot and set
time to this on next boot, but there is no guarantee).

For emacs' use case I'd say the best solution would be to use uptime from
sysinfo(2) and assume system time is correct (NTP client should be running
at the time emacs is started).

-nc


On Wed, Aug 9, 2023 at 9:31 PM Paul Eggert <eggert@cs.ucla.edu> wrote:

> [For those cc'ed, the thread's at <https://bugs.gnu.org/64937#142>.]
>
> On 2023-08-09 07:29, Bruno Haible wrote:
>
> > And on Alpine Linux, while /var/run/utmp is empty, its time stamp is
> > essentially the boot time.
> >
> > The approach used by Emacs, namely to look at the time stamp of
> > /var/run/random-seed, is therefore essentially one of the best
> approaches.
> > It just needs to also look at /var/lib/systemd/random-seed and - on
> Alpine
> > Linux - /var/run/utmp .
>
> Thanks for looking into this. Clearly Emacs had some catching up to do,
> since it was using a location for the random-seed file that current
> GNU/Linux distros no longer use. To try to fix this I installed the
> attached patch to Emacs master on Savannah.
>
> This patch does not address the problem for Alpine, nor I suspect for
> Android. I suppose Alpine could use the timestamp of /var/run/utmp (or
> is that /run/utmp?) but I don't know how 'configure' would reliably
> detect it's being built or cross-built for Alpine. I'll cc this to
> Natanael Copa, who does the Alpine ports for Emacs, to see whether he
> can give advice.
>
> Also, I don't know how Android records boot time so I'll cc this to Po
> Lu, the main developer for Emacs on Android.



-- 
Natanael Copa

[-- Attachment #2: Type: text/html, Size: 3086 bytes --]

  parent reply	other threads:[~2023-08-10  9:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87tttmpt5h.fsf@turtle.gmx.de>
     [not found] ` <20230808173430.GA27131@suse.com>
     [not found]   ` <26226778.6c9BZvbsD2@nimes>
     [not found]     ` <3732835.vtg8X0x55z@nimes>
2023-08-09 19:31       ` boot time on Linux Paul Eggert
2023-08-09 21:06         ` Bruno Haible
2023-08-09 23:53         ` Po Lu
2023-08-10  0:14           ` Bruno Haible
2023-08-10  2:14             ` Po Lu
2023-08-10  6:22               ` Paul Eggert
2023-08-10  6:58                 ` Po Lu
2023-08-10 10:30               ` Bruno Haible
2023-08-10 12:23                 ` bug#64937: " Po Lu via GNU coreutils Bug Reports
2023-08-10 12:25                   ` Bruno Haible
2023-08-10 13:04                     ` Po Lu
2023-08-10 14:12                       ` Bruno Haible
2023-08-11  8:27                         ` Po Lu
2023-08-10  9:30         ` Natanael Copa [this message]
2023-08-10  9:38           ` Po Lu
2023-08-10 10:05             ` Natanael Copa
2023-08-10 15:30           ` Bruno Haible

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJT+8eyiBvfCD6oxV44R6p=ywuv=XbDkx=d=g5EUd3AkXNNVww@mail.gmail.com' \
    --to=natanael.copa@gmail.com \
    --cc=64937@debbugs.gnu.org \
    --cc=Emacs-devel@gnu.org \
    --cc=P@draigbrady.com \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=kukuk@suse.com \
    --cc=luangruo@yahoo.com \
    --cc=ncopa@alpinelinux.org \
    --cc=rpluim@gmail.com \
    --cc=svenjoac@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.