Lines Matching full:time

3  * Simulate an I2C real time clock
10 * This is a test driver. It starts off with the current time of the machine,
11 * but also supports setting the time, using an offset from the current
13 * time-keeping. It does not change the system time.
33 * @base_time: Base system time when RTC device was bound
34 * @offset: RTC offset from current system time
35 * @use_system_time: true to use system time, false to use @base_time
86 static int sandbox_i2c_rtc_get(struct udevice *dev, struct rtc_time *time) in sandbox_i2c_rtc_get() argument
99 rtc_to_tm(now + plat->offset, time); in sandbox_i2c_rtc_get()
104 static int sandbox_i2c_rtc_set(struct udevice *dev, const struct rtc_time *time) in sandbox_i2c_rtc_set() argument
116 plat->offset = rtc_mktime(time) - now; in sandbox_i2c_rtc_set()
121 /* Update the current time in the registers */
125 struct rtc_time time; in sandbox_i2c_rtc_prepare_read() local
128 ret = sandbox_i2c_rtc_get(emul, &time); in sandbox_i2c_rtc_prepare_read()
132 plat->reg[REG_SEC] = time.tm_sec; in sandbox_i2c_rtc_prepare_read()
133 plat->reg[REG_MIN] = time.tm_min; in sandbox_i2c_rtc_prepare_read()
134 plat->reg[REG_HOUR] = time.tm_hour; in sandbox_i2c_rtc_prepare_read()
135 plat->reg[REG_MDAY] = time.tm_mday; in sandbox_i2c_rtc_prepare_read()
136 plat->reg[REG_MON] = time.tm_mon; in sandbox_i2c_rtc_prepare_read()
137 plat->reg[REG_YEAR] = time.tm_year - 1900; in sandbox_i2c_rtc_prepare_read()
138 plat->reg[REG_WDAY] = time.tm_wday; in sandbox_i2c_rtc_prepare_read()
146 struct rtc_time time; in sandbox_i2c_rtc_complete_write() local
149 time.tm_sec = plat->reg[REG_SEC]; in sandbox_i2c_rtc_complete_write()
150 time.tm_min = plat->reg[REG_MIN]; in sandbox_i2c_rtc_complete_write()
151 time.tm_hour = plat->reg[REG_HOUR]; in sandbox_i2c_rtc_complete_write()
152 time.tm_mday = plat->reg[REG_MDAY]; in sandbox_i2c_rtc_complete_write()
153 time.tm_mon = plat->reg[REG_MON]; in sandbox_i2c_rtc_complete_write()
154 time.tm_year = plat->reg[REG_YEAR] + 1900; in sandbox_i2c_rtc_complete_write()
155 time.tm_wday = plat->reg[REG_WDAY]; in sandbox_i2c_rtc_complete_write()
157 ret = sandbox_i2c_rtc_set(emul, &time); in sandbox_i2c_rtc_complete_write()