Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stat_time function #4761

Merged
merged 1 commit into from Aug 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 9 additions & 6 deletions file.c
Expand Up @@ -886,12 +886,17 @@ stat_atimespec(const struct stat *st)
}

static VALUE
stat_atime(const struct stat *st)
stat_time(const struct timespec ts)
{
struct timespec ts = stat_atimespec(st);
return rb_time_nano_new(ts.tv_sec, ts.tv_nsec);
}

static VALUE
stat_atime(const struct stat *st)
{
return stat_time(stat_atimespec(st));
}

static struct timespec
stat_mtimespec(const struct stat *st)
{
Expand All @@ -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
Expand All @@ -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
Expand Down