[cig-commits] r5526 - in long/3D/Gale/trunk/src/StGermain: .
Base/Context/src
walter at geodynamics.org
walter at geodynamics.org
Thu Dec 7 14:16:33 PST 2006
Author: walter
Date: 2006-12-07 14:16:32 -0800 (Thu, 07 Dec 2006)
New Revision: 5526
Modified:
long/3D/Gale/trunk/src/StGermain/
long/3D/Gale/trunk/src/StGermain/Base/Context/src/AbstractContext.c
Log:
r3194 at earth: boo | 2006-12-07 14:10:38 -0800
r3190 at earth (orig r3897): PatrickSunter | 2006-11-22 14:51:04 -0800
Adding a requested feature from Einat: when saving the
flattened input file of a run, also save a copy with an
explicit time stamp in the filename, so you don't accidentally
over-ride old experiment input files.
Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
- 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:3193
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3896
+ 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:3194
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3897
Modified: long/3D/Gale/trunk/src/StGermain/Base/Context/src/AbstractContext.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Context/src/AbstractContext.c 2006-12-07 22:16:19 UTC (rev 5525)
+++ long/3D/Gale/trunk/src/StGermain/Base/Context/src/AbstractContext.c 2006-12-07 22:16:32 UTC (rev 5526)
@@ -49,6 +49,7 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <time.h>
/* AbstractContext entry point names */
Type AbstractContext_EP_Construct = "Context_Construct";
@@ -209,7 +210,12 @@
if ( self->rank == 0 ) {
XML_IO_Handler* ioHandler;
- char* inputfileRecord;
+ char* inputfileRecord;
+ char* inputfileRecordWithDateTimeStamp;
+ time_t currTime;
+ struct tm* timeInfo;
+ int adjustedYear;
+ int adjustedMonth;
Stream* s = Journal_Register( Info_Type, XML_IO_Handler_Type );
@@ -219,15 +225,27 @@
ioHandler = XML_IO_Handler_New();
- /* Set file name */
+ /* Set file names */
Stg_asprintf( &inputfileRecord, "%s/%s", self->outputPath, "input.xml" );
+ currTime = time( NULL );
+ timeInfo = localtime( &currTime );
+ /* See man localtime() for why to adjust these */
+ adjustedYear = 1900 + timeInfo->tm_year;
+ adjustedMonth = 1 + timeInfo->tm_mon;
+ Stg_asprintf( &inputfileRecordWithDateTimeStamp, "%s/%s.%d%d%d.%d.%d.%d.%s", self->outputPath, "input",
+ adjustedYear, adjustedMonth, timeInfo->tm_mday,
+ timeInfo->tm_hour, timeInfo->tm_min, timeInfo->tm_sec ,
+ "xml" );
+
IO_Handler_WriteAllToFile( ioHandler, inputfileRecord, self->dictionary );
+ IO_Handler_WriteAllToFile( ioHandler, inputfileRecordWithDateTimeStamp, self->dictionary );
Stream_EnableSelfOnly( s, isEnabled );
Stg_Class_Delete( ioHandler );
Memory_Free( inputfileRecord );
+ Memory_Free( inputfileRecordWithDateTimeStamp );
}
More information about the cig-commits
mailing list