public void Init(double ticks) { startTimeInfo = new TimeInfo(); startTimeInfo.ServerTicks = ticks; nowTimeInfo = new TimeInfo(); Logger.DEBUG("start time info: ", startTimeInfo.ToString()); }
/* * In a Visual Studio project create a class Time to hold information about the current time and the current date . * * Make an easy-to-use constructor (from client perspective), that would represent the time and date the client wants to hold in your class. * * Implement the ToString() method, returning the time and date in format : "hh:mm:ss dd.MM.YY". * * Bonus Make a static method Now() for your class, returning the Time at the present moment :) (of type Time) */ static void Main(string[] args) { var ourTime = new TimeInfo(new DateTime(2015, 02, 16, 14, 16, 00)); Console.WriteLine(ourTime.ToString()); var time = TimeInfo.Now(); Console.WriteLine(time.ToString()); }
public void ParseLargeTrackDuration() { var ti = new TimeInfo(23372063402); Assert.NotNull(ti); Assert.True(ti.Seconds > 0); var s = ti.ToString(); var s1 = ti.ToFullFormattedString(); Assert.Equal(s, s1); ti = new TimeInfo(60000); Assert.Equal(1, ti.Minutes); ti = new TimeInfo(3600000); Assert.Equal(1, ti.Hours); }