2 * Copyright 2002-2009, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
12 #include <NodeMonitor.h>
14 #include <errno_private.h>
18 #define RETURN_AND_SET_ERRNO(err) \
27 utime(const char *path
, const struct utimbuf
*times
)
33 stat
.st_atim
.tv_sec
= times
->actime
;
34 stat
.st_mtim
.tv_sec
= times
->modtime
;
35 stat
.st_atim
.tv_nsec
= stat
.st_mtim
.tv_nsec
= 0;
37 bigtime_t now
= real_time_clock_usecs();
38 stat
.st_atim
.tv_sec
= stat
.st_mtim
.tv_sec
= now
/ 1000000;
39 stat
.st_atim
.tv_nsec
= stat
.st_mtim
.tv_nsec
= (now
% 1000000) * 1000;
42 status
= _kern_write_stat(-1, path
, true, &stat
, sizeof(struct stat
),
43 B_STAT_MODIFICATION_TIME
| B_STAT_ACCESS_TIME
);
45 RETURN_AND_SET_ERRNO(status
);