00001
00002
00003
00004
00005
00006 #include "chromabase.h"
00007 #include "util/info/unique_id.h"
00008 #include <time.h>
00009
00010 namespace Chroma
00011 {
00012
00013
00014
00015
00016
00017
00018
00019 std::string uniqueId()
00020 {
00021 START_CODE();
00022
00023
00024
00025 struct tm Oct_1_struct = {0};
00026 time_t Oct_1_t;
00027 Oct_1_struct.tm_year = 99;
00028 Oct_1_struct.tm_mon = 10;
00029 Oct_1_struct.tm_mday = 1;
00030 Oct_1_t = mktime(&Oct_1_struct);
00031 if (Oct_1_t == (time_t)-1)
00032 {
00033 QDPIO::cerr << __func__ << ": some error generating ID" << endl;
00034 exit(1);
00035 }
00036
00037 double dd = difftime(time(NULL), Oct_1_t);
00038 unsigned long int ld = (unsigned long int)(dd);
00039 std::ostringstream foo;
00040 foo << ld;
00041
00042 END_CODE();
00043
00044 return foo.str();
00045 }
00046
00047 }