JarrettVance.ChapterTools.Extractors.XplExtractor.GetTimeSpan C# (CSharp) Method

GetTimeSpan() protected static method

protected static GetTimeSpan ( string timeSpan, float timeBase, float tickBase, int tickBaseDivisor ) : System.TimeSpan
timeSpan string
timeBase float
tickBase float
tickBaseDivisor int
return System.TimeSpan
        protected static TimeSpan GetTimeSpan(string timeSpan, float timeBase, float tickBase, int tickBaseDivisor)
        {
            TimeSpan ts = TimeSpan.Parse(timeSpan.Substring(0, timeSpan.LastIndexOf(':')));
              ts = new TimeSpan((long)((ts.TotalSeconds / 60D) * (double)timeBase) * TimeSpan.TicksPerSecond);

              //convert ticks to ticks timebase
              //NOTE: eac3to does not utilize tickBaseDivisor (they have bug?)
              decimal convert = (decimal)TimeSpan.TicksPerSecond / ((decimal)tickBase / (decimal)tickBaseDivisor);
              decimal ticks = decimal.Parse(timeSpan.Substring(timeSpan.LastIndexOf(':') + 1)) * convert;
              return ts.Add(new TimeSpan((long)ticks));
        }