Line data Source code
1 : /* Copyright 2017 noseglasses <shinynoseglasses@gmail.com>
2 : *
3 : * This program is free software: you can redistribute it and/or modify
4 : * it under the terms of the GNU Lesser General Public License as published by
5 : * the Free Software Foundation, either version 3 of the License, or
6 : * (at your option) any later version.
7 : *
8 : * This program is distributed in the hope that it will be useful,
9 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 : * GNU Lesser General Public License for more details.
12 : *
13 : * You should have received a copy of the GNU Lesser General Public License
14 : * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 : */
16 :
17 : #include "ppg_time.h"
18 : #include "ppg_global.h"
19 : #include "detail/ppg_context_detail.h"
20 :
21 0 : static void ppg_default_time(PPG_Time *time)
22 : {
23 0 : *time = 0;
24 0 : }
25 :
26 0 : static void ppg_default_time_difference(PPG_Time time1,
27 : PPG_Time time2,
28 : PPG_Time *delta)
29 : {
30 : PPG_UNUSED(time1);
31 : PPG_UNUSED(time2);
32 0 : *delta = 0;
33 0 : }
34 :
35 0 : PPG_Time_Comparison_Result_Type ppg_default_time_comparison(
36 : PPG_Time time1,
37 : PPG_Time time2)
38 : {
39 : PPG_UNUSED(time1);
40 : PPG_UNUSED(time2);
41 0 : return 0;
42 : }
43 :
44 41 : void ppg_time_manager_init(PPG_Time_Manager *time_manager)
45 : {
46 41 : time_manager->time = ppg_default_time;
47 41 : time_manager->time_difference = ppg_default_time_difference;
48 41 : time_manager->compare_times = ppg_default_time_comparison;
49 41 : }
50 :
51 41 : PPG_Time_Manager ppg_global_set_time_manager(PPG_Time_Manager time_manager)
52 : {
53 41 : PPG_Time_Manager old_time_manager = ppg_context->time_manager;
54 :
55 41 : ppg_context->time_manager = time_manager;
56 :
57 41 : return old_time_manager;
58 : }
59 :
60 0 : PPG_Time_Manager ppg_global_get_time_manager(void)
61 : {
62 0 : return ppg_context->time_manager;
63 : }
|