Microscopic Traffic Simulator

- Main Page
- Packages
- Classes
- Files

- File List

TimeSpanExtension.cs
Go to the documentation of this file.
1 using System;
2
3 namespace Microscopic_Traffic_Simulator___Model.Utilities
4 {
8 public static class TimeSpanExtension
9 {
16 public static TimeSpan Multiply(this TimeSpan multiplicand, int multiplier)
17 {
18 return TimeSpan.FromTicks(multiplicand.Ticks * multiplier);
19 }
20
27 public static TimeSpan Multiply(this TimeSpan multiplicand, double multiplier)
28 {
29 return TimeSpan.FromTicks((long)Math.Round(multiplicand.Ticks * multiplier));
30 }
31
38 public static TimeSpan Divide(this TimeSpan dividant, int divider)
39 {
40 return TimeSpan.FromTicks(dividant.Ticks / divider);
41 }
42
49 public static TimeSpan Divide(this TimeSpan dividant, double divider)
50 {
51 return TimeSpan.FromTicks((long)Math.Round(dividant.Ticks / divider));
52 }
53 }
54 }
System
Microscopic_Traffic_Simulator___Model