From a070c4fbe3cff184d224d1abb8a3101e3c11fc48 Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 19 Nov 2007 09:09:38 +0000 Subject: * configure.in: check struct timespec, clock_gettime, utimensat, struct stat.st_atim, struct stat.st_atimespec, struct stat.st_atimensec, struct stat.st_mtim, struct stat.st_mtimespec, struct stat.st_mtimensec, struct stat.st_ctim, struct stat.st_ctimespec, struct stat.st_ctimensec. * include/ruby/missing.h: provide struct timespec if not available. * time.c: support nanosecond-resolution using struct timespec. * include/ruby/intern.h: provide rb_time_nano_new. * file.c (utime_internal): use utimensat if available. (rb_file_s_utime): refactored. (rb_f_test): use stat_atime, stat_mtime, stat_ctime. (rb_stat_cmp): check tv_nsec. (stat_atimespec): new function. (stat_atime): ditto. (stat_mtimespec): ditto. (stat_mtime): ditto. (stat_ctimespec): ditto. (stat_ctime): ditto. (rb_stat_atime): use stat_atime. (rb_file_s_atime): ditto. (rb_file_atime): ditto. (rb_stat_mtime): use stat_mtime. (rb_file_s_mtime): ditto. (rb_file_mtime): ditto. (rb_file_ctime): use stat_ctime. (rb_file_s_ctime): ditto. (rb_stat_ctime): ditto. * variable.c (rb_copy_generic_ivar): clear clone's instance variables if obj has no instance variable. * marshal.c (w_object): dump instance variables of generated string for TYPE_USERDEF, even if original object has instance variables. * lib/time.rb (Time#xmlschema): use nsec instead of usec. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- include/ruby/intern.h | 3 ++- include/ruby/missing.h | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'include/ruby') diff --git a/include/ruby/intern.h b/include/ruby/intern.h index e9be986f4f..ca6937a42d 100644 --- a/include/ruby/intern.h +++ b/include/ruby/intern.h @@ -560,7 +560,8 @@ VALUE rb_barrier_new(void); VALUE rb_barrier_wait(VALUE self); VALUE rb_barrier_release(VALUE self); /* time.c */ -VALUE rb_time_new(time_t, time_t); +VALUE rb_time_new(time_t, long); +VALUE rb_time_nano_new(time_t, long); /* variable.c */ VALUE rb_mod_name(VALUE); VALUE rb_class_path(VALUE); diff --git a/include/ruby/missing.h b/include/ruby/missing.h index 007c546617..05002daea8 100644 --- a/include/ruby/missing.h +++ b/include/ruby/missing.h @@ -25,13 +25,20 @@ extern "C" { # define time_t long struct timeval { time_t tv_sec; /* seconds */ - time_t tv_usec; /* microseconds */ + long tv_usec; /* microseconds */ }; #endif #if defined(HAVE_SYS_TYPES_H) # include #endif +#if !defined(HAVE_STRUCT_TIMESPEC) +struct timespec { + time_t tv_sec; /* seconds */ + long tv_nsec; /* nanoseconds */ +}; +#endif + #ifndef HAVE_ACOSH extern double acosh(double); extern double asinh(double); -- cgit v1.2.3