time 1.1.2.0 → 1.1.2.1
raw patch · 4 files changed
+230/−91 lines, 4 filesnew-uploader
Files
- Data/Time/Clock/POSIX.hs +3/−0
- Data/Time/Format/Parse.hs +226/−6
- include/HsTimeConfig.h +0/−84
- time.cabal +1/−1
Data/Time/Clock/POSIX.hs view
@@ -24,6 +24,9 @@ posixDayLength = 86400 -- | POSIX time is the nominal time since 1970-01-01 00:00 UTC+-- +-- To convert from a 'Foreign.C.CTime' or 'System.Posix.EpochTime', use 'realToFrac'.+-- type POSIXTime = NominalDiffTime unixEpochDay :: Day
Data/Time/Format/Parse.hs view
@@ -280,14 +280,13 @@ case c of 'z' -> zone 'Z' | null x -> t- | isUpper (head x) -> TimeZone offset dst x -- FIXME: figure out timezone offset?+ | isUpper (head x) ->+ case lookup x _TIMEZONES_ of+ Just (offset', dst') -> TimeZone offset' dst' x+ Nothing -> TimeZone offset dst x | otherwise -> zone _ -> t- where zone = TimeZone (sign * (60 * h + m)) dst name- where (s:h1:h2:m1:m2:[]) = x- sign = if s == '-' then -1 else 1- h = read [h1,h2]- m = read [m1,m2] + where zone = TimeZone (readTzOffset x) dst name instance ParseTime ZonedTime where buildTime l xs = foldl f (ZonedTime (buildTime l xs) (buildTime l xs)) xs@@ -323,3 +322,224 @@ instance Read UTCTime where readsPrec n s = [ (zonedTimeToUTC t, r) | (t,r) <- readsPrec n s ]++readTzOffset :: String -> Int+readTzOffset str =+ case str of+ (s:h1:h2:':':m1:m2:[]) -> calc s h1 h2 m1 m2+ (s:h1:h2:m1:m2:[]) -> calc s h1 h2 m1 m2+ _ -> 0+ where calc s h1 h2 m1 m2 = sign * (60 * h + m)+ where sign = if s == '-' then -1 else 1+ h = read [h1,h2]+ m = read [m1,m2]++_TIMEZONES_ :: [(String, (Int, Bool))]+_TIMEZONES_ =+ -- New Zealand Daylight-Saving Time+ [("NZDT", (readTzOffset "+13:00", True))+ -- International Date Line, East+ ,("IDLE", (readTzOffset "+12:00", False))+ -- New Zealand Standard Time+ ,("NZST", (readTzOffset "+12:00", False))+ -- New Zealand Time+ ,("NZT", (readTzOffset "+12:00", False))+ -- Australia Eastern Summer Standard Time+ ,("AESST", (readTzOffset "+11:00", False))+ -- Central Australia Summer Standard Time+ ,("ACSST", (readTzOffset "+10:30", False))+ -- Central Australia Daylight-Saving Time+ ,("CADT", (readTzOffset "+10:30", True))+ -- South Australian Daylight-Saving Time+ ,("SADT", (readTzOffset "+10:30", True))+ -- Australia Eastern Standard Time+ ,("AEST", (readTzOffset "+10:00", False))+ -- East Australian Standard Time+ ,("EAST", (readTzOffset "+10:00", False))+ -- Guam Standard Time, Russia zone 9+ ,("GST", (readTzOffset "+10:00", False))+ -- Melbourne, Australia+ ,("LIGT", (readTzOffset "+10:00", False))+ -- South Australia Standard Time+ ,("SAST", (readTzOffset "+09:30", False))+ -- Central Australia Standard Time+ ,("CAST", (readTzOffset "+09:30", False))+ -- Australia Western Summer Standard Time+ ,("AWSST", (readTzOffset "+09:00", False))+ -- Japan Standard Time, Russia zone 8+ ,("JST", (readTzOffset "+09:00", False))+ -- Korea Standard Time+ ,("KST", (readTzOffset "+09:00", False))+ -- Kwajalein Time+ ,("MHT", (readTzOffset "+09:00", False))+ -- West Australian Daylight-Saving Time+ ,("WDT", (readTzOffset "+09:00", True))+ -- Moluccas Time+ ,("MT", (readTzOffset "+08:30", False))+ -- Australia Western Standard Time+ ,("AWST", (readTzOffset "+08:00", False))+ -- China Coastal Time+ ,("CCT", (readTzOffset "+08:00", False))+ -- West Australian Daylight-Saving Time+ ,("WADT", (readTzOffset "+08:00", True))+ -- West Australian Standard Time+ ,("WST", (readTzOffset "+08:00", False))+ -- Java Time+ ,("JT", (readTzOffset "+07:30", False))+ -- Almaty Summer Time+ ,("ALMST", (readTzOffset "+07:00", False))+ -- West Australian Standard Time+ ,("WAST", (readTzOffset "+07:00", False))+ -- Christmas (Island) Time+ ,("CXT", (readTzOffset "+07:00", False))+ -- Myanmar Time+ ,("MMT", (readTzOffset "+06:30", False))+ -- Almaty Time+ ,("ALMT", (readTzOffset "+06:00", False))+ -- Mawson (Antarctica) Time+ ,("MAWT", (readTzOffset "+06:00", False))+ -- Indian Chagos Time+ ,("IOT", (readTzOffset "+05:00", False))+ -- Maldives Island Time+ ,("MVT", (readTzOffset "+05:00", False))+ -- Kerguelen Time+ ,("TFT", (readTzOffset "+05:00", False))+ -- Afghanistan Time+ ,("AFT", (readTzOffset "+04:30", False))+ -- Antananarivo Summer Time+ ,("EAST", (readTzOffset "+04:00", False))+ -- Mauritius Island Time+ ,("MUT", (readTzOffset "+04:00", False))+ -- Reunion Island Time+ ,("RET", (readTzOffset "+04:00", False))+ -- Mahe Island Time+ ,("SCT", (readTzOffset "+04:00", False))+ -- Iran Time+ ,("IRT", (readTzOffset "+03:30", False))+ -- Iran Time+ ,("IT", (readTzOffset "+03:30", False))+ -- Antananarivo, Comoro Time+ ,("EAT", (readTzOffset "+03:00", False))+ -- Baghdad Time+ ,("BT", (readTzOffset "+03:00", False))+ -- Eastern Europe Daylight-Saving Time+ ,("EETDST", (readTzOffset "+03:00", True))+ -- Hellas Mediterranean Time (?)+ ,("HMT", (readTzOffset "+03:00", False))+ -- British Double Summer Time+ ,("BDST", (readTzOffset "+02:00", False))+ -- Central European Summer Time+ ,("CEST", (readTzOffset "+02:00", False))+ -- Central European Daylight-Saving Time+ ,("CETDST", (readTzOffset "+02:00", True))+ -- Eastern European Time, Russia zone 1+ ,("EET", (readTzOffset "+02:00", False))+ -- French Winter Time+ ,("FWT", (readTzOffset "+02:00", False))+ -- Israel Standard Time+ ,("IST", (readTzOffset "+02:00", False))+ -- Middle European Summer Time+ ,("MEST", (readTzOffset "+02:00", False))+ -- Middle Europe Daylight-Saving Time+ ,("METDST", (readTzOffset "+02:00", True))+ -- Swedish Summer Time+ ,("SST", (readTzOffset "+02:00", False))+ -- British Summer Time+ ,("BST", (readTzOffset "+01:00", False))+ -- Central European Time+ ,("CET", (readTzOffset "+01:00", False))+ -- Dansk Normal Tid+ ,("DNT", (readTzOffset "+01:00", False))+ -- French Summer Time+ ,("FST", (readTzOffset "+01:00", False))+ -- Middle European Time+ ,("MET", (readTzOffset "+01:00", False))+ -- Middle European Winter Time+ ,("MEWT", (readTzOffset "+01:00", False))+ -- Mitteleuropaeische Zeit+ ,("MEZ", (readTzOffset "+01:00", False))+ -- Norway Standard Time+ ,("NOR", (readTzOffset "+01:00", False))+ -- Seychelles Time+ ,("SET", (readTzOffset "+01:00", False))+ -- Swedish Winter Time+ ,("SWT", (readTzOffset "+01:00", False))+ -- Western European Daylight-Saving Time+ ,("WETDST", (readTzOffset "+01:00", True))+ -- Greenwich Mean Time+ ,("GMT", (readTzOffset "+00:00", False))+ -- Universal Time+ ,("UT", (readTzOffset "+00:00", False))+ -- Universal Coordinated Time+ ,("UTC", (readTzOffset "+00:00", False))+ -- Same as UTC+ ,("Z", (readTzOffset "+00:00", False))+ -- Same as UTC+ ,("ZULU", (readTzOffset "+00:00", False))+ -- Western European Time+ ,("WET", (readTzOffset "+00:00", False))+ -- West Africa Time+ ,("WAT", (readTzOffset "-01:00", False))+ -- Fernando de Noronha Summer Time+ ,("FNST", (readTzOffset "-01:00", False))+ -- Fernando de Noronha Time+ ,("FNT", (readTzOffset "-02:00", False))+ -- Brasilia Summer Time+ ,("BRST", (readTzOffset "-02:00", False))+ -- Newfoundland Daylight-Saving Time+ ,("NDT", (readTzOffset "-02:30", True))+ -- Atlantic Daylight-Saving Time+ ,("ADT", (readTzOffset "-03:00", True))+ -- (unknown)+ ,("AWT", (readTzOffset "-03:00", False))+ -- Brasilia Time+ ,("BRT", (readTzOffset "-03:00", False))+ -- Newfoundland Standard Time+ ,("NFT", (readTzOffset "-03:30", False))+ -- Newfoundland Standard Time+ ,("NST", (readTzOffset "-03:30", False))+ -- Atlantic Standard Time (Canada)+ ,("AST", (readTzOffset "-04:00", False))+ -- Atlantic/Porto Acre Summer Time+ ,("ACST", (readTzOffset "-04:00", False))+ -- Eastern Daylight-Saving Time+ ,("EDT", (readTzOffset "-04:00", True))+ -- Atlantic/Porto Acre Standard Time+ ,("ACT", (readTzOffset "-05:00", False))+ -- Central Daylight-Saving Time+ ,("CDT", (readTzOffset "-05:00", True))+ -- Eastern Standard Time+ ,("EST", (readTzOffset "-05:00", False))+ -- Central Standard Time+ ,("CST", (readTzOffset "-06:00", False))+ -- Mountain Daylight-Saving Time+ ,("MDT", (readTzOffset "-06:00", True))+ -- Mountain Standard Time+ ,("MST", (readTzOffset "-07:00", False))+ -- Pacific Daylight-Saving Time+ ,("PDT", (readTzOffset "-07:00", True))+ -- Alaska Daylight-Saving Time+ ,("AKDT", (readTzOffset "-08:00", True))+ -- Pacific Standard Time+ ,("PST", (readTzOffset "-08:00", False))+ -- Yukon Daylight-Saving Time+ ,("YDT", (readTzOffset "-08:00", True))+ -- Alaska Standard Time+ ,("AKST", (readTzOffset "-09:00", False))+ -- Hawaii/Alaska Daylight-Saving Time+ ,("HDT", (readTzOffset "-09:00", True))+ -- Yukon Standard Time+ ,("YST", (readTzOffset "-09:00", False))+ -- Marquesas Time+ ,("MART", (readTzOffset "-09:30", False))+ -- Alaska/Hawaii Standard Time+ ,("AHST", (readTzOffset "-10:00", False))+ -- Hawaii Standard Time+ ,("HST", (readTzOffset "-10:00", False))+ -- Central Alaska Time+ ,("CAT", (readTzOffset "-10:00", False))+ -- Nome Time+ ,("NT", (readTzOffset "-11:00", False))+ -- International Date Line, West+ ,("IDLW", (readTzOffset "-12:00", False))+ ]
include/HsTimeConfig.h view
@@ -1,84 +0,0 @@-/* include/HsTimeConfig.h. Generated from HsTimeConfig.h.in by configure. */-/* include/HsTimeConfig.h.in. Generated from configure.ac by autoheader. */--/* Define to 1 if you have the declaration of `altzone', and to 0 if you- don't. */-#define HAVE_DECL_ALTZONE 0--/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.- */-/* #undef HAVE_DECL_TZNAME */--/* Define to 1 if you have the `gmtime_r' function. */-#define HAVE_GMTIME_R 1--/* Define to 1 if you have the <inttypes.h> header file. */-#define HAVE_INTTYPES_H 1--/* Define to 1 if you have the `localtime_r' function. */-#define HAVE_LOCALTIME_R 1--/* Define to 1 if you have the <memory.h> header file. */-#define HAVE_MEMORY_H 1--/* Define to 1 if you have the <stdint.h> header file. */-#define HAVE_STDINT_H 1--/* Define to 1 if you have the <stdlib.h> header file. */-#define HAVE_STDLIB_H 1--/* Define to 1 if you have the <strings.h> header file. */-#define HAVE_STRINGS_H 1--/* Define to 1 if you have the <string.h> header file. */-#define HAVE_STRING_H 1--/* Define to 1 if `tm_zone' is member of `struct tm'. */-#define HAVE_STRUCT_TM_TM_ZONE 1--/* Define to 1 if you have the <sys/stat.h> header file. */-#define HAVE_SYS_STAT_H 1--/* Define to 1 if you have the <sys/time.h> header file. */-#define HAVE_SYS_TIME_H 1--/* Define to 1 if you have the <sys/types.h> header file. */-#define HAVE_SYS_TYPES_H 1--/* Define to 1 if you have the <time.h> header file. */-#define HAVE_TIME_H 1--/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use- `HAVE_STRUCT_TM_TM_ZONE' instead. */-#define HAVE_TM_ZONE 1--/* Define to 1 if you don't have `tm_zone' but do have the external array- `tzname'. */-/* #undef HAVE_TZNAME */--/* Define to 1 if you have the <unistd.h> header file. */-#define HAVE_UNISTD_H 1--/* Define to the address where bug reports for this package should be sent. */-#define PACKAGE_BUGREPORT "ashley@semantic.org"--/* Define to the full name of this package. */-#define PACKAGE_NAME "Haskell time package"--/* Define to the full name and version of this package. */-#define PACKAGE_STRING "Haskell time package 1.1.1"--/* Define to the one symbol short name of this package. */-#define PACKAGE_TARNAME "time"--/* Define to the version of this package. */-#define PACKAGE_VERSION "1.1.1"--/* Define to 1 if you have the ANSI C header files. */-#define STDC_HEADERS 1--/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */-#define TIME_WITH_SYS_TIME 1--/* Define to 1 if your <sys/time.h> declares `struct tm'. */-/* #undef TM_IN_SYS_TIME */
time.cabal view
@@ -1,5 +1,5 @@ Name: time-Version: 1.1.2.0+Version: 1.1.2.1 Stability: stable License: BSD3 License-File: LICENSE