Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] View of /trunk/gadget/runid.cc
[mareframe] / trunk / gadget / runid.cc Repository:
ViewVC logotype

View of /trunk/gadget/runid.cc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (download) (annotate)
Mon Feb 10 17:09:07 2014 UTC (10 years, 3 months ago) by agomez
File size: 723 byte(s)
Initial version based on Gadget 2.2.00
#include "runid.h"
#include "gadget.h"

extern int gethostname(char*, int);

RunID::RunID() {
  hostname = new char[MaxStrLength];
  strncpy(hostname, "", MaxStrLength);
  timestring = new char[MaxStrLength];
  strncpy(timestring, "", MaxStrLength);

  if (uname(&host) != -1)
    strcpy(hostname, host.nodename);
  if (time(&runtime))
    strcpy(timestring, ctime(&runtime));
}

RunID::~RunID() {
  delete[] hostname;
  delete[] timestring;
}


void RunID::Print(ostream& o) {
  o << "Gadget version " << GADGETVERSION << " running on " << hostname << sep << timestring;
  o.flush();
}

void RunID::printTime(ostream& o) {
  time_t stoptime;
  o << difftime(time(&stoptime), runtime) << " seconds" << endl;
  o.flush();
}

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge