C# Class KeePassLib.Utility.TimeUtil

Contains various static time structure manipulation and conversion routines.
Show file Open project: cappert/keepass2

Public Methods

Method Description
Compare ( System.DateTime dtA, System.DateTime dtB, bool bUnkIsPast ) : int
ConvertUnixTime ( double dtUnix ) : System.DateTime
FromDisplayString ( string strDisplay ) : System.DateTime
PackPwTime ( System.DateTime dt ) : byte[]

Pack a DateTime object into 7 bytes (PW_TIME).

PackTime ( System.DateTime dt ) : byte[]

Pack a DateTime object into 5 bytes. Layout: 2 zero bits, year 12 bits, month 4 bits, day 5 bits, hour 5 bits, minute 6 bits, second 6 bits.

ParseUSTextDate ( string strDate ) : DateTime?

Parse a US textual date string, like e.g. "January 02, 2012".

SerializeUnix ( System.DateTime dt ) : double
SerializeUtc ( System.DateTime dt ) : string
ToDisplayString ( System.DateTime dt ) : string

Convert a DateTime object to a displayable string.

ToDisplayStringDateOnly ( System.DateTime dt ) : string
TryDeserializeUtc ( string str, System.DateTime &dt ) : bool
UnpackPwTime ( byte pb ) : System.DateTime

Unpack a packed time (7 bytes, PW_TIME) to a DateTime object.

UnpackTime ( byte pb ) : System.DateTime

Unpack a packed time (5 bytes, packed by the PackTime member function) to a DateTime object.

Private Methods

Method Description
CompareLastMod ( ITimeLogger tlA, ITimeLogger tlB, bool bUnkIsPast ) : int
DeriveCustomFormat ( string strDT, System.DateTime dt ) : string

Method Details

Compare() public static method

public static Compare ( System.DateTime dtA, System.DateTime dtB, bool bUnkIsPast ) : int
dtA System.DateTime
dtB System.DateTime
bUnkIsPast bool
return int

ConvertUnixTime() public static method

public static ConvertUnixTime ( double dtUnix ) : System.DateTime
dtUnix double
return System.DateTime

FromDisplayString() public static method

public static FromDisplayString ( string strDisplay ) : System.DateTime
strDisplay string
return System.DateTime

PackPwTime() public static method

Pack a DateTime object into 7 bytes (PW_TIME).
public static PackPwTime ( System.DateTime dt ) : byte[]
dt System.DateTime Object to be encoded.
return byte[]

PackTime() public static method

Pack a DateTime object into 5 bytes. Layout: 2 zero bits, year 12 bits, month 4 bits, day 5 bits, hour 5 bits, minute 6 bits, second 6 bits.
public static PackTime ( System.DateTime dt ) : byte[]
dt System.DateTime
return byte[]

ParseUSTextDate() public static method

Parse a US textual date string, like e.g. "January 02, 2012".
public static ParseUSTextDate ( string strDate ) : DateTime?
strDate string
return DateTime?

SerializeUnix() public static method

public static SerializeUnix ( System.DateTime dt ) : double
dt System.DateTime
return double

SerializeUtc() public static method

public static SerializeUtc ( System.DateTime dt ) : string
dt System.DateTime
return string

ToDisplayString() public static method

Convert a DateTime object to a displayable string.
public static ToDisplayString ( System.DateTime dt ) : string
dt System.DateTime DateTime object to convert to a string.
return string

ToDisplayStringDateOnly() public static method

public static ToDisplayStringDateOnly ( System.DateTime dt ) : string
dt System.DateTime
return string

TryDeserializeUtc() public static method

public static TryDeserializeUtc ( string str, System.DateTime &dt ) : bool
str string
dt System.DateTime
return bool

UnpackPwTime() public static method

Unpack a packed time (7 bytes, PW_TIME) to a DateTime object.
public static UnpackPwTime ( byte pb ) : System.DateTime
pb byte Packed time, 7 bytes.
return System.DateTime

UnpackTime() public static method

Unpack a packed time (5 bytes, packed by the PackTime member function) to a DateTime object.
public static UnpackTime ( byte pb ) : System.DateTime
pb byte Packed time, 5 bytes.
return System.DateTime