private bool MacVerificationHelper(DateTime t)
    {
        IntPtr cfTimeZoneRef = CFDateTimeTools.CFTimeZoneCopySystem();
        bool   osResult      = CFDateTimeTools.CFTimeZoneIsDaylightSavingTime(cfTimeZoneRef, CFDateTimeTools.DateTimeToCFAbsoluteTime(t));
        bool   clrResult     = t.IsDaylightSavingTime();

        return(osResult == clrResult);
    }
Exemplo n.º 2
0
    public static string GetOSFormattedDate(DateTime d, bool getLocale)
    {
        IntPtr cfDateRef   = CFDateTimeTools.DateTimeToCFDateRef(d);
        IntPtr cfLocaleRef = (getLocale ? CFDateTimeTools.CFLocaleCopyCurrent() : IntPtr.Zero);
        IntPtr cfDateFmtr  = CFDateFormatterCreate(IntPtr.Zero, cfLocaleRef,
                                                   CFDateFormatterStyle.kCFDateFormatterLongStyle,
                                                   CFDateFormatterStyle.kCFDateFormatterLongStyle); // 3 for long style

        IntPtr cfStr = CFDateFormatterCreateStringWithDate(IntPtr.Zero, cfDateFmtr, cfDateRef);

        return(CFStringToSystemString(cfStr));
    }