]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Replace calls to deprecated libbatch class Date by direct calls to localtime and... BR_LIBBATCH_2_0
authorbarate <barate>
Mon, 28 Jan 2013 13:56:47 +0000 (13:56 +0000)
committerbarate <barate>
Mon, 28 Jan 2013 13:56:47 +0000 (13:56 +0000)
src/Launcher/BatchTest.cxx
src/Launcher/Launcher.cxx
src/Launcher/Launcher_Job.cxx
src/Launcher/Launcher_Job.hxx

index 63f0a53dddf73046937bece8b749ec96b7a03b88..80f15513ae9a35c1add576a9d253a533b3632991 100644 (file)
@@ -24,7 +24,6 @@
 #include "Launcher.hxx"
 
 #ifdef WITH_LIBBATCH
-#include <libbatch/Date.hxx>
 #include <libbatch/MpiImpl.hxx>
 #endif
 
@@ -42,24 +41,16 @@ BatchTest::BatchTest(const Engines::ResourceDefinition& batch_descr)
   _batch_descr = batch_descr;
 
   // Getting date
-  Batch::Date date = Batch::Date(time(0));
-  _date = date.str();
-  int lend = _date.size() ;
-  int i = 0 ;
-  while (i < lend) 
-  {
-    if (_date[i] == '/' || _date[i] == '-' || _date[i] == ':' ) 
-    {
-      _date[i] = '_' ;
-    }
-    i++ ;
-  }
-  
+  const size_t BUFSIZE = 32;
+  char date[BUFSIZE];
+  time_t curtime = time(NULL);
+  strftime(date, BUFSIZE, "%Y_%m_%d__%H_%M_%S", localtime(&curtime));
+
   // Creating test temporary file
   _test_filename =  "/tmp/";
-  _test_filename +=  _date + "_test_cluster_file_";
+  _test_filename += std::string(date) + "_test_cluster_file_";
   _test_filename += _batch_descr.hostname.in();
-  _base_filename = _date + "_test_cluster_file_" + _batch_descr.hostname.in();
+  _base_filename = std::string(date) + "_test_cluster_file_" + _batch_descr.hostname.in();
 #endif
 }
 
index a690b48b59f1d4f55e99a97ff6e7ad709194240b..f33eb976d2612b51009bf99ab69ec34f80b952bf 100644 (file)
@@ -21,7 +21,6 @@
 //
 
 #ifdef WITH_LIBBATCH
-#include <libbatch/Date.hxx>
 #include <libbatch/BatchManagerCatalog.hxx>
 #include <libbatch/FactBatchManager.hxx>
 #include <libbatch/BatchManager.hxx>
index f505b062eb443f48b21f74e32491af4d1bb0781e..b6744859c440f8405ab7e87987d2422d9187c0dd 100644 (file)
@@ -467,19 +467,12 @@ Launcher::Job::common_job_params()
   // We define a default directory based on user time
   if (_work_directory == "")
   {
-    std::string thedate;
-    Batch::Date date = Batch::Date(time(0));
-    thedate = date.str();
-    int lend = thedate.size() ;
-    int i = 0 ;
-    while ( i < lend ) {
-      if ( thedate[i] == '/' || thedate[i] == '-' || thedate[i] == ':' ) {
-        thedate[i] = '_' ;
-      }
-      i++ ;
-    }
-    _work_directory = std::string("$HOME/Batch/");
-    _work_directory += thedate;
+    const size_t BUFSIZE = 32;
+    char date[BUFSIZE];
+    time_t curtime = time(NULL);
+    strftime(date, BUFSIZE, "%Y_%m_%d__%H_%M_%S", localtime(&curtime));
+    _work_directory = std::string("$HOME/Batch/workdir_");
+    _work_directory += date;
   }
   params[Batch::WORKDIR] = _work_directory;
 
index 1a2fb230cee310d61df2d7bee26a805fb56b4cf0..02b9d538ac8bc7ea9e8dccd667d81ba539394889 100644 (file)
@@ -39,7 +39,6 @@
 
 #ifdef WITH_LIBBATCH
 #include <libbatch/Job.hxx>
-#include <libbatch/Date.hxx>
 #include <libbatch/JobId.hxx>
 #include <libbatch/GenericException.hxx>
 #endif