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 /*	gettim3f.c - Implements gettim subroutine.  */
21 
22 #if defined(WIN64) || defined(WIN32)
23 
24 #include <windows.h>
25 #include "ent3f.h"
26 
ENT3F(GETTIM,gettim)27 void ENT3F(GETTIM, gettim)(unsigned short *hr, unsigned short *min,
28                            unsigned short *sec, unsigned short *hsec)
29 {
30   SYSTEMTIME st;
31   GetLocalTime(&st); /* gets current time */
32   *hr = st.wHour;
33   *min = st.wMinute;
34   *sec = st.wSecond;
35   *hsec = st.wMilliseconds / 10;
36 }
37 
ENT3F(GETTIM4,gettim4)38 void ENT3F(GETTIM4, gettim4)(int *hr, int *min, int *sec, int *hsec)
39 {
40   SYSTEMTIME st;
41   GetLocalTime(&st); /* gets current time */
42   *hr = st.wHour;
43   *min = st.wMinute;
44   *sec = st.wSecond;
45   *hsec = st.wMilliseconds / 10;
46 }
47 
ENT3F(GETTIM8,gettim8)48 void ENT3F(GETTIM8, gettim8)(long long *hr, long long *min, long long *sec,
49                              long long *hsec)
50 {
51   SYSTEMTIME st;
52   GetLocalTime(&st); /* gets current time */
53   *hr = st.wHour;
54   *min = st.wMinute;
55   *sec = st.wSecond;
56   *hsec = st.wMilliseconds / 10;
57 }
58 #endif
59