1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 14:00:21 +02:00

* filesys.c (scm_input_waiting_p): add missing third argument to

scm_misc_error.

* stime.c (scm_localtime): copy the result of localtime before
calling gmtime in case they share a buffer.
(scm_localtime, scm_mktime): throw an error if neither HAVE_TM_ZONE
nor HAVE_TZNAME.
This commit is contained in:
Gary Houston 1997-05-05 21:01:57 +00:00
parent 2a18e74810
commit 4edc089ccb
4 changed files with 39 additions and 18 deletions

View file

@ -1,7 +1,17 @@
Mon May 5 20:35:08 1997 Gary Houston <ghouston@actrix.gen.nz>
* filesys.c (scm_input_waiting_p): add missing third argument to
scm_misc_error.
* stime.c (scm_localtime): copy the result of localtime before
calling gmtime in case they share a buffer.
(scm_localtime, scm_mktime): throw an error if neither HAVE_TM_ZONE
nor HAVE_TZNAME.
Fri May 2 19:07:11 1997 Gary Houston <ghouston@actrix.gen.nz>
* eq.c (scm_equal_p): use SCM_TYP7SD (y) not SCM_TYP7SD (x).
Thu May 1 17:01:45 1997 Jim Blandy <jimb@floss.cyclic.com>
* Makefile.am (check-local): New target, which causes 'make check'

View file

@ -921,7 +921,8 @@ scm_input_waiting_p (f, caller)
return remir;
}
# else
scm_misc_error ("char-ready?", "Not fully implemented");
scm_misc_error ("char-ready?", "Not fully implemented on this platform",
SCM_EOL);
# endif
# endif
}

View file

@ -413,7 +413,8 @@ scm_setfileno (fs, fd)
#ifdef SET_FILE_FD_FIELD
SET_FILE_FD_FIELD(fs, fd);
#else
scm_misc_error ("scm_setfileno", "Not fully implemented", SCM_EOL);
scm_misc_error ("scm_setfileno", "Not fully implemented on this platform",
SCM_EOL);
#endif
}

View file

@ -283,7 +283,7 @@ SCM
scm_localtime (SCM time, SCM zone)
{
timet itime;
struct tm *lt, *utc;
struct tm *ltptr, lt, *utc;
SCM result;
int zoff;
char *zname = 0;
@ -293,44 +293,50 @@ scm_localtime (SCM time, SCM zone)
itime = scm_num2long (time, (char *) SCM_ARG1, s_localtime);
SCM_DEFER_INTS;
oldtz = setzone (zone, SCM_ARG2, s_localtime);
lt = localtime (&itime);
ltptr = localtime (&itime);
err = errno;
/* copied in case localtime and gmtime share a buffer. */
if (ltptr)
lt = *ltptr;
utc = gmtime (&itime);
if (utc == NULL)
err = errno;
if (lt)
if (ltptr)
{
#ifdef HAVE_TM_ZONE
zname = lt->tm_zone;
zname = lt.tm_zone;
#else
# ifdef HAVE_TZNAME
/* must be copied before calling tzset again. */
char *ptr = tzname[ (lt->tm_isdst == 1) ? 1 : 0 ];
char *ptr = tzname[ (lt.tm_isdst == 1) ? 1 : 0 ];
zname = scm_must_malloc (strlen (ptr) + 1, s_localtime);
strcpy (zname, ptr);
#endif
# else
scm_misc_error (s_localtime, "Not fully implemented on this platform",
SCM_EOF);
# endif
#endif
}
restorezone (zone, oldtz);
/* delayed until zone has been restored. */
errno = err;
if (utc == NULL || lt == NULL)
if (utc == NULL || ltptr == NULL)
scm_syserror (s_localtime);
/* calculate timezone offset in seconds west of UTC. */
zoff = (utc->tm_hour - lt->tm_hour) * 3600 + (utc->tm_min - lt->tm_min) * 60
+ utc->tm_sec - lt->tm_sec;
if (utc->tm_year < lt->tm_year)
zoff = (utc->tm_hour - lt.tm_hour) * 3600 + (utc->tm_min - lt.tm_min) * 60
+ utc->tm_sec - lt.tm_sec;
if (utc->tm_year < lt.tm_year)
zoff -= 24 * 60 * 60;
else if (utc->tm_year > lt->tm_year)
else if (utc->tm_year > lt.tm_year)
zoff += 24 * 60 * 60;
else if (utc->tm_yday < lt->tm_yday)
else if (utc->tm_yday < lt.tm_yday)
zoff -= 24 * 60 * 60;
else if (utc->tm_yday > lt->tm_yday)
else if (utc->tm_yday > lt.tm_yday)
zoff += 24 * 60 * 60;
result = filltime (lt, zoff, zname);
result = filltime (&lt, zoff, zname);
SCM_ALLOW_INTS;
return result;
}
@ -417,7 +423,10 @@ scm_mktime (SCM sbd_time, SCM zone)
zname = scm_must_malloc (strlen (ptr) + 1, s_mktime);
strcpy (zname, ptr);
#endif
# else
scm_misc_error (s_localtime, "Not fully implemented on this platform",
SCM_EOF);
# endif
#endif
}
restorezone (zone, oldtz);