Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
DateTimeOffsetEncoder.cs
1using System;
2using System.Text;
4
6{
11 {
16 {
17 }
18
25 public void Encode(object Object, int? Indent, StringBuilder Json)
26 {
27 DateTime TP = ((DateTimeOffset)Object).ToUniversalTime().DateTime;
28 long Seconds = (long)(TP - JSON.UnixEpoch).TotalSeconds;
29
30 Json.Append(Seconds.ToString());
31 }
32
38 public Grade Supports(Type ObjectType)
39 {
40 return ObjectType == typeof(DateTimeOffset) ? Grade.Ok : Grade.NotAtAll;
41 }
42 }
43}
Helps with common JSON-related tasks.
Definition: JSON.cs:14
static readonly DateTime UnixEpoch
Unix Date and Time epoch, starting at 1970-01-01T00:00:00Z
Definition: JSON.cs:18
Grade Supports(Type ObjectType)
How well the JSON encoder encodes objects of type ObjectType .
void Encode(object Object, int? Indent, StringBuilder Json)
Encodes the Object to JSON.
Interface for encoding objects of certain types to JSON.
Definition: IJsonEncoder.cs:11
Grade
Grade enumeration
Definition: Grade.cs:7