target/ppc: Sign-extend large decrementer to 64-bits
[qemu/kevin.git] / include / sysemu / rtc.h
blob0fc8ad6fdf1e38ca0c7d1488b7899797c18bb1aa
1 /*
2 * RTC configuration and clock read
4 * Copyright (c) 2003-2021 QEMU contributors
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
25 #ifndef SYSEMU_RTC_H
26 #define SYSEMU_RTC_H
28 /**
29 * qemu_get_timedate: Get the current RTC time
30 * @tm: struct tm to fill in with RTC time
31 * @offset: offset in seconds to adjust the RTC time by before
32 * converting to struct tm format.
34 * This function fills in @tm with the current RTC time, as adjusted
35 * by @offset (for example, if @offset is 3600 then the returned time/date
36 * will be one hour further ahead than the current RTC time).
38 * The usual use is by RTC device models, which should call this function
39 * to find the time/date value that they should return to the guest
40 * when it reads the RTC registers.
42 * The behaviour of the clock whose value this function returns will
43 * depend on the -rtc command line option passed by the user.
45 void qemu_get_timedate(struct tm *tm, time_t offset);
47 /**
48 * qemu_timedate_diff: Return difference between a struct tm and the RTC
49 * @tm: struct tm containing the date/time to compare against
51 * Returns the difference in seconds between the RTC clock time
52 * and the date/time specified in @tm. For example, if @tm specifies
53 * a timestamp one hour further ahead than the current RTC time
54 * then this function will return 3600.
56 time_t qemu_timedate_diff(struct tm *tm);
58 #endif