Yes, I discovered this myself, it returns the zero value you SSV.
I spoke with an ex-colleaguethat now works tech support, and he confirmed that a lot of info that could be got is unpublished, and not in the public domain - yet. If you must pursue this, then get in touch with application support in your country.
Having said that, I've re-read your original post, and admit to being a little confused as to what you actually do want.
we need to get the last scan time if it is in continuous task, and to get rate (scan time in periodic) if it is in periodic task
What exactly is it you want if the task is periodic ?
The periodic rate (the time interval between executions), or the periodic task scan time (how long the task takes to execute) ? If it is the periodic rate you want, then this is fixed by task configuration and will not change, unless you write a GSV to change it. If it is important that the periodic rate doesn't get changed, then you could write a GSV to set it in a protected routine.
Secondly, don't forget that the Continuous Task's Last Scan Time, will
include all of the time that interrupting periodic tasks (or event tasks) take to execute during the continuous task scan. You have not mentioned these Event tasks, how do these figure in your data collection. Also the "System Overhead Time-Slice" setting will affect the scan time, especially when the option to use unused SOTS is checked on.
And finally, (and it has to be asked), how and why is this information so important to you? It is not a usual thing for the application to know about this level of detail about it's execution, the information is provided primarily for programmers/SI's to configure the controller, in order for the program to effectively achieve its function. Once set-up correctly, nothing is going to change it (barring a few exceptions.
I don't see how gathering this information is going to help.
regards, daba