version: add SISO & OS

parent ab30ff36
Pipeline #10263 failed with stages
in 1 minute and 46 seconds
......@@ -36,6 +36,8 @@ char * _getUserName(char *infoBuff, DWORD bufCharCount);
char * _getVSconfiguration(char *infoBuff, DWORD bufCharCount);
char * _getPcoSdkVersion(char *infoBuff, int strLen, char *lib);
char * _getDllPath(const char* pzFileName, char *path, size_t strLen);
const char * _getEnviroment(const char *env);
const char * _getOs();
#endif
......@@ -301,9 +301,11 @@ stcPcoData::stcPcoData(){
ptr += __sprintfSExt(ptr, ptrMax-ptr, " timestamp: %s\n", getTimestamp(Iso));
ptr += __sprintfSExt(ptr, ptrMax-ptr, " computer name: %s\n", _getComputerName(buff, BUFFER_LEN));
ptr += __sprintfSExt(ptr, ptrMax-ptr, " OS: %s\n", _getOs());
ptr += __sprintfSExt(ptr, ptrMax-ptr, " user name: %s\n", _getUserName(buff, BUFFER_LEN));
ptr += __sprintfSExt(ptr, ptrMax-ptr, "VS configuration: %s\n", _getVSconfiguration(buff, BUFFER_LEN));
ptr += __sprintfSExt(ptr, ptrMax-ptr, " SISO dir: %s\n", _getEnviroment("SISODIR5"));
#ifndef __linux__
ptr += __sprintfSExt(ptr, ptrMax-ptr, " PCO SDK version: %s\n", _getPcoSdkVersion(buff, BUFFER_LEN, (char *) "sc2_cam.dll"));
ptr += __sprintfSExt(ptr, ptrMax-ptr, " %s\n", _getPcoSdkVersion(buff, BUFFER_LEN, (char *) "sc2_cl_me4.dll"));
......
......@@ -22,6 +22,10 @@
###########################################################################
**************************************************************************/
#ifdef __linux__
#include <sys/utsname.h>
#endif
#ifndef __linux__
#include <windows.h>
#include <tchar.h>
......@@ -94,11 +98,16 @@ char *getTimestamp(timestampFmt fmtIdx, time_t xtime) {
if((xtime == 0) && (fmtIdx==IsoMilliSec))
{
#ifndef __linux__
SYSTEMTIME st;
GetLocalTime(&st);
__sprintfSExt(timeline, sizeof(timeline),"%4d/%02d/%02d %02d:%02d:%02d.%03d",
st.wYear, st.wMonth, st.wDay,
st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
#else
__sprintfSExt(timeline, sizeof(timeline),"getTimestamp IsoMilliSec: LINUX - not defined");
#endif
return timeline;
}
......@@ -3262,7 +3271,12 @@ int __sprintfSExt(char* ptr, size_t nrMax, const char* format, ...)
va_list args;
va_start (args, format);
#ifdef __linux__
// int vsnprintf(char*, size_t, const char*, __va_list_tag*)
nr = vsnprintf(ptr, nrMax, format, args);
#else
nr = vsnprintf_s(ptr, nrMax, _TRUNCATE, format, args);
#endif
va_end (args);
......@@ -3283,6 +3297,43 @@ int __sprintfSExt(char* ptr, size_t nrMax, const char* format, ...)
return 0;
}
//====================================================================
//====================================================================
const char * _getEnviroment(const char *env)
{
#ifndef __linux__
return "_getEnviroment: WIN - not defined";
#else
return std::getenv(env);
#endif
}
//====================================================================
//====================================================================
const char * _getOs()
{
static char os[256];
#ifndef __linux__
return "WINDOWS";
#else
struct utsname buff;
int err, nr;
err = uname(&buff);
nr = snprintf(os, sizeof(os),
"os[%s] rel[%s] ver[%s] mach[%s]",
&buff.sysname[0], &buff.release[0], &buff.version[0], &buff.machine[0]);
return os;
#endif
}
//==========================================================================================================
//==========================================================================================================
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment