diff options
| -rw-r--r-- | src/keyboard.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index fed6fbc79dd..13ab5299982 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -4543,6 +4543,35 @@ timer_check (do_it_now) | |||
| 4543 | UNGCPRO; | 4543 | UNGCPRO; |
| 4544 | return nexttime; | 4544 | return nexttime; |
| 4545 | } | 4545 | } |
| 4546 | |||
| 4547 | DEFUN ("current-idle-time", Fcurrent_idle_time, Scurrent_idle_time, 0, 0, 0, | ||
| 4548 | /* Return the current length of Emacs idleness. | ||
| 4549 | The value is returned as a list of three integers. The first has the | ||
| 4550 | most significant 16 bits of the seconds, while the second has the | ||
| 4551 | least significant 16 bits. The third integer gives the microsecond | ||
| 4552 | count. | ||
| 4553 | |||
| 4554 | The microsecond count is zero on systems that do not provide | ||
| 4555 | resolution finer than a second. */) | ||
| 4556 | () | ||
| 4557 | { | ||
| 4558 | EMACS_TIME now, idleness_now; | ||
| 4559 | Lisp_Object result[3]; | ||
| 4560 | |||
| 4561 | EMACS_GET_TIME (now); | ||
| 4562 | if (! EMACS_TIME_NEG_P (timer_idleness_start_time)) | ||
| 4563 | { | ||
| 4564 | EMACS_SUB_TIME (idleness_now, now, timer_idleness_start_time); | ||
| 4565 | |||
| 4566 | XSETINT (result[0], (EMACS_SECS (idleness_now) >> 16) & 0xffff); | ||
| 4567 | XSETINT (result[1], (EMACS_SECS (idleness_now) >> 0) & 0xffff); | ||
| 4568 | XSETINT (result[2], EMACS_USECS (idleness_now)); | ||
| 4569 | |||
| 4570 | return Flist (3, result); | ||
| 4571 | } | ||
| 4572 | |||
| 4573 | return Qnil; | ||
| 4574 | } | ||
| 4546 | 4575 | ||
| 4547 | /* Caches for modify_event_symbol. */ | 4576 | /* Caches for modify_event_symbol. */ |
| 4548 | static Lisp_Object accent_key_syms; | 4577 | static Lisp_Object accent_key_syms; |
| @@ -11131,6 +11160,7 @@ syms_of_keyboard () | |||
| 11131 | menu_bar_items_vector = Qnil; | 11160 | menu_bar_items_vector = Qnil; |
| 11132 | staticpro (&menu_bar_items_vector); | 11161 | staticpro (&menu_bar_items_vector); |
| 11133 | 11162 | ||
| 11163 | defsubr (&Scurrent_idle_time); | ||
| 11134 | defsubr (&Sevent_convert_list); | 11164 | defsubr (&Sevent_convert_list); |
| 11135 | defsubr (&Sread_key_sequence); | 11165 | defsubr (&Sread_key_sequence); |
| 11136 | defsubr (&Sread_key_sequence_vector); | 11166 | defsubr (&Sread_key_sequence_vector); |