Revision f6503059 hw/pxa2xx.c

b/hw/pxa2xx.c
1183 1183

  
1184 1184
static void pxa2xx_rtc_init(struct pxa2xx_state_s *s)
1185 1185
{
1186
    struct tm *tm;
1187
    time_t ti;
1186
    struct tm tm;
1188 1187
    int wom;
1189 1188

  
1190 1189
    s->rttr = 0x7fff;
1191 1190
    s->rtsr = 0;
1192 1191

  
1193
    time(&ti);
1194
    if (rtc_utc)
1195
        tm = gmtime(&ti);
1196
    else
1197
        tm = localtime(&ti);
1198
    wom = ((tm->tm_mday - 1) / 7) + 1;
1199

  
1200
    s->last_rcnr = (uint32_t) ti;
1201
    s->last_rdcr = (wom << 20) | ((tm->tm_wday + 1) << 17) |
1202
            (tm->tm_hour << 12) | (tm->tm_min << 6) | tm->tm_sec;
1203
    s->last_rycr = ((tm->tm_year + 1900) << 9) |
1204
            ((tm->tm_mon + 1) << 5) | tm->tm_mday;
1205
    s->last_swcr = (tm->tm_hour << 19) |
1206
            (tm->tm_min << 13) | (tm->tm_sec << 7);
1192
    qemu_get_timedate(&tm, 0);
1193
    wom = ((tm.tm_mday - 1) / 7) + 1;
1194

  
1195
    s->last_rcnr = (uint32_t) mktime(&tm);
1196
    s->last_rdcr = (wom << 20) | ((tm.tm_wday + 1) << 17) |
1197
            (tm.tm_hour << 12) | (tm.tm_min << 6) | tm.tm_sec;
1198
    s->last_rycr = ((tm.tm_year + 1900) << 9) |
1199
            ((tm.tm_mon + 1) << 5) | tm.tm_mday;
1200
    s->last_swcr = (tm.tm_hour << 19) |
1201
            (tm.tm_min << 13) | (tm.tm_sec << 7);
1207 1202
    s->last_rtcpicr = 0;
1208 1203
    s->last_hz = s->last_sw = s->last_pi = qemu_get_clock(rt_clock);
1209 1204

  

Also available in: Unified diff