FreeBSD/sys/compat/cloudabi/cloudabi_file.c
/* Converts timestamps to arguments to futimens() and utimensat(). */
Converts timestamps to arguments to futimens() and utimensat().
Converts timestamps to arguments to futimens () and utimensat () .
static void
convert_utimens_arguments(const cloudabi_filestat_t *fs,
    cloudabi_fsflags_t flags, struct timespec *ts)
{
	if ((flags & CLOUDABI_FILESTAT_ATIM_NOW) != 0) {
		ts[0].tv_nsec = UTIME_NOW;
	} else if ((flags & CLOUDABI_FILESTAT_ATIM) != 0) {
		ts[0].tv_sec = fs->st_atim / 1000000000;
		ts[0].tv_nsec = fs->st_atim % 1000000000;
	} else {
		ts[0].tv_nsec = UTIME_OMIT;
	}
	if ((flags & CLOUDABI_FILESTAT_MTIM_NOW) != 0) {
		ts[1].tv_nsec = UTIME_NOW;
	} else if ((flags & CLOUDABI_FILESTAT_MTIM) != 0) {
		ts[1].tv_sec = fs->st_mtim / 1000000000;
		ts[1].tv_nsec = fs->st_mtim % 1000000000;
	} else {
		ts[1].tv_nsec = UTIME_OMIT;
	}
}
static void convert_utimens_arguments ( const cloudabi_filestat_t * fs , cloudabi_fsflags_t flags , struct timespec * ts ) { if ( ( flags & CLOUDABI_FILESTAT_ATIM_NOW ) != 0 ) { ts [ 0 ] . tv_nsec = UTIME_NOW ; } else if ( ( flags & CLOUDABI_FILESTAT_ATIM ) != 0 ) { ts [ 0 ] . tv_sec = fs -> st_atim / 1000000000 ; ts [ 0 ] . tv_nsec = fs -> st_atim % 1000000000 ; } else { ts [ 0 ] . tv_nsec = UTIME_OMIT ; } if ( ( flags & CLOUDABI_FILESTAT_MTIM_NOW ) != 0 ) { ts [ 1 ] . tv_nsec = UTIME_NOW ; } else if ( ( flags & CLOUDABI_FILESTAT_MTIM ) != 0 ) { ts [ 1 ] . tv_sec = fs -> st_mtim / 1000000000 ; ts [ 1 ] . tv_nsec = fs -> st_mtim % 1000000000 ; } else { ts [ 1 ] . tv_nsec = UTIME_OMIT ; } }
Converts timestamps to arguments to futimens() and utimensat().
Converts timestamps to arguments to futimens () and utimensat () .