language-extensions/R/src/Utilities.cpp
//--------------------------------------------------------------------------------------------------
// Name: Utilities::GetTimeZoneInR
//
// Description:
//  Finds the current time zone defined in R if any
//
// Returns:
//  The time zone environment variable's value as a string if it is set or an empty string if not.
//
:GetTimeZoneInR
Description:
Finds the current time zone defined in R if any

The time zone environment variable's value as a string if it is set or an empty string if not.
: GetTimeZoneInR Description : Finds the current time zone defined in R if any The time zone environment variable ' s value as a string if it is set or an empty string if not .
string Utilities::GetTimeZoneInR()
{
	string scriptToFindTimeZoneInR = "Sys.getenv('TZ')[1]";
	RInside* embeddedREnvPtr = REnvironment::EmbeddedREnvironment();
	 Evaluate the script and store the result in a string
	Rcpp::CharacterVector timeZoneInRVector(static_cast<SEXP>(
		embeddedREnvPtr->parseEval(scriptToFindTimeZoneInR)));
	string timeZoneInR = "";
	if (timeZoneInRVector.size() > 0)
	{
		timeZoneInR = timeZoneInRVector[0];
	}
	return timeZoneInR;
}
string Utilities :: GetTimeZoneInR ( ) { string scriptToFindTimeZoneInR = " " ; RInside * embeddedREnvPtr = REnvironment :: EmbeddedREnvironment ( ) ; Rcpp :: CharacterVector timeZoneInRVector ( static_cast < SEXP > ( embeddedREnvPtr -> parseEval ( scriptToFindTimeZoneInR ) ) ) ; string timeZoneInR = " " ; if ( timeZoneInRVector . size ( ) > 0 ) { timeZoneInR = timeZoneInRVector [ 0 ] ; } return timeZoneInR ; }
Name: Utilities::GetTimeZoneInR
Description:
Finds the current time zone defined in R if any
Name : Utilities :: GetTimeZoneInR Description : Finds the current time zone defined in R if any
// This script finds the value of the environment variable TZ that defines the time zone if set // // Evaluate the script and store the result in a string //