Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / native_client / src / untrusted / nacl / clock_getres.c
1 /*
2  * Copyright (c) 2012 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 <time.h>
8
9 #include "native_client/src/untrusted/nacl/nacl_irt.h"
10
11 int clock_getres(clockid_t clock_id, struct timespec *res) {
12   if (!__libnacl_irt_init_fn(&__libnacl_irt_clock.clock_getres,
13                              __libnacl_irt_clock_init)) {
14     return -1;
15   }
16
17   int error = __libnacl_irt_clock.clock_getres(clock_id, res);
18   if (error) {
19     errno = error;
20     return -1;
21   }
22
23   return 0;
24 }