23 lines
676 B
C#
23 lines
676 B
C#
using System;
|
|
|
|
namespace Qrakhen.Qamp.Core.Values.Objects;
|
|
|
|
public class Timestamp(Value timeStamp) : Native(nameof(Timestamp))
|
|
{
|
|
public static readonly string DefaultFormat = "H:m:s d.M.y";
|
|
|
|
// cheap ass workaround i know
|
|
private DateTime _dateTime = new DateTime(timeStamp.Signed * 10);
|
|
|
|
public Value Raw = timeStamp;
|
|
|
|
public Value Format(Value? format = null)
|
|
{
|
|
return String.Make(_dateTime.ToString(format?.Ptr.As<String>()?.Value ?? DefaultFormat));
|
|
}
|
|
|
|
public override string ToString() => ToString(true);
|
|
public string ToString(bool detail) => detail ?
|
|
$"[Timestamp <{_dateTime}>]" :
|
|
_dateTime.ToString(DefaultFormat);
|
|
} |