55// Created: 2009.02.24
66
77using System ;
8- using Xtensive . Linq ;
98using Xtensive . Sql ;
109using Xtensive . Sql . Dml ;
1110using Operator = Xtensive . Reflection . WellKnown . Operator ;
@@ -15,16 +14,13 @@ namespace Xtensive.Orm.Providers
1514 [ CompilerContainer ( typeof ( SqlExpression ) ) ]
1615 internal static class TimeSpanCompilers
1716 {
18- private static readonly long TicksPerMillisecond = TimeSpan . FromMilliseconds ( 1 ) . Ticks ;
17+ private const long MillisecondsPerSecond = 1000 ;
18+ private const long MillisecondsPerMinute = MillisecondsPerSecond * 60 ; // 60,000
19+ private const long MillisecondsPerHour = MillisecondsPerMinute * 60 ; // 3,600,000
20+ private const long MillisecondsPerDay = MillisecondsPerHour * 24 ; // 86,400,000
1921
20- private static readonly double MillisecondsPerDay = TimeSpan . FromDays ( 1 ) . TotalMilliseconds ;
21- private static readonly double MillisecondsPerHour = TimeSpan . FromHours ( 1 ) . TotalMilliseconds ;
22- private static readonly double MillisecondsPerMinute = TimeSpan . FromMinutes ( 1 ) . TotalMilliseconds ;
23- private static readonly double MillisecondsPerSecond = TimeSpan . FromSeconds ( 1 ) . TotalMilliseconds ;
24- private static readonly double MillisecondsPerTick = TimeSpan . FromTicks ( 1 ) . TotalMilliseconds ;
25-
26- private const int NanosecondsPerTick = 100 ;
27- private const int NanosecondsPerMillisecond = 1000000 ;
22+ private const long NanosecondsPerTick = 100 ;
23+ private const long NanosecondsPerMillisecond = 1000000 ;
2824
2925 #region Constructors
3026
@@ -72,9 +68,9 @@ public static SqlExpression TimeSpanCtor(
7268 [ Type ( typeof ( int ) ) ] SqlExpression hours ,
7369 [ Type ( typeof ( int ) ) ] SqlExpression minutes ,
7470 [ Type ( typeof ( int ) ) ] SqlExpression seconds ,
75- [ Type ( typeof ( int ) ) ] SqlExpression millliseconds )
71+ [ Type ( typeof ( int ) ) ] SqlExpression milliseconds )
7672 {
77- return GenericIntervalConstruct ( days , hours , minutes , seconds , millliseconds ) ;
73+ return GenericIntervalConstruct ( days , hours , minutes , seconds , milliseconds ) ;
7874 }
7975
8076 [ Compiler ( typeof ( TimeSpan ) , "FromDays" , TargetKind . Method | TargetKind . Static ) ]
0 commit comments