Search code examples
c#azureazure-media-services

Convert seconds to whatever it's expecting


I'm working with Azure Media Services and I'm creating filters.

One property that I need is this:

public class PresentationTimeRange
{
    public const ulong TimescaleHns = 10000000;

    public PresentationTimeRange(ulong? timescale = 10000000, ulong? start = default(ulong?), ulong? end = default(ulong?), TimeSpan? pwDuration = default(TimeSpan?), TimeSpan? backoff = default(TimeSpan?));

    public ulong? EndTimestamp { get; }
    public TimeSpan? LiveBackoffDuration { get; }
    public TimeSpan? PresentationWindowDuration { get; }
    public ulong? StartTimestamp { get; }
    public ulong? Timescale { get; }
}

As you can see, I need a ulong Start and End time.

If I try to create a filter on Azure Media Services Explorer I can choose the start and end time like this: enter image description here

Then I can see the Start and End Timestamp:

enter image description here

The value I have is Seconds, I already tried to convert seconds to nanoseconds in order to obtain a value like this but unsuccessful.

How can I obtain these timestamp values from seconds?


Solution

  • I solved the problem by adding seven 0 to my seconds. Maybe it isn't the best way but it works

    string constant = "0000000";
    string InitialTime = string.Concat(InitialTimeOriginal, constant);
    string EndTime = string.Concat(EndTimeOriginal, constant);