TimeClass

From SysCAD Documentation
Jump to navigation Jump to search

Navigation: PGMs ➔ Classes ➔ TimeClass

Global Pre-Defined Class Instances SysCAD Pre-Defined Classes
Sp Database
SDB Class
Particle Size Defn
PSD Class
Plant Model
PM Class
Array
Class
StrArray
Class
Matrix
Class
TagSelect
Class
Time
Class
Noise
Class

Latest SysCAD Version: 25 October 2024 - SysCAD 9.3 Build 139.36522

Related Links: Defining a Class, Example PGM Files


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 (i.e. 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

CurrentTime = Time()

Splittime.png

;Example2: Function GMTSplitTime 

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

Sub InitialiseSolution()
   StartTime = Time()
EndSub

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