=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/util.c,v retrieving revision 1.57 retrieving revision 1.58 diff -u -r1.57 -r1.58 --- src/usr.bin/cvs/util.c 2005/12/03 03:59:47 1.57 +++ src/usr.bin/cvs/util.c 2005/12/03 15:07:21 1.58 @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.57 2005/12/03 03:59:47 joris Exp $ */ +/* $OpenBSD: util.c,v 1.58 2005/12/03 15:07:21 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -1034,4 +1034,33 @@ cvs_freelines(dlines); cvs_freelines(plines); return (res); +} + +/* + * a hack to mimic and thus match gnu cvs behaviour. + */ +time_t +cvs_hack_time(time_t oldtime, int togmt) +{ + int l; + struct tm *t; + char tbuf[32]; + + if (togmt == 1) { + t = gmtime(&oldtime); + if (t == NULL) + return (0); + + return (mktime(t)); + } + + t = localtime(&oldtime); + + l = snprintf(tbuf, sizeof(tbuf), "%d/%d/%d GMT %d:%d:%d", + t->tm_mon + 1, t->tm_mday, t->tm_year + 1900, t->tm_hour, + t->tm_min, t->tm_sec); + if (l == -1 || l >= (int)sizeof(tbuf)) + return (0); + + return (cvs_date_parse(tbuf)); }