Verified Commit a1ed9120 authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

ApplicationInfo provides hostname

parent da4cd0d5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ namespace PsimagLite {
std::ostream& operator<<(std::ostream& os,const ApplicationInfo& ai)
{
	os<<ai.getTimeDate();
	os<<"Hostname: "<<ai.hostname()<<"\n";
	if (!ai.firstCall_) return os;
	os<<ai.name_<<" sizeof(SizeType)="<<sizeof(SizeType)<<"\n";
#ifdef USE_FLOAT
+18 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#include <sys/time.h>
#include <time.h>
#include "Vector.h"
#include <unistd.h>

namespace PsimagLite {

@@ -110,6 +111,23 @@ public:
		return asctime(localtime(&tt));
	}

	String hostname() const
	{
		int len = 1024;
		char* name = new char[len];
		int ret = gethostname(name,len);
		String retString;
		if (ret != 0) {
			retString = "UNKNOWN";
		} else {
			retString = name;
		}

		delete[] name;

		return retString;
	}

	friend std::ostream& operator<<(std::ostream& os,const ApplicationInfo& ai);

private: