[corlib] DateTime, TimeSpan and TimeZone from CoreFX (#11232)
[mono-project.git] / mcs / class / corlib / corefx / DateTime.cs
blob56fcc0962d431c2678a21399d4c47d190f810869
1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
5 using System;
6 using System.Runtime;
7 using System.Runtime.InteropServices;
8 using System.Runtime.CompilerServices;
10 namespace System
12 partial struct DateTime
14 public static DateTime UtcNow
16 get
18 long ticks = GetSystemTimeAsFileTime();
19 return new DateTime(((UInt64)(ticks + FileTimeOffset)) | KindUtc);
23 [MethodImplAttribute(MethodImplOptions.InternalCall)]
24 internal static extern long GetSystemTimeAsFileTime();
26 internal Int64 ToBinaryRaw() => (Int64)_dateData;