1 |
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. |
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2003 Free Software Foundation, Inc. |
2 |
* |
* |
3 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
4 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
66 |
#include <string.h> |
#include <string.h> |
67 |
#endif |
#endif |
68 |
|
|
|
# ifdef TIME_WITH_SYS_TIME |
|
|
# include <sys/time.h> |
|
|
# include <time.h> |
|
|
# else |
|
|
# ifdef HAVE_SYS_TIME_H |
|
|
# include <sys/time.h> |
|
|
# else |
|
|
# ifdef HAVE_TIME_H |
|
|
# include <time.h> |
|
|
# endif |
|
|
# endif |
|
|
# endif |
|
|
|
|
69 |
#ifdef HAVE_SYS_TIMES_H |
#ifdef HAVE_SYS_TIMES_H |
70 |
# include <sys/times.h> |
# include <sys/times.h> |
71 |
#endif |
#endif |
85 |
extern char *strptime (); |
extern char *strptime (); |
86 |
#endif |
#endif |
87 |
|
|
|
/* This should be figured out by autoconf. */ |
|
|
#if ! defined(CLKTCK) && defined(CLK_TCK) |
|
|
# define CLKTCK ((int) CLK_TCK) |
|
|
#endif |
|
|
#if ! defined(CLKTCK) && defined(CLOCKS_PER_SEC) |
|
|
# define CLKTCK ((int) CLOCKS_PER_SEC) |
|
|
#endif |
|
|
#if ! defined(CLKTCK) |
|
|
# define CLKTCK 60 |
|
|
#endif |
|
|
|
|
88 |
#ifdef __STDC__ |
#ifdef __STDC__ |
89 |
# define timet time_t |
# define timet time_t |
90 |
#else |
#else |
101 |
} |
} |
102 |
#else |
#else |
103 |
# ifdef LACK_CLOCK |
# ifdef LACK_CLOCK |
104 |
# define mytime() ((time((timet*)0) - scm_your_base) * CLKTCK) |
# define mytime() ((time((timet*)0) - scm_your_base) * SCM_TIME_UNITS_PER_SECOND) |
105 |
# else |
# else |
106 |
# define mytime clock |
# define mytime clock |
107 |
# endif |
# endif |
129 |
tmp = scm_sum (tmp, |
tmp = scm_sum (tmp, |
130 |
scm_product (SCM_MAKINUM (1000), |
scm_product (SCM_MAKINUM (1000), |
131 |
SCM_MAKINUM (time_buffer.time))); |
SCM_MAKINUM (time_buffer.time))); |
132 |
return scm_quotient (scm_product (tmp, SCM_MAKINUM (CLKTCK)), |
return scm_quotient (scm_product (tmp, SCM_MAKINUM (SCM_TIME_UNITS_PER_SECOND)), |
133 |
SCM_MAKINUM (1000)); |
SCM_MAKINUM (1000)); |
134 |
#else |
#else |
135 |
return scm_long2num((time((timet*)0) - scm_your_base) * (int)CLKTCK); |
return scm_long2num((time((timet*)0) - scm_your_base) * (int)SCM_TIME_UNITS_PER_SECOND); |
136 |
#endif /* HAVE_FTIME */ |
#endif /* HAVE_FTIME */ |
137 |
} |
} |
138 |
#undef FUNC_NAME |
#undef FUNC_NAME |
682 |
scm_init_stime() |
scm_init_stime() |
683 |
{ |
{ |
684 |
scm_c_define ("internal-time-units-per-second", |
scm_c_define ("internal-time-units-per-second", |
685 |
scm_long2num((long)CLKTCK)); |
scm_long2num((long) SCM_TIME_UNITS_PER_SECOND)); |
686 |
|
|
687 |
#ifdef HAVE_FTIME |
#ifdef HAVE_FTIME |
688 |
if (!scm_your_base.time) ftime(&scm_your_base); |
if (!scm_your_base.time) ftime(&scm_your_base); |