| Quintiq file version 2.0 | 
| #parent: #root | 
| Function CalcDuration | 
| { | 
|   TextBody: | 
|   [* | 
|     seconds := 0.0; | 
|      | 
|     if( this.StartedOnPrecision() > 0 ) | 
|     { | 
|       if( this.FinishedOnPrecision() > 0 ) | 
|       { | 
|         seconds := this.FinishedOnPrecision() - this.StartedOnPrecision(); | 
|       } | 
|       else if( not isnull( this.LastSnapshot() ) ) | 
|       { | 
|         seconds := this.LastSnapshot().PrecisionTimeStamp() - this.StartedOnPrecision(); | 
|       } | 
|     } | 
|      | 
|     value := Duration::Seconds( seconds ); | 
|      | 
|     this.Duration( value ); | 
|   *] | 
|   InterfaceProperties { Accessibility: 'Module' } | 
| } |