[Cmake-commits] [cmake-commits] king committed cmCTestGIT.cxx 1.3 1.4
cmake-commits at cmake.org
cmake-commits at cmake.org
Mon Dec 21 10:29:03 EST 2009
Update of /cvsroot/CMake/CMake/Source/CTest
In directory public:/mounts/ram/cvs-serv4796/Source/CTest
Modified Files:
cmCTestGIT.cxx
Log Message:
Use human-readable Git commit times in Update.xml
Previously we produced commit times formatted like
1261403774 -0500
which is what the Git plumbing prints. Now we use a human-readable
format like
2009-12-21 15:28:06 -0500
which is still easy to machine-parse.
Index: cmCTestGIT.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestGIT.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -C 2 -d -r1.3 -r1.4
*** cmCTestGIT.cxx 28 Sep 2009 15:42:58 -0000 1.3
--- cmCTestGIT.cxx 21 Dec 2009 15:29:00 -0000 1.4
***************
*** 20,23 ****
--- 20,25 ----
#include <cmsys/Process.h>
+ #include <sys/types.h>
+ #include <time.h>
#include <ctype.h>
***************
*** 337,350 ****
this->ParsePerson(this->Line.c_str()+7, author);
this->Rev.Author = author.Name;
! char buf[1024];
if(author.TimeZone >= 0)
{
! sprintf(buf, "%lu +%04ld", author.Time, author.TimeZone);
}
else
{
! sprintf(buf, "%lu -%04ld", author.Time, -author.TimeZone);
}
! this->Rev.Date = buf;
}
}
--- 339,364 ----
this->ParsePerson(this->Line.c_str()+7, author);
this->Rev.Author = author.Name;
!
! // Convert the time to a human-readable format that is also easy
! // to machine-parse: "CCYY-MM-DD hh:mm:ss".
! time_t seconds = static_cast<time_t>(author.Time);
! struct tm* t = gmtime(&seconds);
! char dt[1024];
! sprintf(dt, "%04d-%02d-%02d %02d:%02d:%02d",
! t->tm_year+1900, t->tm_mon+1, t->tm_mday,
! t->tm_hour, t->tm_min, t->tm_sec);
! this->Rev.Date = dt;
!
! // Add the time-zone field "+zone" or "-zone".
! char tz[32];
if(author.TimeZone >= 0)
{
! sprintf(tz, " +%04ld", author.TimeZone);
}
else
{
! sprintf(tz, " -%04ld", -author.TimeZone);
}
! this->Rev.Date += tz;
}
}
More information about the Cmake-commits
mailing list