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.  */);
Drew
  • 75,699
  • 9
  • 109
  • 225
nephewtom
  • 2,219
  • 17
  • 29

2 Answers2

2

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...)

Drew
  • 75,699
  • 9
  • 109
  • 225
  • 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 07 '19 at 23:48
  • `(time-to-seconds buffer-display-time)` – politza Sep 10 '19 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
Ruy
  • 787
  • 4
  • 11