Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2015 The Native Client Authors. All rights reserved. | |
| 3 * Use of this source code is governed by a BSD-style license that can be | |
| 4 * found in the LICENSE file. | |
| 5 */ | |
| 6 | |
| 7 #include <errno.h> | |
| 8 #include <sys/types.h> | |
| 9 #include <sys/time.h> | |
| 10 #include <utime.h> | |
| 11 | |
| 12 /* | |
| 13 * TODO(sbc): remove this once utimes declaration get added to the newlib | |
|
Mark Seaborn
2015/04/15 18:14:18
"gets"
Sam Clegg
2015/04/15 20:46:39
Done.
| |
| 14 * headers. | |
| 15 */ | |
| 16 int utimes(const char *filename, const struct timeval tv[2]); | |
| 17 | |
| 18 /* | |
| 19 * Implementation of utime based on the utimes. utime works just like utimes | |
|
Mark Seaborn
2015/04/15 18:14:18
"the utimes" -> "utimes"
Suggestion: adding "()"
Sam Clegg
2015/04/15 20:46:40
Done.
| |
| 20 * but only support timestamps with a granularity of one second (time_t). This | |
|
Mark Seaborn
2015/04/15 18:14:18
"supports"
Sam Clegg
2015/04/15 20:46:40
Done.
| |
| 21 * means we we can use utimes to impelement utime by simply setting tv_sec | |
|
Mark Seaborn
2015/04/15 18:14:18
"implement". Also, you mean "tv_usec" not "tv_sec
Sam Clegg
2015/04/15 20:46:40
Done.
| |
| 22 * fields to zero. | |
| 23 */ | |
| 24 int utime(const char *filename, const struct utimbuf *buf) { | |
| 25 struct timeval times[2]; | |
| 26 struct timeval *tv = NULL; | |
| 27 if (buf != NULL) { | |
| 28 times[0].tv_sec = buf->actime; | |
| 29 times[1].tv_sec = buf->modtime; | |
| 30 times[0].tv_usec = 0; | |
| 31 times[1].tv_usec = 0; | |
| 32 tv = times; | |
| 33 } | |
| 34 | |
| 35 return utimes(filename, tv); | |
| 36 } | |
| OLD | NEW |