Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
TimeZone.cs
1using System;
3using Waher.Script;
7
9{
14 {
24 {
25 }
26
30 public override string FunctionName => nameof(TimeZone);
31
39 {
40 if (Argument.AssociatedObjectValue is DateTimeOffset TP)
41 return new DayTimeDurationLiteral(Duration.FromTimeSpan(TP.Offset));
42 else
43 throw new ScriptRuntimeException("Expected a Date and Time value.", this);
44 }
45 }
46}
Abstract base class for functions of one semantic variable.
TimeZone(ScriptNode Argument, int Start, int Length, Expression Expression)
TimeZone(x)
Definition: TimeZone.cs:22
override IElement EvaluateScalar(ISemanticElement Argument, Variables Variables)
Evaluates the function on a scalar argument.
Definition: TimeZone.cs:38
override string FunctionName
Name of the function
Definition: TimeZone.cs:30
Class managing a script expression.
Definition: Expression.cs:39
ScriptNode Argument
Function argument.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Collection of variables.
Definition: Variables.cs:25
Interface for semantic nodes.
Basic interface for all types of elements.
Definition: IElement.cs:20
Represents a duration value, as defined by the xsd:duration data type: http://www....
Definition: Duration.cs:13
static Duration FromTimeSpan(System.TimeSpan TS)
Converts a TimeSpan to a Duration. (This will loose milliseconds.)
Definition: Duration.cs:599