Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: src/untrusted/nacl/utime.c

Issue 1065963002: Add utime implementation to libnacl (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/untrusted/nacl/stubs/utime.c ('k') | tests/syscalls/syscalls.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « src/untrusted/nacl/stubs/utime.c ('k') | tests/syscalls/syscalls.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698