Blender
V5.0
source
blender
blenlib
intern
math_time.cc
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2021 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9
#include "
BLI_math_base.h
"
10
#include "
BLI_math_time.h
"
11
12
void
BLI_math_time_seconds_decompose
(
double
seconds,
13
double
*r_days,
14
double
*r_hours,
15
double
*r_minutes,
16
double
*r_seconds,
17
double
*r_milliseconds)
18
{
19
BLI_assert
(r_days !=
nullptr
|| r_hours !=
nullptr
|| r_minutes !=
nullptr
||
20
r_seconds !=
nullptr
|| r_milliseconds !=
nullptr
);
21
22
if
(r_days !=
nullptr
) {
23
seconds =
modf
(seconds /
SECONDS_IN_DAY
, r_days) *
SECONDS_IN_DAY
;
24
}
25
if
(r_hours !=
nullptr
) {
26
seconds =
modf
(seconds /
SECONDS_IN_HOUR
, r_hours) *
SECONDS_IN_HOUR
;
27
}
28
if
(r_minutes !=
nullptr
) {
29
seconds =
modf
(seconds /
SECONDS_IN_MINUTE
, r_minutes) *
SECONDS_IN_MINUTE
;
30
}
31
if
(r_seconds !=
nullptr
) {
32
seconds =
modf
(seconds, r_seconds);
33
}
34
if
(r_milliseconds !=
nullptr
) {
35
*r_milliseconds = seconds /
SECONDS_IN_MILLISECONDS
;
36
}
37
else
if
(r_seconds !=
nullptr
) {
38
*r_seconds += seconds;
39
}
40
else
if
(r_minutes !=
nullptr
) {
41
*r_minutes += seconds /
SECONDS_IN_MINUTE
;
42
}
43
else
if
(r_hours !=
nullptr
) {
44
*r_hours += seconds /
SECONDS_IN_HOUR
;
45
}
46
else
if
(r_days !=
nullptr
) {
47
*r_days = seconds /
SECONDS_IN_DAY
;
48
}
49
}
BLI_assert
#define BLI_assert(a)
Definition
BLI_assert.h:46
BLI_math_base.h
BLI_math_time.h
SECONDS_IN_MILLISECONDS
#define SECONDS_IN_MILLISECONDS
Definition
BLI_math_time.h:15
SECONDS_IN_MINUTE
#define SECONDS_IN_MINUTE
Definition
BLI_math_time.h:16
SECONDS_IN_HOUR
#define SECONDS_IN_HOUR
Definition
BLI_math_time.h:22
SECONDS_IN_DAY
#define SECONDS_IN_DAY
Definition
BLI_math_time.h:21
modf
#define modf
Definition
gpu_shader_cxx_builtin.hh:116
BLI_math_time_seconds_decompose
void BLI_math_time_seconds_decompose(double seconds, double *r_days, double *r_hours, double *r_minutes, double *r_seconds, double *r_milliseconds)
Definition
math_time.cc:12
Generated on
for Blender by
doxygen
1.16.1