@@ -195,7 +195,7 @@ public DateTime(long ticks)
195
195
/// nanoFramework doesn't support local time, only UTC, so it's not possible to specify <see cref="DateTimeKind.Local"/>.
196
196
/// </remarks>
197
197
public DateTime ( long ticks , DateTimeKind kind )
198
- : this ( ticks )
198
+ : this ( ticks )
199
199
{
200
200
// it's OK to check kind parameter only here
201
201
// if it's invalid the exception will be thrown anyway and allows the constructor to be reused
@@ -505,8 +505,7 @@ public int Month
505
505
/// </value>
506
506
public static DateTime UtcNow
507
507
{
508
- [ MethodImpl ( MethodImplOptions . InternalCall ) ]
509
- get => new DateTime ( ) ;
508
+ get => new DateTime ( GetUtcNowAsTicks ( ) , DateTimeKind . Utc ) ;
510
509
}
511
510
512
511
/// <summary>
@@ -556,8 +555,7 @@ public TimeSpan TimeOfDay
556
555
/// </value>
557
556
public static DateTime Today
558
557
{
559
- [ MethodImpl ( MethodImplOptions . InternalCall ) ]
560
- get => new DateTime ( ) ;
558
+ get => new DateTime ( GetTodayAsTicks ( ) , DateTimeKind . Utc ) ;
561
559
}
562
560
563
561
/// <summary>
@@ -826,10 +824,10 @@ public static bool TryParse(
826
824
string s ,
827
825
out DateTime result )
828
826
{
829
- result = Convert . NativeToDateTime (
830
- s ,
827
+ Convert . NativeToDateTime ( s ,
831
828
false ,
832
- out bool success ) ;
829
+ out bool success ,
830
+ out result ) ;
833
831
834
832
return success ;
835
833
}
@@ -839,5 +837,11 @@ public static bool TryParse(
839
837
840
838
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
841
839
private extern int GetDateTimePart ( DateTimePart part ) ;
840
+
841
+ [ MethodImpl ( MethodImplOptions . InternalCall ) ]
842
+ private extern static long GetUtcNowAsTicks ( ) ;
843
+
844
+ [ MethodImpl ( MethodImplOptions . InternalCall ) ]
845
+ private extern static long GetTodayAsTicks ( ) ;
842
846
}
843
847
}
0 commit comments