mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Add stat_time function
This commit is contained in:
parent
70abda1ad4
commit
4794a8a7cf
Notes:
git
2021-08-24 09:23:27 +09:00
1 changed files with 9 additions and 6 deletions
15
file.c
15
file.c
|
@ -885,11 +885,16 @@ stat_atimespec(const struct stat *st)
|
|||
return ts;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
stat_time(const struct timespec ts)
|
||||
{
|
||||
return rb_time_nano_new(ts.tv_sec, ts.tv_nsec);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
stat_atime(const struct stat *st)
|
||||
{
|
||||
struct timespec ts = stat_atimespec(st);
|
||||
return rb_time_nano_new(ts.tv_sec, ts.tv_nsec);
|
||||
return stat_time(stat_atimespec(st));
|
||||
}
|
||||
|
||||
static struct timespec
|
||||
|
@ -912,8 +917,7 @@ stat_mtimespec(const struct stat *st)
|
|||
static VALUE
|
||||
stat_mtime(const struct stat *st)
|
||||
{
|
||||
struct timespec ts = stat_mtimespec(st);
|
||||
return rb_time_nano_new(ts.tv_sec, ts.tv_nsec);
|
||||
return stat_time(stat_mtimespec(st));
|
||||
}
|
||||
|
||||
static struct timespec
|
||||
|
@ -936,8 +940,7 @@ stat_ctimespec(const struct stat *st)
|
|||
static VALUE
|
||||
stat_ctime(const struct stat *st)
|
||||
{
|
||||
struct timespec ts = stat_ctimespec(st);
|
||||
return rb_time_nano_new(ts.tv_sec, ts.tv_nsec);
|
||||
return stat_time(stat_ctimespec(st));
|
||||
}
|
||||
|
||||
#define HAVE_STAT_BIRTHTIME
|
||||
|
|
Loading…
Reference in a new issue