1

I am trying to use buffer-display-time var, in order to come with a solution for this question.

Having a look at the documentation, I get this:

buffer-display-time is a variable defined in ‘buffer.c’.
Its value is (23883 19206 790941 600000)
Local in buffer buffer.c; global value is nil

  Automatically becomes permanently buffer-local when set.

Documentation:
Time stamp updated each time this buffer is displayed in a window.
The function ‘set-window-buffer’ updates this variable
to the value obtained by calling ‘current-time’.
If the buffer has never been shown in a window, the value is nil.

How do I interpret these values (23883 19206 790941 600000) as a timestamp?


NOTE: That variable is defined in buffer.c as:

  DEFVAR_PER_BUFFER ("buffer-display-time",
             &BVAR (current_buffer, display_time), Qnil,
             doc: /* Time stamp updated each time this buffer is displayed in a window.
The function `set-window-buffer' updates this variable
to the value obtained by calling `current-time'.
If the buffer has never been shown in a window, the value is nil.  */);
1

I guess you are asking how to tell, as a human, what corresponds to a time-date value such as (23883 19206 790941 600000).

(current-time-string '(23883 19206 790941 600000)) tells me that it's "Wed Aug 7 15:04:54 2019".

How did I find this? I used C-h i Elisp followed by i time TAB and chose candidate time value. That took me to this node of the manual: (elisp) Time of Day, where I found function current-time-string described.

(Ask Emacs...)

  • I would have expected to get something like a current Unix timestamp of about 1565221420 (at least around 156522XXXX). But it seems Emacs does not work in the general common sense way... – nephewtom Aug 7 at 23:48
  • (time-to-seconds buffer-display-time) – politza Sep 10 at 19:24
0

A time stamp (HIGH LOW USEC PSEC), such as the one returned by buffer-display-time, gives enough information to determine the number of seconds elapsed since 1970-01-01 00:00:00. That number is computed as

HIGH * 2^16 + LOW + USEC * 10^(-6) + PSEC * 10^(-12)

This is explained in the documentation of the function current-time where it is stated that

  • HIGH has the most significant bits of the seconds
  • LOW has the least significant 16 bits
  • USEC and PSEC are the microsecond and picosecond counts
  • yep, that is what is shown in the link provided by @Drew – nephewtom Aug 9 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.