VirtualBox

Changeset 5308 in vbox for trunk/src/VBox/Devices/PC


Ignore:
Timestamp:
Oct 15, 2007 10:32:38 PM (17 years ago)
Author:
vboxsync
Message:

get rid of the struct tm mess.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevRTC.cpp

    r4787 r5308  
    103103#define REG_B_UIE 0x10
    104104
     105struct 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
    105118struct RTCState {
    106119    uint8_t cmos_data[128];
    107120    uint8_t cmos_index;
    108121    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;
    115123    int32_t irq;
    116124    /* periodic timer */
     
    267275static void rtc_set_time(RTCState *s)
    268276{
    269     struct tm *tm = &s->current_tm;
     277    struct my_tm *tm = &s->current_tm;
    270278
    271279    tm->tm_sec = from_bcd(s, s->cmos_data[RTC_SECONDS]);
     
    284292static void rtc_copy_date(RTCState *s)
    285293{
    286     const struct tm *tm = &s->current_tm;
     294    const struct my_tm *tm = &s->current_tm;
    287295
    288296    s->cmos_data[RTC_SECONDS] = to_bcd(s, tm->tm_sec);
     
    321329
    322330/* update 'tm' to the next second */
    323 static void rtc_next_second(struct tm *tm)
     331static void rtc_next_second(struct my_tm *tm)
    324332{
    325333    int days_in_month;
     
    458466}
    459467
    460 static void rtc_set_date(RTCState *s, const struct tm *tm)
     468static void rtc_set_date(RTCState *s, const struct my_tm *tm)
    461469{
    462470    s->current_tm = *tm;
     
    717725    /** @todo this should be (re)done at power on if we didn't load a state... */
    718726    RTCState   *pData = PDMINS2DATA(pDevIns, RTCState *);
    719     struct tm   Tm;
    720     struct tm  *pTm;
    721727
    722728    /*
     
    731737        RTTimeLocalExplode(&Time, &Now);
    732738
     739    struct my_tm Tm;
    733740    memset(&Tm, 0, sizeof(Tm));
    734741    Tm.tm_year = Time.i32Year - 1900;
     
    740747    Tm.tm_min  = Time.u8Minute;
    741748    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);
    746751
    747752    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.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette