Line data Source code
1 : /* SPDX-FileCopyrightText: Copyright 2026 Cozens Software Solutions Limited
2 : * SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 OR LicenseRef-PolyForm-Internal-Use-1.0.0 OR LicenseRef-COSOSO-Commercial
3 : */
4 :
5 : #include "SolidSyslogVxWorks64SysUpTime.h"
6 :
7 : #include <stdint.h>
8 :
9 : #include "vxWorks.h"
10 :
11 : #include "sysLib.h"
12 : #include "tickLib.h"
13 :
14 : enum
15 : {
16 : HUNDREDTHS_PER_SECOND = 100
17 : };
18 :
19 : /* Scaled in 64 bits, so only the result wraps: the tick count would overflow
20 : * in 32. */
21 47 : uint32_t SolidSyslogVxWorks64_GetSysUpTime(void)
22 : {
23 47 : UINT64 hundredths = (tick64Get() * (UINT64) HUNDREDTHS_PER_SECOND) / (UINT64) sysClkRateGet();
24 47 : return (uint32_t) hundredths;
25 : }
|