
* configure: Rebuilt. * configure.in: Build include/Makefile. * Makefile.in: Rebuilt. * Makefile.am (SUBDIRS): Added gcj and include. (install-data-local): New target. (extra_headers): New macro. * include/Makefile.in: New file. * include/Makefile.am: New file. * interpret.cc: Don't include gcj/field.h or gcj/cni.h. * java/lang/reflect/natField.cc: Don't include gcj/field.h or gcj/cni.h. * boehm.cc: Don't include java-threads.h or gcj/field.h. * resolve.cc: Include config.h. * defineclass.cc: Include config.h. * include/java-interp.h: Don't include config.h. * include/jvm.h: Include java-threads.h, Object.h, java-gc.h, cni.h. * gcj/javaprims.h: Regenerated namespace decls. * classes.pl (scan): Don't put `;' after closing brace. * Makefile.in: Rebuilt. * Makefile.am (INCLUDES): Added -I for top_srcdir. * configure.in: Create gcj/Makefile. * gcj/Makefile.in: New file. * gcj/Makefile.am: New file. * java/lang/Object.h: Don't include any other headers. * gcj/array.h: Renamed from include/java-array.h. * gcj/field.h: Renamed from include/java-field.h. * gcj/method.h: Renamed from include/java-method.h. * gcj/cni.h, gcj/javaprims.h: Moved from include/. Updated all files to reflect new include structure. From-SVN: r29278
67 lines
1.6 KiB
C++
67 lines
1.6 KiB
C++
/* 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
|
|
}
|