1 /*
2  * Copyright (c) 2017, NVIDIA CORPORATION.  All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 /* clang-format off */
19 
20 /*	mclock3f.c - Implements LIB3F mclock subprogram.  */
21 #include "ent3f.h"
22 
23 /* assumes the Unix times system call */
24 
25 #if   defined(WINNT)
26 
27 #include <time.h>
28 
ENT3F(MCLOCK,mclock)29 int ENT3F(MCLOCK, mclock)(void) { return clock(); }
30 
31 #else
32 #include <sys/times.h>
33 
ENT3F(MCLOCK,mclock)34 int ENT3F(MCLOCK, mclock)(void)
35 {
36   struct tms buffer;
37 
38   times(&buffer);
39   return (buffer.tms_utime + buffer.tms_cutime + buffer.tms_cstime);
40 }
41 
42 #endif
43