classPiiClock
#include <PiiClock.h>
An operation that emits current time whenever a trigger is received or whenever a timer times out.
Inherits PiiDefaultOperation
Description
Inputs
Properties
|
Set a format of the output. |
|
|
The type of the |
|
|
int
|
An interval to the emit time and timestamp if the trigger input is not connected. |
|
Set a type of the output time. |
Public types
|
enum
|
{ TriggerInput, TimeStampInput }
Supported input types. |
|
enum
|
{ LocalTime, UTC }
Supported time types. |
Constructors and destructor
|
( )
|
Public member functions
|
( )
|
|
|
( )
|
|
|
int
|
( )
|
|
void
|
|
|
void
|
|
|
void
|
(
|
|
void
|
|
|
( )
|
Protected member functions
|
virtual void
|
Called by setState() just before the operation changes to a new state. |
|
virtual void
|
(
Checks the operation for execution. |
|
virtual void
|
( )
Executes one round of processing. |
Property details
-
QString format
[read, write]Set a format of the output.
These expressions may be used for the date:
-
d - the day as number without a leading zero (1 to 31)
-
dd - the day as number with a leading zero (01 to 31)
-
ddd - the abbreviated localized day name (e.g. 'Mon' to 'Sun').
-
dddd - the long localized day name (e.g. 'Qt::Monday' to 'Qt::Sunday').
-
M - the month as number without a leading zero (1-12)
-
MM - the month as number with a leading zero (01-12)
-
MMM - the abbreviated localized month name (e.g. 'Jan' to 'Dec').
-
MMMM - the long localized month name (e.g. 'January' to 'December').
-
yy - the year as two digit number (00-99)
-
yyyy - the year as four digit number (1752-8000)
-
h - the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)
-
hh - the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)
-
m - the minute without a leading zero (0 to 59)
-
mm - the minute with a leading zero (00 to 59)
-
s - the second whithout a leading zero (0 to 59)
-
ss - the second whith a leading zero (00 to 59)
-
z - the milliseconds without leading zeroes (0 to 999)
-
zzz - the milliseconds with leading zeroes (000 to 999)
-
AP - use AM/PM display. AP will be replaced by either "AM" or "PM".
-
ap - use am/pm display. ap will be replaced by either "am" or "pm".
Format
Result
dd.MM.yyyy
21.05.2001
ddd MMMM d yy
Tue May 21 01
hh:mm:ss.zzz
14:13:09.042
h:m:s ap
2:13:9 pm
The default format is hh:mm:ss.
-
-
InputType inputType
[read, write]The type of the
triggerinput.This property determines how the operation interprets objects received in the
triggerinput. The default value isTriggerInput. -
int interval
[read, write]An interval to the emit time and timestamp if the trigger input is not connected.
The default values is 1000 ms.
-
TimeType timeType
[read, write]Set a type of the output time.
Supported time types:
-
LocalTime- Locale dependent time (Timezones and Daylight Savings Time). This is the default. -
UTC- Coordinated Universal Time, replaces Greenwich Mean Time.
-
Enumeration details
-
enum InputType
Supported input types.
-
TriggerInput- Incoming objects trigger an emission of the current time. The type of the incoming object is ignored. -
TimeStampInput- The input is read as an unsigned int and interpreted as an Unix timestamp. The output will be a formatted version of the time stamp.
-
-
enum TimeType
Supported time types.
-
LocalTime- Locale dependent time (Timezones and Daylight Savings Time). -
UTC- Coordinated Universal Time, replaces Greenwich Mean Time.
-
Function details
-
PiiClock
() -
QString format
() -
InputType inputType
() -
int interval
() -
void setFormat
-
void setInputType
-
void setInterval
(- int interval
-
void setTimeType
-
TimeType timeType
() -
Called by setState() just before the operation changes to a new state.
The function will be called independent of the cause of the state change (internal or external). Derived classes may implement this function to perform whatever functionality is needed when a state changes. The default implementation does nothing.
Reimplemented from PiiBasicOperation.
-
virtual void check
(- bool reset
[protected, virtual]Checks the operation for execution.
This function creates a suitable flow controller by calling createFlowController(). It then sets the flow controller to the active processor and sets the processor as the input controller for all inputs.
If you change socket groupings in your overridden implementation, please call PiiDefaultOperation::check() after that. Otherwise, your new groupings will not be in effect.
Reimplemented from PiiDefaultOperation.
-
virtual void process
()[protected, virtual]Executes one round of processing.
This function is invoked by the processor if the necessary preconditions for a new processing round are met. This function does all the necessary calculations to create output objects and sends them to output sockets.
Calls to process(), syncEvent(), and setProperty() are synchronized and cannot occur simultaneously. PiiDefaultOperation ensures this by locking processLock() for reading before calling process().
Note: With time-consuming operations, one should occasionally check that the operation hasn't been interrupted, i.e. that state() returns
Running.Exceptions
- PiiExecutionException
-
whenever an unrecoverable error occurs during a processing round, the operation is interrupted, or finishes execution due to end of input data.
Reimplemented from PiiDefaultOperation.
-
void timerTimeout
()[slot]
Add a note
Not a single note added yet. Be the first, add yours.