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

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 gets added to the newlib
14 * headers.
15 */
16 int utimes(const char *filename, const struct timeval tv[2]);
17
18 /*
19 * Implementation of utime() based on utimes(). utime() works just like
20 * utimes() but only supports timestamps with a granularity of one second
21 * (time_t). This means we we can use utimes() to implement utime() by simply
22 * setting tv_usec 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