Asn1PerTime Class Reference

Provides methods to encode and decode TIME values in PER. More...

List of all members.

Static Public Member Functions

static System.String DecodeDate (Asn1PerDecodeBuffer source, int flags)
static System.String DecodeDateTime (Asn1PerDecodeBuffer source, int flags)
static System.String DecodeDuration (Asn1PerDecodeBuffer source, bool recurring)
static System.String DecodeTime (Asn1PerDecodeBuffer source, int flags)
static void EncodeDate (Asn1PerEncoder encoder, System.String val, int flags)
static void EncodeDateTime (Asn1PerEncoder encoder, System.String val, int flags)
static void EncodeDuration (Asn1PerEncoder encoder, System.String val, bool recurring)
static void EncodeTime (Asn1PerEncoder encoder, System.String val, int flags)

Public Attributes

const int DIFF = 0x0020
const int DURATION = 0x0010
const int FRACTION = 0x000F
const int UTC = 0x0040
const int WEEK = 0x0800

Detailed Description

The application representation of the TIME value is a TimeValue, as defined in X.680.

Some notes on formatting: + A year/century should have a leading plus sign if and only if the year/century > 9999/99. + A year/century having 5/3 or more digits should never include leading zeros. A value with a year of 1985 has the property Year="Basic" and is formatted with only 4 digits, never more. + A year/century should never have fewer than four/two digits. This is the only case where leading zeros may be used. + When FRACTION is used to specify a number of fraction digits, the string representation must have precisely that many digits for the fraction. Note that FRACTION is not to be used with DURATION.


Member Function Documentation

static System.String DecodeDate ( Asn1PerDecodeBuffer  source,
int  flags 
) [static]

Decode a date value from the given source.

This should be used for types having Basic="Date".

Parameters:
source 
flags 
Returns:
ASN.1 TimeValue representation of decoded value
static System.String DecodeDateTime ( Asn1PerDecodeBuffer  source,
int  flags 
) [static]

Decode a date-time value from the given source.

This should be used for types having Basic="Date-Time".

Parameters:
source 
flags Indicates what fields are expected. The flags should indicate a complete date (YMD, YWD, or YD) and at least an hour component.
Returns:
The value represented as an ASN.1 TimeValue
static System.String DecodeDuration ( Asn1PerDecodeBuffer  source,
bool  recurring 
) [static]

Decode a (possibly recurring) duration from the given source.

This should be used for types having Basic="Interval" or "Rec-Interval" and Interval-type="D"

Parameters:
source 
recurring true if the duration is a recurring duration
Returns:
static System.String DecodeTime ( Asn1PerDecodeBuffer  source,
int  flags 
) [static]

Decode a time value from the given source.

This should be used for types having Basic="Time".

Parameters:
source 
flags Indicates the expected fields.
Returns:
static void EncodeDate ( Asn1PerEncoder  encoder,
System.String  val,
int  flags 
) [static]

Encode a date value using the given encoder.

This should be used for types having Basic="Date".

Parameters:
encoder 
val 
flags 
static void EncodeDateTime ( Asn1PerEncoder  encoder,
System.String  val,
int  flags 
) [static]

Encode a datetime value.

This should be used for types having Basic="Date-Time".

Parameters:
encoder 
val 
flags 
static void EncodeDuration ( Asn1PerEncoder  encoder,
System.String  val,
bool  recurring 
) [static]

Encode a duration.

This should be used for types having Basic="Interval" or "Rec-Interval", and Interval-type="D".

Parameters:
encoder 
val The duration
recurring true if value represents a recurring duration.
static void EncodeTime ( Asn1PerEncoder  encoder,
System.String  val,
int  flags 
) [static]

Encode a time value.

This should be used for types having Basic="Time".

Parameters:
encoder 
val 
flags 

Member Data Documentation

const int DIFF = 0x0020

Indicates a time includes a timezone difference from UTC.

const int DURATION = 0x0010

Indicates a duration. No other flags should be used with DURATION.

const int FRACTION = 0x000F

This is a mask that is used to mark off the bits used for the number of decimal places for a fraction.

value & FRACTION = # of decimal places

const int UTC = 0x0040

Indicates a time is UTC.

Its string format includes the 'Z' timezone designator.

const int WEEK = 0x0800

Week is present.

When used for a duration (with DURATION), the following are excluded: CENTURY, YEAR, MONTH, DAY, HOURS, MINUTES, SECONDS

When used for a date/datetime (without DURATION), MONTH is excluded.