diff dstep/coreservices/carboncore/DateTimeUtils.d @ 11:07194b026fa4

Added bindings to a couple of frameworks, new license + some other things
author Jacob Carlborg <doob@me.com>
date Sat, 01 Aug 2009 15:03:28 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dstep/coreservices/carboncore/DateTimeUtils.d	Sat Aug 01 15:03:28 2009 +0200
@@ -0,0 +1,141 @@
+/**
+ * Copyright: Copyright (c) 2009 Jacob Carlborg.
+ * Authors: Jacob Carlborg
+ * Version: Initial created: Jul 21, 2009 
+ * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
+ */
+module dstep.coreservices.carboncore.DateTimeUtils;
+
+//import dstep.AvailabilityMacros;
+import dstep.coreservices.carboncore.ConditionalMacros;
+import dstep.coreservices.carboncore.MacTypes;
+import dstep.coreservices.carboncore.UTCUtils;
+import dstep.corefoundation.CFDate;
+
+alias short ToggleResults;
+alias byte LongDateField;
+alias byte DateForm;
+alias short StringToDateStatus;
+alias short String2DateStatus;
+alias DateCacheRecord* DateCachePtr;
+alias long LongDateTime;
+alias byte DateDelta;
+
+enum
+{
+	toggleUndefined = 0,
+	toggleOK = 1,
+	toggleBadField = 2,
+	toggleBadDelta = 3,
+	toggleBadChar = 4,
+	toggleUnknown = 5,
+	toggleBadNum = 6,
+	toggleOutOfRange = 7,
+	toggleErr3 = 7,
+	toggleErr4 = 8,
+	toggleErr5 = 9
+}
+
+enum
+{
+	smallDateBit = 31,
+	togChar12HourBit = 30,
+	togCharZCycleBit = 29,
+	togDelta12HourBit = 28,
+	genCdevRangeBit = 27,
+	validDateFields = -1,
+	maxDateField = 10
+}
+
+enum
+{
+	eraMask = 0x0001,
+	yearMask = 0x0002,
+	monthMask = 0x0004,
+	dayMask = 0x0008,
+	hourMask = 0x0010,
+	minuteMask = 0x0020,
+	secondMask = 0x0040,
+	dayOfWeekMask = 0x0080,
+	dayOfYearMask = 0x0100,
+	weekOfYearMask = 0x0200,
+	pmMask = 0x0400,
+	dateStdMask = 0x007F
+}
+
+enum
+{
+	eraField = 0,
+	yearField = 1,
+	monthField = 2,
+	dayField = 3,
+	hourField = 4,
+	minuteField = 5,
+	secondField = 6,
+	dayOfWeekField = 7,
+	dayOfYearField = 8,
+	weekOfYearField = 9,
+	pmField = 10,
+	res1Field = 11,
+	res2Field = 12,
+	res3Field = 13
+}
+
+enum
+{
+	shortDate = 0,
+	longDate = 1,
+	abbrevDate = 2
+}
+
+enum
+{
+	fatalDateTime = 0x8000,
+	longDateFound = 1,
+	leftOverChars = 2,
+	sepNotIntlSep = 4,
+	fieldOrderNotIntl = 8,
+	extraneousStrings = 16,
+	tooManySeps = 32,
+	sepNotConsistent = 64,
+	tokenErr = 0x8100,
+	cantReadUtilities = 0x8200,
+	dateTimeNotFound = 0x8400,
+	dateTimeInvalid = 0x8800
+}
+
+struct DateCacheRecord
+{
+	short* hidden;
+}
+
+
+struct DateTimeRec
+{
+	short year;
+	short month;
+	short day;
+	short hour;
+	short minute;
+	short second;
+	short dayOfWeek;
+}
+
+
+struct TogglePB
+{
+	int togFlags;
+	uint amChars;
+	uint pmChars;
+	long* reserved;
+}
+
+extern (C)
+{
+	int UCConvertUTCDateTimeToCFAbsoluteTime (UTCDateTime* iUTCDate, CFAbsoluteTime* oCFTime);
+	int UCConvertSecondsToCFAbsoluteTime (uint iSeconds, CFAbsoluteTime* oCFTime);
+	int UCConvertLongDateTimeToCFAbsoluteTime (long iLongTime, CFAbsoluteTime* oCFTime);
+	int UCConvertCFAbsoluteTimeToUTCDateTime (double iCFTime, UTCDateTime* oUTCDate);
+	int UCConvertCFAbsoluteTimeToSeconds (double iCFTime, UInt32* oSeconds);
+	int UCConvertCFAbsoluteTimeToLongDateTime (double iCFTime, LongDateTime* oLongDate);
+}
\ No newline at end of file