I also needed to modify ctime a while ago and wrote the following setcreatetime.cpp:
#include <stdio.h>
#include <time.h>
#include <Entry.h>
int main(int argc, char* argv[])
{
BEntry* entry;
int year, month, day, hour, min, sec;
if(argc != 3)
{
printf("Usage: setcreatetime [filename] [Date/Time in format YYYY:MM:DD MI:HH:SS]\n");
return 0;
}
if(sscanf(argv[2], "%4d:%2d:%2d %2d:%2d:%2d", &year, &month, &day, &hour, &min, &sec) != 6)
{
printf("Invalid date/time format\n");
return -1;
}
struct tm newTime = {0};
newTime.tm_year = year - 1900;
newTime.tm_mon = month - 1;
newTime.tm_mday = day;
newTime.tm_hour = hour;
newTime.tm_min = min;
newTime.tm_sec = sec;
entry = new BEntry(argv[1]);
entry->SetCreationTime(mktime(&newTime));
}