{-# OPTIONS -fno-warn-orphans -fno-warn-unused-imports #-}#include "HsConfigure.h"-- #hidemoduleData.Time.LocalTime.LocalTime(-- * Local TimeLocalTime(..),-- converting UTC and UT1 times to LocalTimeutcToLocalTime,localTimeToUTC,ut1ToLocalTime,localTimeToUT1,ZonedTime(..),utcToZonedTime,zonedTimeToUTC,getZonedTime,utcToLocalZonedTime)whereimportData.Time.LocalTime.TimeOfDayimportData.Time.LocalTime.TimeZoneimportData.Time.CalendarimportData.Time.ClockimportData.Typeable#if LANGUAGE_Rank2TypesimportData.Data#endif-- | A simple day and time aggregate, where the day is of the specified parameter,-- and the time is a TimeOfDay.-- Conversion of this (as local civil time) to UTC depends on the time zone.-- Conversion of this (as local mean time) to UT1 depends on the longitude.dataLocalTime=LocalTime{localDay::Day,localTimeOfDay::TimeOfDay}deriving(Eq,Ord#if LANGUAGE_DeriveDataTypeable#if LANGUAGE_Rank2Types#if HAS_DataPico,Data#endif#endif#endif)instanceTypeableLocalTimewheretypeOf_=mkTyConApp(mkTyCon"Data.Time.LocalTime.LocalTime.LocalTime")[]instanceShowLocalTimewhereshow(LocalTimedt)=(showGregoriand)++" "++(showt)-- | show a UTC time in a given time zone as a LocalTimeutcToLocalTime::TimeZone->UTCTime->LocalTimeutcToLocalTimetz(UTCTimedaydt)=LocalTime(addDaysiday)todwhere(i,tod)=utcToLocalTimeOfDaytz(timeToTimeOfDaydt)-- | find out what UTC time a given LocalTime in a given time zone islocalTimeToUTC::TimeZone->LocalTime->UTCTimelocalTimeToUTCtz(LocalTimedaytod)=UTCTime(addDaysiday)(timeOfDayToTimetodUTC)where(i,todUTC)=localToUTCTimeOfDaytztod-- | 1st arg is observation meridian in degrees, positive is Eastut1ToLocalTime::Rational->UniversalTime->LocalTimeut1ToLocalTimelong(ModJulianDatedate)=LocalTime(ModifiedJulianDaylocalMJD)(dayFractionToTimeOfDaylocalToDOffset)wherelocalTime=date+long/360::RationallocalMJD=floorlocalTimelocalToDOffset=localTime-(fromIntegrallocalMJD)-- | 1st arg is observation meridian in degrees, positive is EastlocalTimeToUT1::Rational->LocalTime->UniversalTimelocalTimeToUT1long(LocalTime(ModifiedJulianDaylocalMJD)tod)=ModJulianDate((fromIntegrallocalMJD)+(timeOfDayToDayFractiontod)-(long/360))-- | A local time together with a TimeZone.dataZonedTime=ZonedTime{zonedTimeToLocalTime::LocalTime,zonedTimeZone::TimeZone}#if LANGUAGE_DeriveDataTypeable#if LANGUAGE_Rank2Types#if HAS_DataPicoderiving(Data)#endif#endif#endifinstanceTypeableZonedTimewheretypeOf_=mkTyConApp(mkTyCon"Data.Time.LocalTime.LocalTime.ZonedTime")[]utcToZonedTime::TimeZone->UTCTime->ZonedTimeutcToZonedTimezonetime=ZonedTime(utcToLocalTimezonetime)zonezonedTimeToUTC::ZonedTime->UTCTimezonedTimeToUTC(ZonedTimetzone)=localTimeToUTCzonetinstanceShowZonedTimewhereshow(ZonedTimetzone)=showt++" "++showzone-- orphan instanceinstanceShowUTCTimewhereshowt=show(utcToZonedTimeutct)getZonedTime::IOZonedTimegetZonedTime=dot<-getCurrentTimezone<-getTimeZonetreturn(utcToZonedTimezonet)-- |utcToLocalZonedTime::UTCTime->IOZonedTimeutcToLocalZonedTimet=dozone<-getTimeZonetreturn(utcToZonedTimezonet)