comparison src/editfns.c @ 577:53f29271d1b0

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Sat, 14 Mar 1992 19:09:32 +0000
parents b7a1e4e4e7e6
children eca8812e61cd
comparison
equal deleted inserted replaced
576:a63fdacd41b3 577:53f29271d1b0
1 /* Lisp functions pertaining to editing. 1 /* Lisp functions pertaining to editing.
2 Copyright (C) 1985, 1986, 1987, 1989 Free Software Foundation, Inc. 2 Copyright (C) 1985, 1986, 1987, 1989, 1992 Free Software Foundation, Inc.
3 3
4 This file is part of GNU Emacs. 4 This file is part of GNU Emacs.
5 5
6 GNU Emacs is free software; you can redistribute it and/or modify 6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
19 19
20 20
21 #include "config.h" 21 #include "config.h"
22 22
23 #ifdef VMS 23 #ifdef VMS
24 #include "pwd.h" 24 #include "vms-pwd.h"
25 #else 25 #else
26 #include <pwd.h> 26 #include <pwd.h>
27 #endif 27 #endif
28 28
29 #include "lisp.h" 29 #include "lisp.h"
30 #include "buffer.h" 30 #include "buffer.h"
31 #include "window.h" 31 #include "window.h"
32 32
33 #ifdef NEED_TIME_H 33 #include "systime.h"
34 #include <time.h>
35 #else /* not NEED_TIME_H */
36 #ifdef HAVE_TIMEVAL
37 #include <sys/time.h>
38 #endif /* HAVE_TIMEVAL */
39 #endif /* not NEED_TIME_H */
40 34
41 #define min(a, b) ((a) < (b) ? (a) : (b)) 35 #define min(a, b) ((a) < (b) ? (a) : (b))
42 #define max(a, b) ((a) > (b) ? (a) : (b)) 36 #define max(a, b) ((a) > (b) ? (a) : (b))
43 37
44 /* Some static data, and a function to initialize it for each run */ 38 /* Some static data, and a function to initialize it for each run */
507 { 501 {
508 return Vsystem_name; 502 return Vsystem_name;
509 } 503 }
510 504
511 DEFUN ("current-time", Fcurrent_time, Scurrent_time, 0, 0, 0, 505 DEFUN ("current-time", Fcurrent_time, Scurrent_time, 0, 0, 0,
512 "Return the current time, as an integer.") 506 "Return the current time, as the number of seconds since 12:00 AM January 1970.\n\
513 () 507 The time is returned as a list of three integers. The first has the\n\
514 { 508 most significant 16 bits of the seconds, while the second has the\n\
515 return make_number (time(0)); 509 least significant 16 bits. The third integer gives the microsecond\n\
510 count.\n\
511 \n\
512 The microsecond count is zero on systems that do not provide\n\
513 resolution finer than a second.")
514 ()
515 {
516 EMACS_TIME t;
517 Lisp_Object result[3];
518
519 EMACS_GET_TIME (t);
520 XSET (result[0], Lisp_Int, (EMACS_SECS (t) >> 16) & 0xffff);
521 XSET (result[1], Lisp_Int, (EMACS_SECS (t) >> 0) & 0xffff);
522 XSET (result[2], Lisp_Int, EMACS_USECS (t));
523
524 return Flist (3, result);
516 } 525 }
517 526
518 527
519 DEFUN ("current-time-string", Fcurrent_time_string, Scurrent_time_string, 0, 0, 0, 528 DEFUN ("current-time-string", Fcurrent_time_string, Scurrent_time_string, 0, 0, 0,
520 "Return the current time, as a human-readable string.\n\ 529 "Return the current time, as a human-readable string.\n\