Revision 3c6b2088

b/cutils.c
81 81
        *ptr = p;
82 82
    return 1;
83 83
}
84

  
85
time_t mktimegm(struct tm *tm)
86
{
87
    time_t t;
88
    int y = tm->tm_year + 1900, m = tm->tm_mon + 1, d = tm->tm_mday;
89
    if (m < 3) {
90
        m += 12;
91
        y--;
92
    }
93
    t = 86400 * (d + (153 * m - 457) / 5 + 365 * y + y / 4 - y / 100 + 
94
                 y / 400 - 719469);
95
    t += 3600 * tm->tm_hour + 60 * tm->tm_min + tm->tm_sec;
96
    return t;
97
}
b/vl.c
8116 8116
                        }
8117 8117
                        tm.tm_year -= 1900;
8118 8118
                        tm.tm_mon--;
8119
                        rtc_start_date = timegm(&tm);
8119
                        rtc_start_date = mktimegm(&tm);
8120 8120
                        if (rtc_start_date == -1) {
8121 8121
                        date_fail:
8122 8122
                            fprintf(stderr, "Invalid date format. Valid format are:\n"
b/vl.h
123 123
char *pstrcat(char *buf, int buf_size, const char *s);
124 124
int strstart(const char *str, const char *val, const char **ptr);
125 125
int stristart(const char *str, const char *val, const char **ptr);
126
time_t mktimegm(struct tm *tm);
126 127

  
127 128
/* vl.c */
128 129
uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);

Also available in: Unified diff