diff options
Diffstat (limited to 'cutils.c')
-rw-r--r-- | cutils.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -21,7 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include "vl.h" +#include "qemu-common.h" void pstrcpy(char *buf, int buf_size, const char *str) { @@ -82,6 +82,20 @@ int stristart(const char *str, const char *val, const char **ptr) return 1; } +time_t mktimegm(struct tm *tm) +{ + time_t t; + int y = tm->tm_year + 1900, m = tm->tm_mon + 1, d = tm->tm_mday; + if (m < 3) { + m += 12; + y--; + } + t = 86400 * (d + (153 * m - 457) / 5 + 365 * y + y / 4 - y / 100 + + y / 400 - 719469); + t += 3600 * tm->tm_hour + 60 * tm->tm_min + tm->tm_sec; + return t; +} + int hex2bin(char ch) { if (ch >= '0' && ch <= '9') |