Million second in TI

Post Reply
User avatar
macsir
MVP
Posts: 785
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Million second in TI

Post by macsir »

Just curious, can we display that?
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/
Alan Kirk
Site Admin
Posts: 6667
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Million second in TI

Post by Alan Kirk »

macsir wrote:Just curious, can we display that?
This question is not entirely clear. A million seconds is about 278 hours, or about 11 1/2 days. Obviously you can display that if you choose.

If you mean millionths of a second, then as a floating point number, probably (depending on how many significant digits the expression has). But for date and time calculations in TM1, not so much. As Duncan P pointed out here the real granularity in TM1 is about 1 second.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
User avatar
macsir
MVP
Posts: 785
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Re: Million second in TI

Post by macsir »

Thanks, Alan. Yes, I mean the latter.
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/
User avatar
macsir
MVP
Posts: 785
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Re: Million second in TI

Post by macsir »

Interestedly, I found there is a new function in PA 2.0, which does give millisecond option. It shows IBM can offer this capability but they didn't provide any date time format function to make it work.

DimensionTimeLastUpdated
This function indicates when a specified dimension was last updated.
The function returns a real number that represents the current day (including the
hour, minute, second, and millisecond) since the beginning of the year 1900.
This is a TM1 TurboIntegrator function, valid only in TurboIntegrator processes.
Syntax
DimensionTimeLastUpdated(dimension);
Argument Description
dimension The name of the dimension.
Example
DimensionTimeLastUpdated(’Region’);
This example returns information on when the Region dimension was last
updated. If a value of 42548.<hours>.<minutes>.<milliseconds> is returned, you
can divide 42548 by 365 to obtain (approximately) 116. When added to the started
of 1900, the result is a current year of 2016.
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/
User avatar
macsir
MVP
Posts: 785
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Re: Million second in TI

Post by macsir »

Just finished the code with this function to get millisecond. It should be useful. :lol:

Code: Select all

DimName = '}' | GetProcessName() ;

IF(DIMENSIONEXISTS(DimName) = 1);
  DIMENSIONDESTROY(DimName);
ENDIF;
DIMENSIONCREATE(DimName);

vDateTimeWithMillisec = NUMBERTOSTRING(DimensionTimeLastUpdated(DimName));

#TIMST use 1960 as starting point however DIMENSIONLASTUPDATED use 1900
#Need to remove the 60 years (21916 days) difference before using it
vDateTime = TIMST(DimensionTimeLastUpdated(DimName) - 21916, '\Y-\m-\d \h:\i:\s',1);

IF(DIMENSIONEXISTS(DimName) = 1);
  DIMENSIONDESTROY(DimName);
ENDIF;

vTime = SUBST(vDateTimeWithMillisec, SCAN('.',vDateTimeWithMillisec) , LONG(vDateTimeWithMillisec) - SCAN('.',vDateTimeWithMillisec) + 1);

vHrTime = NUMBERTOSTRING(STRINGTONUMBER(vTime) * 24);

vHr = SUBST(vHrTime, 1, SCAN('.', vHrTime) - 1);

vMiTime = NUMBERTOSTRING( ( STRINGTONUMBER(vHrTime) - STRINGTONUMBER(vHr) ) * 60);

vMi = SUBST(vMiTime, 1, SCAN('.', vMiTime) - 1);

vSecTime = NUMBERTOSTRING( ( STRINGTONUMBER(vMiTime) - STRINGTONUMBER(vMi) ) * 60);

vSec = SUBST(vSecTime, 1, SCAN('.', vSecTime) - 1);

vMisecTime = NUMBERTOSTRING( ( STRINGTONUMBER(vSecTime) - STRINGTONUMBER(vSec) ) * 1000);

vMisec = SUBST(vMisecTime, 1, SCAN('.', vMisecTime) - 1);


LogOutput('INFO', vDateTime | '=' | vDateTimeWithMillisec | '=' | vTime | '=' | vHr | '=' | vMi | '=' | vSec | '=' | vMisec );

LogOutput('INFO', vDateTime | '.' | vMisec );
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/
Post Reply