language-extensions/R/src/Utilities.cpp
//--------------------------------------------------------------------------------------------------
// Name: Utilities::GetSecondsAfterDecimalPointFromNanoSeconds
//
// Description:
//  From the given nanoSeconds value, generates a string representing seconds
//  after the decimal point.
//
// Returns:
//  string representing seconds after the decimal point.
//
:GetSecondsAfterDecimalPointFromNanoSeconds
Description:
From the given nanoSeconds value, generates a string representing seconds
after the decimal point.

string representing seconds after the decimal point.
: GetSecondsAfterDecimalPointFromNanoSeconds Description : From the given nanoSeconds value generates a string representing seconds after the decimal point . string representing seconds after the decimal point .
string Utilities::GetSecondsAfterDecimalPointFromNanoSeconds(
	SQLUINTEGER nanoSeconds)
{
	string secondsAfterDecimalPoint = to_string(nanoSeconds);
	size_t digitsInNanoSeconds = strlen(secondsAfterDecimalPoint.c_str());
	if (digitsInNanoSeconds < MAXDIGITS_IN_NANOSECONDS)
	{
		size_t numberOfZeros = MAXDIGITS_IN_NANOSECONDS - digitsInNanoSeconds;
		secondsAfterDecimalPoint = string(numberOfZeros, '0') + secondsAfterDecimalPoint;
	}
	return secondsAfterDecimalPoint;
}
string Utilities :: GetSecondsAfterDecimalPointFromNanoSeconds ( SQLUINTEGER nanoSeconds ) { string secondsAfterDecimalPoint = to_string ( nanoSeconds ) ; size_t digitsInNanoSeconds = strlen ( secondsAfterDecimalPoint . c_str ( ) ) ; if ( digitsInNanoSeconds < MAXDIGITS_IN_NANOSECONDS ) { size_t numberOfZeros = MAXDIGITS_IN_NANOSECONDS - digitsInNanoSeconds ; secondsAfterDecimalPoint = string ( numberOfZeros , ' ' ) + secondsAfterDecimalPoint ; } return secondsAfterDecimalPoint ; }
Name: Utilities::GetSecondsAfterDecimalPointFromNanoSeconds
Description:
From the given nanoSeconds value, generates a string representing seconds
after the decimal point.
Name : Utilities :: GetSecondsAfterDecimalPointFromNanoSeconds Description : From the given nanoSeconds value generates a string representing seconds after the decimal point .
// 1 second = 10^9 nanoseconds = 10^6 microseconds; // 0.100'000'000 second = 10^8 nanoseconds = 10^5 microseconds. // We need to prefix with zeros the string representation of the seconds after decimal point // if digits in nanoseconds are less than 9 to represent the correct seconds value. //