/// <summary> /// Format timestamp depending on type /// </summary> public static string FormatTimestamp(this Timecode timecode) { string output = string.Empty; switch (timecode.Type) { case TimecodeType.SMPTE: SMPTETimecode smpte; timecode.GetAsSMPTE(out smpte); output = string.Format("{0:D2}:{1:D2}:{2:D2}:{3:D2}", smpte.Hour, smpte.Minute, smpte.Second, smpte.Frame); break; case TimecodeType.IRIG: IRIGTimecode irig; timecode.GetAsIRIG(out irig); output = string.Format("{0:D2}:{1:D3}:{2:D2}:{3:D2}:{4:D2}.{5:D}", irig.Year, irig.Day, irig.Hour, irig.Minute, irig.Second, irig.Tenth); break; case TimecodeType.CameraTime: UInt64 cameraTime; timecode.GetAsCameraTime(out cameraTime); const UInt64 cTicksPerSecond = 10000000; UInt64 cSeconds = (cameraTime / cTicksPerSecond); UInt64 cNanoseconds = ((cameraTime % cTicksPerSecond) * (1000000000 / cTicksPerSecond)); output = string.Format("{0}.{1:D9}", cSeconds, cNanoseconds); break; } return(output); }