Mercurial > emacs
comparison src/editfns.c @ 90044:cb7f41387eb3
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-70
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-669
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-678
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-679
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-680
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-688
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-689
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-690
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-691
Update from CVS
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-69
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-70
- miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-71
Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 12 Nov 2004 02:53:04 +0000 |
parents | e24e2e78deda 46a652255057 |
children | 1df66cb75f66 |
comparison
equal
deleted
inserted
replaced
90043:e24e2e78deda | 90044:cb7f41387eb3 |
---|---|
20 Boston, MA 02111-1307, USA. */ | 20 Boston, MA 02111-1307, USA. */ |
21 | 21 |
22 | 22 |
23 #include <config.h> | 23 #include <config.h> |
24 #include <sys/types.h> | 24 #include <sys/types.h> |
25 #include <stdio.h> | |
25 | 26 |
26 #ifdef VMS | 27 #ifdef VMS |
27 #include "vms-pwd.h" | 28 #include "vms-pwd.h" |
28 #else | 29 #else |
29 #include <pwd.h> | 30 #include <pwd.h> |
31 | 32 |
32 #ifdef HAVE_UNISTD_H | 33 #ifdef HAVE_UNISTD_H |
33 #include <unistd.h> | 34 #include <unistd.h> |
34 #endif | 35 #endif |
35 | 36 |
36 /* Without this, sprintf on Mac OS Classic will produce wrong | 37 /* systime.h includes <sys/time.h> which, on some systems, is required |
37 result. */ | 38 for <sys/resource.h>; thus systime.h must be included before |
38 #ifdef MAC_OS8 | 39 <sys/resource.h> */ |
39 #include <stdio.h> | 40 #include "systime.h" |
41 | |
42 #if defined HAVE_SYS_RESOURCE_H | |
43 #include <sys/resource.h> | |
40 #endif | 44 #endif |
41 | 45 |
42 #include <ctype.h> | 46 #include <ctype.h> |
43 | 47 |
44 #include "lisp.h" | 48 #include "lisp.h" |
46 #include "buffer.h" | 50 #include "buffer.h" |
47 #include "character.h" | 51 #include "character.h" |
48 #include "coding.h" | 52 #include "coding.h" |
49 #include "frame.h" | 53 #include "frame.h" |
50 #include "window.h" | 54 #include "window.h" |
51 | |
52 #include "systime.h" | |
53 | 55 |
54 #ifdef STDC_HEADERS | 56 #ifdef STDC_HEADERS |
55 #include <float.h> | 57 #include <float.h> |
56 #define MAX_10_EXP DBL_MAX_10_EXP | 58 #define MAX_10_EXP DBL_MAX_10_EXP |
57 #else | 59 #else |
1367 XSETINT (result[0], (EMACS_SECS (t) >> 16) & 0xffff); | 1369 XSETINT (result[0], (EMACS_SECS (t) >> 16) & 0xffff); |
1368 XSETINT (result[1], (EMACS_SECS (t) >> 0) & 0xffff); | 1370 XSETINT (result[1], (EMACS_SECS (t) >> 0) & 0xffff); |
1369 XSETINT (result[2], EMACS_USECS (t)); | 1371 XSETINT (result[2], EMACS_USECS (t)); |
1370 | 1372 |
1371 return Flist (3, result); | 1373 return Flist (3, result); |
1374 } | |
1375 | |
1376 DEFUN ("get-internal-run-time", Fget_internal_run_time, Sget_internal_run_time, | |
1377 0, 0, 0, | |
1378 doc: /* Return the current run time used by Emacs. | |
1379 The time is returned as a list of three integers. The first has the | |
1380 most significant 16 bits of the seconds, while the second has the | |
1381 least significant 16 bits. The third integer gives the microsecond | |
1382 count. | |
1383 | |
1384 On systems that can't determine the run time, get-internal-run-time | |
1385 does the same thing as current-time. The microsecond count is zero on | |
1386 systems that do not provide resolution finer than a second. */) | |
1387 () | |
1388 { | |
1389 #ifdef HAVE_GETRUSAGE | |
1390 struct rusage usage; | |
1391 Lisp_Object result[3]; | |
1392 int secs, usecs; | |
1393 | |
1394 if (getrusage (RUSAGE_SELF, &usage) < 0) | |
1395 /* This shouldn't happen. What action is appropriate? */ | |
1396 Fsignal (Qerror, Qnil); | |
1397 | |
1398 /* Sum up user time and system time. */ | |
1399 secs = usage.ru_utime.tv_sec + usage.ru_stime.tv_sec; | |
1400 usecs = usage.ru_utime.tv_usec + usage.ru_stime.tv_usec; | |
1401 if (usecs >= 1000000) | |
1402 { | |
1403 usecs -= 1000000; | |
1404 secs++; | |
1405 } | |
1406 | |
1407 XSETINT (result[0], (secs >> 16) & 0xffff); | |
1408 XSETINT (result[1], (secs >> 0) & 0xffff); | |
1409 XSETINT (result[2], usecs); | |
1410 | |
1411 return Flist (3, result); | |
1412 #else | |
1413 return Fcurrent_time (); | |
1414 #endif | |
1372 } | 1415 } |
1373 | 1416 |
1374 | 1417 |
1375 int | 1418 int |
1376 lisp_time_argument (specified_time, result, usec) | 1419 lisp_time_argument (specified_time, result, usec) |
4445 defsubr (&Suser_uid); | 4488 defsubr (&Suser_uid); |
4446 defsubr (&Suser_real_uid); | 4489 defsubr (&Suser_real_uid); |
4447 defsubr (&Suser_full_name); | 4490 defsubr (&Suser_full_name); |
4448 defsubr (&Semacs_pid); | 4491 defsubr (&Semacs_pid); |
4449 defsubr (&Scurrent_time); | 4492 defsubr (&Scurrent_time); |
4493 defsubr (&Sget_internal_run_time); | |
4450 defsubr (&Sformat_time_string); | 4494 defsubr (&Sformat_time_string); |
4451 defsubr (&Sfloat_time); | 4495 defsubr (&Sfloat_time); |
4452 defsubr (&Sdecode_time); | 4496 defsubr (&Sdecode_time); |
4453 defsubr (&Sencode_time); | 4497 defsubr (&Sencode_time); |
4454 defsubr (&Scurrent_time_string); | 4498 defsubr (&Scurrent_time_string); |