diff options
author | Tom Tromey <tromey@cygnus.com> | 1999-09-24 19:12:23 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 1999-09-24 19:12:23 +0000 |
commit | 98e7ae2962ad70fed5e3d776bf6992a2a154d629 (patch) | |
tree | 1ae1fb27538f4637b0c7cebaa4d290138da435a5 /libjava/java/util/natDate.cc | |
parent | aaaec1142d3e7b9174ecd74fd21c6c39d696d56d (diff) | |
download | gcc-98e7ae2962ad70fed5e3d776bf6992a2a154d629.zip gcc-98e7ae2962ad70fed5e3d776bf6992a2a154d629.tar.gz gcc-98e7ae2962ad70fed5e3d776bf6992a2a154d629.tar.bz2 |
re GNATS java.util/47 (Date.toString() returns embedded newline)
Fix for PR java.util/47:
* configure, include/config.h: Rebuilt.
* configure.in: Don't look for ctime or ctime_r.
* Makefile.in: Rebuilt.
* Makefile.am (nat_source_files): Don't mention natDate.cc.
* java/util/natDate.cc: Removed.
* java/util/TimeZone.java (tzIDs, rawOffsets, timeZones): New
static fields.
(getAvailableIDs): Rewrote.
(getTimeZone): Rewrote.
* java/util/Date.java (toGMTString): New method.
(toLocaleString): New method.
(toString): Rewrote.
From-SVN: r29656
Diffstat (limited to 'libjava/java/util/natDate.cc')
-rw-r--r-- | libjava/java/util/natDate.cc | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/libjava/java/util/natDate.cc b/libjava/java/util/natDate.cc deleted file mode 100644 index 8fd4ef1..0000000 --- a/libjava/java/util/natDate.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (C) 1998, 1999 Cygnus Solutions - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -#include <config.h> - -// We want to make sure to pick up the POSIX ctime_r. Some systems, -// such as Solaris 2.6, have their own version as well. -#ifdef HAVE_CTIME_R -#define _POSIX_PTHREAD_SEMANTICS -#endif - -#include <gcj/cni.h> -#include <java/util/Date.h> -#include <java/lang/String.h> - -#include <time.h> - -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif - -#if HAVE_CTIME_R -/* Use overload resolution to find out the signature of ctime_r. */ - - /* This is Posix ctime_r(). */ -template <typename T_clock, typename T_buf, size_t buflen> -static inline char * -ctime_adaptor (char* (*ctime_r)(T_clock *clock, T_buf *buf), - time_t *clock, char (&buf)[buflen]) -{ - return ctime_r (clock, buf); -} - -/* This is an old-style ctime_r, used on IRIX 5.2. */ -template <typename T_clock, typename T_buf, typename T_buflen, size_t buflen> -static inline char * -ctime_adaptor (char* (*ctime_r)(T_clock *clock, T_buf *buf, T_buflen len), - time_t *clock, char (&buf)[buflen]) -{ - return ctime_r (clock, buf, buflen); -} -#endif - -jstring -java::util::Date::toString() -{ -#ifdef HAVE_CTIME_R - time_t t = millis / 1000; - char buf[30]; - return JvNewStringLatin1 (ctime_adaptor (ctime_r, &t, buf)); -#elif defined (HAVE_CTIME) - // FIXME: this isn't thread-safe. - time_t t = millis / 1000; - return JvNewStringLatin1 (ctime (&t)); -#else - return NULL; -#endif -} |