TimeClass

From SysCAD Documentation
Jump to: navigation, search

Navigation: PGMs -> Classes -> Predefined Classes

Species Database Class Particle Size Definition Class Array Class StrArray Class Matrix Class Tag Select Class Plant Model Class Noise Class TimeClass

Description

The TimeClass class, provides a member function to split a time into its components which are then accessible as data members.

  1. Time Zero
    • Time zero in seconds corresponds to midnight January 1 1970.
  2. Reference Start Time
    • In steady state projects, Reference Start Time = Time Zero (midnight January 1 1970)
    • In Dynamic projects, Reference Start Time = Time as set in the Solver Set up for Dynamic Projects box. This can be a user specified time or real time (synchronised with computer time)
  3. Current SysCAD Time
    • In steady state projects, Current SysCAD time = Time Zero (midnight January 1 1970) + Time passed since the very first project solve.
    • In Dynamic projects, Current SysCAD time = Reference Start Time + Time passed since project solve.

Data Members

Note that all the data members are constants (ie read only).

Data Member Data Type Description
HSec Byte Hundreds of a second (0-99)
Sec Byte Seconds (0-59)
Min Byte Minutes (0-59)
Hour Byte Hours (0-23)
Day Byte Day of the month (1-31)
Mon Byte Month (1-12)
Year Long Year (1970...)
WDay: Byte Day of the week (0 - 6; Sunday = 0)

Member Functions

Call Functionality Return Type Parameters Example
SplitTime(time)

The data members are calculated from the time parameter. The conversion is done relative to the current time zone (GMT time + time difference).

  • Returns the time supplied if the time was split successfully.
  • Returns Zero if the time supplied is invalid.

Real

time: Time that must be split in seconds.
This is of data type REAL.

t.SplitTime(Time())

GMTSplitTime(time)

The data members are calculated from the time parameter. The conversion is done relative to GMT Time.

  • Returns the time supplied if the time was split successfully.
  • Returns Zero if the time supplied is invalid.

Real

time: Time that must be split in seconds.
This is of data type REAL.

t.GMTSplitTime(Time())

Examples

Example PGM code Example Results
;Example1: Function SplitTime 

Real       CurrentTime*("Time", "s")
TimeClass  T
Watch      T
T.SplitTime(Time())                ;splits current time into components

Splittime.png

;Example2: Function GMTSplitTime 

Real       StartTime@("Time", "s") 
TimeClass  GMT
Watch      GMT

if (OnStart)
   StartTime = Time()
endif

GMT.GMTSplitTime(Time()-StartTime)   ;returns time referenced to Time Zero

GMTsplittime.png

Example 3: Comparison of SplitTime() vs GMTSplitTime() using current time (This was created in +10GMT time zone)

GMTsplittime2.png