Changeset 5308 in vbox for trunk/src/VBox/Devices/PC
- Timestamp:
- Oct 15, 2007 10:32:38 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevRTC.cpp
r4787 r5308 103 103 #define REG_B_UIE 0x10 104 104 105 struct my_tm 106 { 107 int32_t tm_sec; 108 int32_t tm_min; 109 int32_t tm_hour; 110 int32_t tm_mday; 111 int32_t tm_mon; 112 int32_t tm_year; 113 int32_t tm_wday; 114 int32_t tm_yday; 115 }; 116 117 105 118 struct RTCState { 106 119 uint8_t cmos_data[128]; 107 120 uint8_t cmos_index; 108 121 uint8_t Alignment0[7]; 109 struct tm current_tm; 110 #if HC_ARCH_BITS == 64 && GC_ARCH_BITS == 32 && IN_GC 111 # if !defined(RT_OS_WINDOWS) 112 uint32_t Alignment1[3]; 113 # endif 114 #endif 122 struct my_tm current_tm; 115 123 int32_t irq; 116 124 /* periodic timer */ … … 267 275 static void rtc_set_time(RTCState *s) 268 276 { 269 struct tm *tm = &s->current_tm;277 struct my_tm *tm = &s->current_tm; 270 278 271 279 tm->tm_sec = from_bcd(s, s->cmos_data[RTC_SECONDS]); … … 284 292 static void rtc_copy_date(RTCState *s) 285 293 { 286 const struct tm *tm = &s->current_tm;294 const struct my_tm *tm = &s->current_tm; 287 295 288 296 s->cmos_data[RTC_SECONDS] = to_bcd(s, tm->tm_sec); … … 321 329 322 330 /* update 'tm' to the next second */ 323 static void rtc_next_second(struct tm *tm)331 static void rtc_next_second(struct my_tm *tm) 324 332 { 325 333 int days_in_month; … … 458 466 } 459 467 460 static void rtc_set_date(RTCState *s, const struct tm *tm)468 static void rtc_set_date(RTCState *s, const struct my_tm *tm) 461 469 { 462 470 s->current_tm = *tm; … … 717 725 /** @todo this should be (re)done at power on if we didn't load a state... */ 718 726 RTCState *pData = PDMINS2DATA(pDevIns, RTCState *); 719 struct tm Tm;720 struct tm *pTm;721 727 722 728 /* … … 731 737 RTTimeLocalExplode(&Time, &Now); 732 738 739 struct my_tm Tm; 733 740 memset(&Tm, 0, sizeof(Tm)); 734 741 Tm.tm_year = Time.i32Year - 1900; … … 740 747 Tm.tm_min = Time.u8Minute; 741 748 Tm.tm_sec = Time.u8Second; 742 Tm.tm_isdst = -1; 743 pTm = &Tm; 744 745 rtc_set_date(pData, pTm); 749 750 rtc_set_date(pData, &Tm); 746 751 747 752 int iYear = to_bcd(pData, (Tm.tm_year / 100) + 19); /* tm_year is 1900 based */
Note:
See TracChangeset
for help on using the changeset viewer.