code
stringlengths
3
10M
language
stringclasses
31 values
; Copyright (C) 2008 The Android Open Source Project ; ; Licensed under the Apache License, Version 2.0 (the "License"); ; you may not use this file except in compliance with the License. ; You may obtain a copy of the License at ; ; http://www.apache.org/licenses/LICENSE-2.0 ; ; Unless required by applicable law or agreed to in writing, software ; distributed under the License is distributed on an "AS IS" BASIS, ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ; See the License for the specific language governing permissions and ; limitations under the License. .source T_f1_3.java .class public dot.junit.format.f1.d.T_f1_3 .super java/lang/Object .method public <init>()V .limit regs 1 invoke-direct {v0}, java/lang/Object/<init>()V return-void .end method .method public run()V .limit regs 3 const v0, 123 nop nop nop nop const v2, 456 return-void .end method
D
module sendero.util.syndication.Rss20; import sendero.util.syndication.Common; import tango.net.http.HttpGet; import tango.time.Time, tango.time.ISO8601; import tango.text.convert.TimeStamp; import sendero.time.Format; import sendero_base.xml.XmlEntities; import sendero_base.util.IndentingPrinter; alias IndentingPrinter Printer; alias encodeBuiltinEntities encode; import sendero.http.IRenderable; debug import tango.io.Stdout; class Rss20Common { char[] title; char[] link; char[] description; Time pubDate; protected bool handleCommonElements(XmlDocument.Node node, ref char[] value) { if(node.rawValue.length) value = node.rawValue; else if(node.firstChild && ( node.firstChild.type == XmlNodeType.Data || node.firstChild.type == XmlNodeType.CData)) { value = node.firstChild.rawValue; } switch(node.localName) { case "title": this.title = value; return true; case "link": this.link = value; return true; case "description": description ~= value; return true; case "pubDate": rfc1123(value, pubDate); return true; default: return false; } } protected void printCommonElements(Printer printer) { printer.formatln(`<title>{}</title>">`, title); printer.formatln(`<link>{}</link>`, link); printer.formatln(`<description>{}</description>`, description); } } class Rss20Item : Rss20Common { this() { } char[] author; char[][] categories; void print(Printer printer) { printer("<item>").newline; printer.indent; printCommonElements(printer); printer.formatln(`<author>{}</author>">`, author); foreach(cat; categories) printer.formatln(`<category>{}</category>`, cat); printer.dedent; printer("</item>").newline; } private this(XmlDocument.Node entry) { parse_(entry); } private void parse_(XmlDocument.Node entry) { foreach(node; entry.children) { char[] value; if(handleCommonElements(node, value)) continue; switch(node.localName) { case "author": this.author = value; break; case "category": this.categories ~= value; break; default: break; } } } } class Rss20Feed : Rss20Common, IRenderable { package this() { } this(char[] url) { this.url = url; } Rss20Item[] items; char[] url; char[] src; void parse() { parse_(src); } bool get() { try { auto page = new HttpGet(url); auto res = cast(char[])page.read; parse_(res); return true; } catch(Exception ex) { return false; } } void publish(void delegate(char[]) consumer) { auto printer = new IndentingPrinter(consumer); printer(`<?xml version="1.0" encoding="UTF-8"?>`).newline; printer(`<rss version="2.0">`).newline; printer.indent; printer(`<channel>`).newline; printer.newline; printer.indent; printCommonElements(printer); printEntries_(printer); printer.dedent; printer("</channel>").newline; printer.dedent; printer(`</rss>`).newline; } void render(void delegate(void[]) write) { publish(cast(void delegate(char[]))write); } char[] contentType() { return "text/xml"; } protected void printEntries_(Printer printer) { foreach(item; items) { item.print(printer); printer.newline; } } package void parseChannel_(XmlDocument.Node channel) { foreach(node; channel.children) { char[] value; if(handleCommonElements(node, value)) continue; switch(node.localName) { case "item": items ~= new Rss20Item(node); break; default: break; } } } private void parse_(char[] src) { this.src = src; auto doc = new XmlDocument; doc.parse(src); foreach(n; doc.root.children) { if(n.name != "rss") continue; foreach(m; n.children) { if(m.name != "channel") continue; parseChannel_(m); break; } break; } } } debug(SenderoUnittest) { unittest { } }
D
//Not work! module adl.thread_pool; import core.sys.posix.pthread; // just for pthread_self() import core.thread; import core.sync.mutex; import core.sync.condition; import std.c.time; private struct Job { Job *next; void function() fn; void delegate() dg; void *arg; int call; } /** * semi-daemon thread of thread pool */ class CThreadPool { public: /** * Constructs a CThreadPool * @param nMaxThread {int} the max number threads in thread pool * @param idleTimeout {int} when > 0, the idle thread will * exit after idleTimeout seconds, if == 0, the idle thread * will not exit * @param sz {size_t} when > 0, the thread will be created which * stack size is sz. */ this(int nMaxThread, int idleTimeout, size_t sz = 0) { m_nMaxThread = nMaxThread; m_idleTimeout = idleTimeout; m_stackSize = sz; m_mutex = new Mutex; m_cond = new Condition(m_mutex); } /** * Append one task into the thread pool's task queue * @param fn {void function()} */ void append(void function() fn) { Job *job; char buf[256]; if (fn == null) throw new Exception("fn null"); job = new Job; job.fn = fn; job.next = null; job.call = Call.FN; m_mutex.lock(); append(job); m_mutex.unlock(); } /** * Append one task into the thread pool's task queue * @param dg {void delegate()} */ void append(void delegate() dg) { Job *job; char buf[256]; if (dg == null) throw new Exception("dg null"); job = new Job; job.dg = dg; job.next = null; job.call = Call.DG; m_mutex.lock(); append(job); m_mutex.unlock(); } /** * If dg not null, when one new thread is created, dg will be called. * @param dg {void delegate()} */ void onThreadInit(void delegate() dg) { m_onThreadInit = dg; } /** * If dg not null, before one thread exits, db will be called. * @param dg {void delegate()} */ void onThreadExit(void delegate() dg) { m_onThreadExit = dg; } private: enum Call { NO, FN, DG } Mutex m_mutex; Condition m_cond; size_t m_stackSize = 0; Job* m_jobHead = null, m_jobTail = null; int m_nJob = 0; bool m_isQuit = false; int m_nThread = 0; int m_nMaxThread; int m_nIdleThread = 0; int m_overloadTimeWait = 0; int m_idleTimeout; time_t m_lastWarn; void delegate() m_onThreadInit; void delegate() m_onThreadExit; void append(Job *job) { if (m_jobHead == null) m_jobHead = job; else m_jobTail.next = job; m_jobTail = job; m_nJob++; if (m_nIdleThread > 0) { m_cond.notify(); } else if (m_nThread < m_nMaxThread) { Thread thread = new Thread(&doJob); thread.isDaemon = true; thread.start(); m_nThread++; } else if (m_nJob > 10 * m_nMaxThread) { time_t now = time(null); if (now - m_lastWarn >= 2) { m_lastWarn = now; } if (m_overloadTimeWait > 0) { Thread.sleep(m_overloadTimeWait); } } } void doJob() { Job *job; int status; bool timedout; long period = m_idleTimeout * 10_000_000; if (m_onThreadInit != null) m_onThreadInit(); m_mutex.lock(); for (;;) { timedout = false; while (m_jobHead == null && !m_isQuit) { m_nIdleThread++; if (period > 0) { try { if (m_cond.wait(period) == false) { timedout = true; break; } } catch (SyncException e) { m_nIdleThread--; m_nThread--; m_mutex.unlock(); if (m_onThreadExit != null) m_onThreadExit(); throw e; } } else { m_cond.wait(); } m_nIdleThread--; } /* end while */ job = m_jobHead; if (job != null) { m_jobHead = job.next; m_nJob--; if (m_jobTail == job) m_jobTail = null; /* the lock shuld be unlocked before enter working processs */ m_mutex.unlock(); switch (job.call) { case Call.FN: job.fn(); break; case Call.DG: job.dg(); break; default: break; } /* lock again */ m_mutex.lock(); } if (m_jobHead == null && m_isQuit) { m_nThread--; if (m_nThread == 0) m_cond.notifyAll(); break; } if (m_jobHead == null && timedout) { m_nThread--; break; } } m_mutex.unlock(); writefln("Thread(%d) of ThreadPool exit now", pthread_self()); if (m_onThreadExit != null) m_onThreadExit(); } } import std.stdio; unittest { CThreadPool pool = new CThreadPool(10, 10); void testThreadInit(string s) { void onThreadInit() { writefln("thread(%d) was created now, s: %s", pthread_self(), s); } pool.onThreadInit(&onThreadInit); } void testThreadExit(string s) { void onThreadExit() { writefln("thread(%d) was to exit now, s: %s", pthread_self(), s); } pool.onThreadExit(&onThreadExit); } void testAddJobs(string s) { void threadFun() { writef("doJob thread id: %d, str: %s\n", pthread_self(), s); Thread.sleep(10_000_000); writef("doJob thread id: %d, wakeup now\n", pthread_self()); } pool.append(&threadFun); pool.append(&threadFun); pool.append(&threadFun); } string s = "hello world"; string s1 = "new thread was ok now"; string s2 = "thread exited now"; testThreadInit(s1); testThreadExit(s2); testAddJobs(s); Thread.sleep(100_000_000); }
D
import std.stdio; string f1 = "test.txt"; string f2 = "test2.txt"; void main(){ writeln("Program Start"); writeln("Creating File 1"); File file1 = File(f1, "r"); writeln("Creating File 1 Done"); writeln("Creating File 2"); File file2 = File(f2, "w"); writeln("Creating File 2 Done"); writeln("Writing to File 2"); foreach(string line; lines(file1)) { file2.writeln(line.length); } writeln("Writing to File 2 Done"); writeln("Closing File 1"); file1.close(); writeln("Closing File 1 Done"); writeln("Closing File 2"); file2.close(); writeln("Closing File 2 Done"); writeln("Opening File 2"); file2.open(f2, "r"); writeln("Opening File 2 Done"); writeln("Reading File 2"); foreach(string line; lines(file2)) { writeln(line); } writeln("Reading File 2 Done"); writeln("Closing File 2"); file2.close(); writeln("Closing File 2 Done"); writeln("Exiting Program"); }
D
module android.java.android.widget.RemoteViews_ActionException_d_interface; import arsd.jni : IJavaObjectImplementation, JavaPackageId, JavaName, IJavaObject, ImportExportImpl, JavaInterfaceMembers; static import arsd.jni; import import2 = android.java.java.io.PrintStream_d_interface; import import5 = android.java.java.lang.Class_d_interface; import import3 = android.java.java.io.PrintWriter_d_interface; import import4 = android.java.java.lang.StackTraceElement_d_interface; import import0 = android.java.java.lang.JavaException_d_interface; import import1 = android.java.java.lang.JavaThrowable_d_interface; @JavaName("RemoteViews$ActionException") final class RemoteViews_ActionException : IJavaObject { static immutable string[] _d_canCastTo = [ ]; @Import this(import0.JavaException); @Import this(string); @Import string getMessage(); @Import string getLocalizedMessage(); @Import import1.JavaThrowable getCause(); @Import import1.JavaThrowable initCause(import1.JavaThrowable); @Import @JavaName("toString") string toString_(); override string toString() { return arsd.jni.javaObjectToString(this); } @Import void printStackTrace(); @Import void printStackTrace(import2.PrintStream); @Import void printStackTrace(import3.PrintWriter); @Import import1.JavaThrowable fillInStackTrace(); @Import import4.StackTraceElement[] getStackTrace(); @Import void setStackTrace(import4.StackTraceElement[]); @Import void addSuppressed(import1.JavaThrowable); @Import import1.JavaThrowable[] getSuppressed(); @Import import5.Class getClass(); @Import int hashCode(); @Import bool equals(IJavaObject); @Import void notify(); @Import void notifyAll(); @Import void wait(long); @Import void wait(long, int); @Import void wait(); mixin IJavaObjectImplementation!(false); public static immutable string _javaParameterString = "Landroid/widget/RemoteViews$ActionException;"; }
D
# FIXED NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/npi/npi_frame_hci.c NPI/npi_frame_hci.obj: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/string.h NPI/npi_frame_hci.obj: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/linkage.h NPI/npi_frame_hci.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/std.h NPI/npi_frame_hci.obj: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/stdarg.h NPI/npi_frame_hci.obj: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/stddef.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/targets/arm/elf/std.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/targets/arm/elf/M3.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/targets/std.h NPI/npi_frame_hci.obj: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/stdint.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/npi/inc/npi_rxbuf.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/../_common/cc26xx/_hal_types.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/OSAL.h NPI/npi_frame_hci.obj: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/limits.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/comdef.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/include/hal_defs.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/OSAL_Memory.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/OSAL_Timers.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/icall/include/ICall.h NPI/npi_frame_hci.obj: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/stdbool.h NPI/npi_frame_hci.obj: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/stdlib.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/npi/inc/npi_config.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/packages/ti/boards/SRF06EB/CC2650EM_7ID/Board.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/packages/ti/drivers/PIN.h NPI/npi_frame_hci.obj: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/stddef.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_types.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_chip_def.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/ioc.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_memmap.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_ioc.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_ints.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/interrupt.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_nvic.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/debug.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/cpu.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/rom.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/gpio.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_gpio.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/npi/inc/npi_frame.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/npi/inc/npi_data.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/hci/hci_tl.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/hci.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/bcomdef.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/controller/CC26xx/include/ll.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/include/hal_assert.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/include/hal_uart.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/include/hal_board.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_board_cfg.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_mcu.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/systick.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/uart.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_uart.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/flash.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_flash.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_aon_sysctl.h NPI/npi_frame_hci.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_fcfg1.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/hci/hci_data.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/hci/hci_event.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/hci/hci_tl.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/npi/inc/npi_ble.h NPI/npi_frame_hci.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/npi/npi_frame_hci.c: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/string.h: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/linkage.h: C:/ti/xdctools_3_31_01_33_core/packages/xdc/std.h: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/stdarg.h: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/stddef.h: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/targets/arm/elf/std.h: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/targets/arm/elf/M3.h: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/targets/std.h: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/stdint.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/npi/inc/npi_rxbuf.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/../_common/cc26xx/_hal_types.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/OSAL.h: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/limits.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/comdef.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/include/hal_defs.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/OSAL_Memory.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/OSAL_Timers.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/icall/include/ICall.h: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/stdbool.h: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/stdlib.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/npi/inc/npi_config.h: C:/ti/tirtos_simplelink_2_13_00_06/packages/ti/boards/SRF06EB/CC2650EM_7ID/Board.h: C:/ti/tirtos_simplelink_2_13_00_06/packages/ti/drivers/PIN.h: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/stddef.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_types.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_chip_def.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/ioc.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_memmap.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_ioc.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_ints.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/interrupt.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_nvic.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/debug.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/cpu.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/rom.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/gpio.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_gpio.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/npi/inc/npi_frame.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/npi/inc/npi_data.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/hci/hci_tl.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/hci.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/bcomdef.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/controller/CC26xx/include/ll.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/include/hal_assert.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/include/hal_uart.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/include/hal_board.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_board_cfg.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_mcu.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/systick.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/uart.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_uart.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/flash.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_flash.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_aon_sysctl.h: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_fcfg1.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/hci/hci_data.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/hci/hci_event.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/hci/hci_tl.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/npi/inc/npi_ble.h: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h:
D
# FIXED Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/common/cc26xx/aoa/AOA.c Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/DeviceFamily.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/stdint.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/sys/stdint.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/sys/cdefs.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/sys/_types.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/machine/_types.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/machine/_stdint.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/sys/_stdint.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/stdlib.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/_ti_config.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/linkage.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/dpl/ClockP.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/stdbool.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/stddef.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/family/arm/m3/Hwi.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/std.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/stdarg.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/targets/arm/elf/std.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/targets/arm/elf/M3.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/targets/std.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/xdc.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types__prologue.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/package/package.defs.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types__epilogue.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IInstance.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/family/arm/m3/Hwi__prologue.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/family/arm/m3/package/package.defs.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Diags.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Diags__prologue.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Main.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IHeap.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IInstance.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error__prologue.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Main.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error__epilogue.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Memory.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IHeap.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/package/Memory_HeapProxy.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IInstance.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IHeap.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IGateProvider.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IInstance.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/package/Main_Module_GateProxy.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IInstance.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IGateProvider.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Diags__epilogue.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Log.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Log__prologue.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Main.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Diags.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Diags.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Text.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Log__epilogue.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Assert.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Assert__prologue.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Main.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Diags.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Diags.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Assert__epilogue.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/BIOS.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/BIOS__prologue.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/package/package.defs.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IGateProvider.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/package/BIOS_RtsGateProxy.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IInstance.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IGateProvider.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/BIOS__epilogue.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/interfaces/IHwi.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IInstance.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/interfaces/package/package.defs.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error.h Drivers/AOA/AOA.obj: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/family/arm/m3/Hwi__epilogue.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/complex.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/math.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/_defs.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/machine/_limits.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/controller/cc26xx_r2/inc/ll_common.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/rf/RF.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/dpl/SemaphoreP.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/rf_common_cmd.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/rf_mailbox.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/string.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/rf_prop_cmd.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/rf_ble_cmd.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/hal/src/target/_common/cc26xx/rf_hal.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/hal/src/target/_common/hal_types.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/hal/src/target/_common/../_common/cc26xx/_hal_types.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/osal/src/inc/osal.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/limits.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/osal/src/inc/comdef.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/hal/src/target/_common/hal_types.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/hal/src/inc/hal_defs.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/osal/src/inc/osal_memory.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/osal/src/inc/osal_timers.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/icall/src/inc/icall.h Drivers/AOA/AOA.obj: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/stdlib.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/hal/src/inc/hal_assert.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/hal/src/target/_common/hal_types.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/controller/cc26xx_r2/inc/ll.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/inc/bcomdef.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/controller/cc26xx_r2/inc/ll_scheduler.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/common/cc26xx/aoa/AOA.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/PIN.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/timer/GPTimerCC26XX.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/dpl/HwiP.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/inc/hw_gpt.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/event.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_types.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/../inc/hw_chip_def.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_memmap.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_event.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/debug.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/ioc.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_ioc.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_ints.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/interrupt.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_nvic.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/cpu.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_cpu_scs.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../driverlib/rom.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/gpio.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_gpio.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/timer.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/dma/UDMACC26XX.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/Power.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/utils/List.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/power/PowerCC26XX.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/udma.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_udma.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/common/cc26xx/aoa/RFQueue.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/rf_data_entry.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/display/Display.h Drivers/AOA/AOA.obj: E:/ccs8.2/workspace/aoa_receiver_cc2640r2lp_app/Application/aoa_receiver.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/inc/hw_ccfg.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/inc/hw_fcfg1.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/inc/hw_rfc_rat.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/inc/hw_rfc_dbell.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/rf_patches/rf_patch_cpe_aoa_aod.h Drivers/AOA/AOA.obj: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/rf_patches/rf_patch_mce_aoa_aod.h E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/common/cc26xx/aoa/AOA.c: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/DeviceFamily.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/stdint.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/sys/stdint.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/sys/cdefs.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/sys/_types.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/machine/_types.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/machine/_stdint.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/sys/_stdint.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/stdlib.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/_ti_config.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/linkage.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/dpl/ClockP.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/stdbool.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/stddef.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/family/arm/m3/Hwi.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/std.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/stdarg.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/targets/arm/elf/std.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/targets/arm/elf/M3.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/targets/std.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/xdc.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types__prologue.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/package/package.defs.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types__epilogue.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IInstance.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/family/arm/m3/Hwi__prologue.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/family/arm/m3/package/package.defs.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Diags.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Diags__prologue.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Main.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IHeap.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IInstance.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error__prologue.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Main.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error__epilogue.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Memory.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IHeap.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/package/Memory_HeapProxy.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IInstance.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IHeap.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IGateProvider.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IInstance.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/package/Main_Module_GateProxy.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IInstance.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IGateProvider.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Diags__epilogue.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Log.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Log__prologue.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Main.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Diags.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Diags.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Text.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Log__epilogue.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Assert.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Assert__prologue.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Main.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Diags.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Diags.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Assert__epilogue.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/BIOS.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/BIOS__prologue.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/package/package.defs.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IGateProvider.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/package/BIOS_RtsGateProxy.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IInstance.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IGateProvider.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/BIOS__epilogue.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/interfaces/IHwi.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Types.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IInstance.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/interfaces/package/package.defs.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/Error.h: E:/ccs8.2/xdctools_3_50_08_24_core/packages/xdc/runtime/IModule.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/kernel/tirtos/packages/ti/sysbios/family/arm/m3/Hwi__epilogue.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/complex.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/math.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/_defs.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/machine/_limits.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/controller/cc26xx_r2/inc/ll_common.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/rf/RF.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/dpl/SemaphoreP.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/rf_common_cmd.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/rf_mailbox.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/string.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/rf_prop_cmd.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/rf_ble_cmd.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/hal/src/target/_common/cc26xx/rf_hal.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/hal/src/target/_common/hal_types.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/hal/src/target/_common/../_common/cc26xx/_hal_types.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/osal/src/inc/osal.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/limits.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/osal/src/inc/comdef.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/hal/src/target/_common/hal_types.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/hal/src/inc/hal_defs.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/osal/src/inc/osal_memory.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/osal/src/inc/osal_timers.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/icall/src/inc/icall.h: E:/ccs8.2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include/stdlib.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/hal/src/inc/hal_assert.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/hal/src/target/_common/hal_types.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/controller/cc26xx_r2/inc/ll.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/inc/bcomdef.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/controller/cc26xx_r2/inc/ll_scheduler.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/common/cc26xx/aoa/AOA.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/PIN.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/timer/GPTimerCC26XX.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/dpl/HwiP.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/inc/hw_gpt.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/event.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_types.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/../inc/hw_chip_def.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_memmap.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_event.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/debug.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/ioc.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_ioc.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_ints.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/interrupt.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_nvic.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/cpu.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_cpu_scs.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../driverlib/rom.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/gpio.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_gpio.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/timer.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/dma/UDMACC26XX.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/Power.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/utils/List.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/drivers/power/PowerCC26XX.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/udma.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/../inc/hw_udma.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/blestack/common/cc26xx/aoa/RFQueue.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/driverlib/rf_data_entry.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/display/Display.h: E:/ccs8.2/workspace/aoa_receiver_cc2640r2lp_app/Application/aoa_receiver.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/inc/hw_ccfg.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/inc/hw_fcfg1.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/inc/hw_rfc_rat.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/inc/hw_rfc_dbell.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/rf_patches/rf_patch_cpe_aoa_aod.h: E:/ti/simplelink_cc2640r2_sdk_2_30_00_28/source/ti/devices/cc26x0r2/rf_patches/rf_patch_mce_aoa_aod.h:
D
module toppkg.subpkg.x; interface AnInterface {}
D
/Users/yvonne.chen1/Documents/Main/-ACM/HackCamp-Spring/Hack-Spring-Session-4/demo-views/DerivedData/Session4-Part1/Build/Intermediates/Session4-Part1.build/Debug-iphonesimulator/Session4-Part1.build/Objects-normal/x86_64/ViewController.o : /Users/yvonne.chen1/Documents/Main/-ACM/HackCamp-Spring/Hack-Spring-Session-4/demo-views/Session4-Part1/ButtonViewController.swift /Users/yvonne.chen1/Documents/Main/-ACM/HackCamp-Spring/Hack-Spring-Session-4/demo-views/Session4-Part1/ViewController.swift /Users/yvonne.chen1/Documents/Main/-ACM/HackCamp-Spring/Hack-Spring-Session-4/demo-views/Session4-Part1/TableViewController.swift /Users/yvonne.chen1/Documents/Main/-ACM/HackCamp-Spring/Hack-Spring-Session-4/demo-views/Session4-Part1/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/yvonne.chen1/Documents/Main/-ACM/HackCamp-Spring/Hack-Spring-Session-4/demo-views/DerivedData/Session4-Part1/Build/Intermediates/Session4-Part1.build/Debug-iphonesimulator/Session4-Part1.build/Objects-normal/x86_64/ViewController~partial.swiftmodule : /Users/yvonne.chen1/Documents/Main/-ACM/HackCamp-Spring/Hack-Spring-Session-4/demo-views/Session4-Part1/ButtonViewController.swift /Users/yvonne.chen1/Documents/Main/-ACM/HackCamp-Spring/Hack-Spring-Session-4/demo-views/Session4-Part1/ViewController.swift /Users/yvonne.chen1/Documents/Main/-ACM/HackCamp-Spring/Hack-Spring-Session-4/demo-views/Session4-Part1/TableViewController.swift /Users/yvonne.chen1/Documents/Main/-ACM/HackCamp-Spring/Hack-Spring-Session-4/demo-views/Session4-Part1/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/yvonne.chen1/Documents/Main/-ACM/HackCamp-Spring/Hack-Spring-Session-4/demo-views/DerivedData/Session4-Part1/Build/Intermediates/Session4-Part1.build/Debug-iphonesimulator/Session4-Part1.build/Objects-normal/x86_64/ViewController~partial.swiftdoc : /Users/yvonne.chen1/Documents/Main/-ACM/HackCamp-Spring/Hack-Spring-Session-4/demo-views/Session4-Part1/ButtonViewController.swift /Users/yvonne.chen1/Documents/Main/-ACM/HackCamp-Spring/Hack-Spring-Session-4/demo-views/Session4-Part1/ViewController.swift /Users/yvonne.chen1/Documents/Main/-ACM/HackCamp-Spring/Hack-Spring-Session-4/demo-views/Session4-Part1/TableViewController.swift /Users/yvonne.chen1/Documents/Main/-ACM/HackCamp-Spring/Hack-Spring-Session-4/demo-views/Session4-Part1/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule
D
/** * Copyright: Copyright (c) 2011 Jacob Carlborg. All rights reserved. * Authors: Jacob Carlborg * Version: Initial created: Jan 29, 2012 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) */ module dstep.translator.objc.ObjcInterface; import mambo.core._; import clang.c.index; import clang.Cursor; import clang.Type; import clang.Util; import clang.Visitor; import dstep.translator.Translator; import dstep.translator.Declaration; import dstep.translator.Output; import dstep.translator.Type; class ObjcInterface (Data) : Declaration { this (Cursor cursor, Cursor parent, Translator translator) { super(cursor, parent, translator); } override string translate () { auto cursor = cursor.objc; return writeClass(spelling, cursor.superClass.spelling, collectInterfaces(cursor.objc), { foreach (cursor, parent ; cursor.declarations) { with (CXCursorKind) switch (cursor.kind) { case CXCursor_ObjCInstanceMethodDecl: translateMethod(cursor.func); break; case CXCursor_ObjCClassMethodDecl: translateMethod(cursor.func, true); break; case CXCursor_ObjCPropertyDecl: translateProperty(cursor); break; case CXCursor_ObjCIvarDecl: translateInstanceVariable(cursor); break; default: break; } } }); } protected string[] collectInterfaces (ObjcCursor cursor) { string[] interfaces; foreach (cursor , parent ; cursor.protocols) interfaces ~= translateIdentifier(cursor.spelling); return interfaces; } private: string writeClass (string name, string superClassName, string[] interfaces, void delegate () dg) { output.currentClass = new Data; output.currentClass.name = translateIdentifier(name); output.currentClass.interfaces = interfaces; if (superClassName.isPresent) output.currentClass.superclass ~= translateIdentifier(superClassName); dg(); return output.currentClass.data; } void translateMethod (FunctionCursor func, bool classMethod = false, string name = null) { auto method = output.newContext(); auto cls = output.currentClass; if (cls.propertyList.contains(func.spelling)) return; name = cls.getMethodName(func, name, false); if (isGetter(func, name)) translateGetter(func.resultType, method, name, cls, classMethod); else if (isSetter(func, name)) { auto param = func.parameters.first; name = toDSetterName(name); translateSetter(param.type, method, name, cls, classMethod, param.spelling); } else { name = translateIdentifier(name); translateFunction(func, name, method, classMethod); method ~= " ["; method ~= func.spelling; method ~= "];"; if (classMethod) cls.staticMethods ~= method.data; else cls.instanceMethods ~= method.data; } } void translateProperty (Cursor cursor) { auto context = output.newContext(); auto cls = output.currentClass; auto name = cls.getMethodName(cursor.func, "", false); translateGetter(cursor.type, context, name, cls, false); context = output.newContext(); translateSetter(cursor.type, context, name, cls, false); } void translateInstanceVariable (Cursor cursor) { auto var = output.newContext(); translator.variable(cursor, var); output.currentClass.instanceVariables ~= var.data; } void translateGetter (Type type, String context, string name, ClassData cls, bool classMethod) { auto dName = name == "class" ? name : translateIdentifier(name); context ~= "@property "; if (classMethod) context ~= "static "; context ~= translateType(type); context ~= " "; context ~= dName; context ~= " () "; context.put('[', name, "];"); auto data = context.data; if (classMethod) cls.staticProperties ~= data; else cls.properties ~= data; cls.propertyList.add(name); } void translateSetter (Type type, String context, string name, ClassData cls, bool classMethod, string parameterName = "") { auto selector = toObjcSetterName(name) ~ ':'; context ~= "@property "; if (classMethod) context ~= "static "; context ~= "void "; context ~= translateIdentifier(name); context ~= " ("; context ~= translateType(type); if (parameterName.any) { context ~= " "; context ~= parameterName; } context ~= ") ["; context ~= selector; context ~= "];"; auto data = context.data; if (classMethod) cls.staticProperties ~= data; else cls.properties ~= data; cls.propertyList.add(selector); } string toDSetterName (string name) { assert(isSetter(name)); name = name[3 .. $]; auto firstLetter = name[0 .. 1]; auto r = firstLetter.toLower ~ name[1 .. $]; return r.assumeUnique; } string toObjcSetterName (string name) { auto r = "set" ~ name[0 .. 1].toUpper ~ name[1 .. $]; return r.assumeUnique; } bool isGetter (FunctionCursor cursor, string name) { return cursor.resultType.kind != CXTypeKind.CXType_Void && cursor.parameters.isEmpty; } bool isSetter (string name) { if (name.length > 3 && name.startsWith("set")) { auto firstLetter = name[3 .. $].first; return firstLetter.isUpper; } return false; } bool isSetter (FunctionCursor cursor, string name) { return isSetter(name) && cursor.resultType.kind == CXTypeKind.CXType_Void && cursor.parameters.length == 1; } }
D
.hd lscmpk "compare linked string with contiguous string" 03/23/80 character function lscmpk (ptr, str) pointer ptr character str (ARB) .sp Library: vlslb .fs The linked string specified by 'ptr' and the contiguous string in 'str' are compared on the basis of ASCII collating sequence. Depending upon the relation that the first string has to the second, a function value of '>'c, '='c, or '<'c is returned. .im Characters are extracted from the linked string using 'lsgetc' and compared with their corresponding elements in 'str' until two unequal characters are seen or an EOS character is encountered. The value returned is then decided from these two characters: if one of the characters is EOS, the longer string is considered greater; if both of the characters are EOS, the strings are considered equal; if neither character is EOS, the string with the largest character is considered greater. .ca lsgetc .bu Locally supported. .sa lscomp (4)
D
/Users/lefukeji/Desktop/content/chartDemoForPro/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/ChartViewBase.o : /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartAxisBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/RadarChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/LineScatterCandleChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/CombinedHighlighter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartLimitLine.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/PieChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/LineChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartAxisRendererBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BarLineScatterCandleBubbleChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/CandleChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Formatters/ChartFillFormatter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/ScatterChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/ScatterChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/LineChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BarLineScatterCandleBubbleChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartYAxisRendererRadarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/ScatterChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/CombinedChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartXAxis.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Filters/ChartDataBaseFilter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Formatters/ChartXAxisValueFormatter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/LineChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/PieChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/RadarChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/BarChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartYAxis.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/RadarChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Animation/ChartAnimationEasing.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/HorizontalBarChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartXAxisRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/CandleChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartXAxisRendererHorizontalBarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartTransformer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartYAxisRendererHorizontalBarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/CandleChartDataEntry.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BarChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/HorizontalBarChartHighlighter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BarChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/RadarChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartLegendRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BubbleChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartTransformerHorizontalBarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartColorTemplates.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/CandleStickChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartSelectionDetail.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/ChartViewBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/PieChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/LineRadarChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartRendererBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/LineChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartXAxisRendererBarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ScatterChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/CandleStickChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Filters/ChartDataApproximatorFilter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/BarLineChartViewBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/PieChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/LineChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BubbleChartDataEntry.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartDataRendererBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartViewPortHandler.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/LineScatterCandleRadarChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/ChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/BubbleChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/BarChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartMarker.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/ChartDataEntry.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BubbleChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/ScatterChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/ChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/BarChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/CandleChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/ChartHighlighter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/ChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/BarChartHighlighter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartXAxisRendererRadarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/PieRadarChartViewBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Animation/ChartAnimator.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/BubbleChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/BubbleChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Formatters/ChartDefaultXAxisValueFormatter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartYAxisRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/CombinedChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartComponentBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BarChartDataEntry.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/CombinedChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartUtils.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/ChartHighlight.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartLegend.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/ChartRange.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/HorizontalBarChartView.swift /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Supporting\ Files/Charts.h /Users/lefukeji/Desktop/content/chartDemoForPro/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/lefukeji/Desktop/content/chartDemoForPro/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/ChartViewBase~partial.swiftmodule : /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartAxisBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/RadarChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/LineScatterCandleChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/CombinedHighlighter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartLimitLine.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/PieChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/LineChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartAxisRendererBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BarLineScatterCandleBubbleChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/CandleChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Formatters/ChartFillFormatter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/ScatterChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/ScatterChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/LineChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BarLineScatterCandleBubbleChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartYAxisRendererRadarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/ScatterChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/CombinedChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartXAxis.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Filters/ChartDataBaseFilter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Formatters/ChartXAxisValueFormatter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/LineChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/PieChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/RadarChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/BarChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartYAxis.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/RadarChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Animation/ChartAnimationEasing.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/HorizontalBarChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartXAxisRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/CandleChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartXAxisRendererHorizontalBarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartTransformer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartYAxisRendererHorizontalBarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/CandleChartDataEntry.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BarChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/HorizontalBarChartHighlighter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BarChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/RadarChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartLegendRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BubbleChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartTransformerHorizontalBarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartColorTemplates.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/CandleStickChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartSelectionDetail.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/ChartViewBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/PieChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/LineRadarChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartRendererBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/LineChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartXAxisRendererBarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ScatterChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/CandleStickChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Filters/ChartDataApproximatorFilter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/BarLineChartViewBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/PieChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/LineChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BubbleChartDataEntry.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartDataRendererBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartViewPortHandler.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/LineScatterCandleRadarChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/ChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/BubbleChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/BarChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartMarker.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/ChartDataEntry.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BubbleChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/ScatterChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/ChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/BarChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/CandleChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/ChartHighlighter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/ChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/BarChartHighlighter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartXAxisRendererRadarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/PieRadarChartViewBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Animation/ChartAnimator.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/BubbleChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/BubbleChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Formatters/ChartDefaultXAxisValueFormatter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartYAxisRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/CombinedChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartComponentBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BarChartDataEntry.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/CombinedChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartUtils.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/ChartHighlight.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartLegend.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/ChartRange.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/HorizontalBarChartView.swift /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Supporting\ Files/Charts.h /Users/lefukeji/Desktop/content/chartDemoForPro/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/lefukeji/Desktop/content/chartDemoForPro/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/ChartViewBase~partial.swiftdoc : /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartAxisBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/RadarChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/LineScatterCandleChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/CombinedHighlighter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartLimitLine.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/PieChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/LineChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartAxisRendererBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BarLineScatterCandleBubbleChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/CandleChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Formatters/ChartFillFormatter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/ScatterChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/ScatterChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/LineChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BarLineScatterCandleBubbleChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartYAxisRendererRadarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/ScatterChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/CombinedChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartXAxis.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Filters/ChartDataBaseFilter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Formatters/ChartXAxisValueFormatter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/LineChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/PieChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/RadarChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/BarChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartYAxis.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/RadarChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Animation/ChartAnimationEasing.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/HorizontalBarChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartXAxisRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/CandleChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartXAxisRendererHorizontalBarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartTransformer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartYAxisRendererHorizontalBarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/CandleChartDataEntry.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BarChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/HorizontalBarChartHighlighter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BarChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/RadarChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartLegendRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BubbleChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartTransformerHorizontalBarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartColorTemplates.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/CandleStickChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartSelectionDetail.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/ChartViewBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/PieChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/LineRadarChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartRendererBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/LineChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartXAxisRendererBarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ScatterChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/CandleStickChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Filters/ChartDataApproximatorFilter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/BarLineChartViewBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/PieChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/LineChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BubbleChartDataEntry.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartDataRendererBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartViewPortHandler.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/LineScatterCandleRadarChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/ChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/BubbleChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/BarChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartMarker.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/ChartDataEntry.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BubbleChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/ScatterChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/ChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Interfaces/BarChartDataProvider.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/CandleChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/ChartHighlighter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/ChartDataSet.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/BarChartHighlighter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartXAxisRendererRadarChart.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/PieRadarChartViewBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Animation/ChartAnimator.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/BubbleChartRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/BubbleChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Formatters/ChartDefaultXAxisValueFormatter.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Renderers/ChartYAxisRenderer.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/CombinedChartView.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartComponentBase.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/BarChartDataEntry.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Data/CombinedChartData.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Utils/ChartUtils.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/ChartHighlight.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Components/ChartLegend.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Highlight/ChartRange.swift /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Classes/Charts/HorizontalBarChartView.swift /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/lefukeji/Desktop/content/chartDemoForPro/Charts/Supporting\ Files/Charts.h /Users/lefukeji/Desktop/content/chartDemoForPro/Build/Intermediates/Charts.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode7.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule
D
/** * TypeInfo support code. * * Copyright: Copyright Digital Mars 2004 - 2009. * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. * Authors: Walter Bright */ /* Copyright Digital Mars 2004 - 2009. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) */ module rt.typeinfo.ti_Ashort; private import core.stdc.string; private import rt.util.hash; // short[] class TypeInfo_As : TypeInfo { @trusted: const: pure: nothrow: override string toString() const pure nothrow @safe { return "short[]"; } override hash_t getHash(in void* p) { short[] s = *cast(short[]*)p; return hashOf(s.ptr, s.length * short.sizeof); } override equals_t equals(in void* p1, in void* p2) { short[] s1 = *cast(short[]*)p1; short[] s2 = *cast(short[]*)p2; return s1.length == s2.length && memcmp(cast(void *)s1, cast(void *)s2, s1.length * short.sizeof) == 0; } override int compare(in void* p1, in void* p2) { short[] s1 = *cast(short[]*)p1; short[] s2 = *cast(short[]*)p2; size_t len = s1.length; if (s2.length < len) len = s2.length; for (size_t u = 0; u < len; u++) { int result = s1[u] - s2[u]; if (result) return result; } if (s1.length < s2.length) return -1; else if (s1.length > s2.length) return 1; return 0; } @property override size_t tsize() nothrow pure { return (short[]).sizeof; } @property override uint flags() nothrow pure { return 1; } @property override TypeInfo next() nothrow pure { return typeid(short); } @property override size_t talign() nothrow pure { return (short[]).alignof; } version (X86_64) override int argTypes(out TypeInfo arg1, out TypeInfo arg2) { arg1 = typeid(size_t); arg2 = typeid(void*); return 0; } } // ushort[] class TypeInfo_At : TypeInfo_As { @trusted: const: pure: nothrow: override string toString() const pure nothrow @safe { return "ushort[]"; } override int compare(in void* p1, in void* p2) { ushort[] s1 = *cast(ushort[]*)p1; ushort[] s2 = *cast(ushort[]*)p2; size_t len = s1.length; if (s2.length < len) len = s2.length; for (size_t u = 0; u < len; u++) { int result = s1[u] - s2[u]; if (result) return result; } if (s1.length < s2.length) return -1; else if (s1.length > s2.length) return 1; return 0; } @property override TypeInfo next() nothrow pure { return typeid(ushort); } } // wchar[] class TypeInfo_Au : TypeInfo_At { @trusted: const: pure: nothrow: override string toString() const pure nothrow @safe { return "wchar[]"; } @property override TypeInfo next() nothrow pure { return typeid(wchar); } }
D
/* * blockAllPlayerInput.d * * Block all player input with or without blocking the main menu as well. * * - Requires Ikarus, LeGo (HookEngine, >= 2.5.0), LeGo Cursor optional * - Compatible with Gothic 1 and Gothic 2 * - Resetting with unblockAllPlayerInput() in Init_Global recommended to restore player input on loading/new game! * * Blocking the main menu is not recommended and should only be done in highly controlled cases! * * * Main functions to use: * blockAllPlayerInput(int blockGameMenu) once to block all player input and keep it blocked. * unblockAllPlayerInput() once to unblock all again. * * Sub-functions (called from the functions above): * blockInGameMenus(int on) * blockMainMenu(int on) * blockHotkeys(int on) * blockControls(int on) * blockMouse(int on) */ /* * Block all in-game menus (status screen, log screen, map) */ func void blockInGameMenus(var int on) { const int set = 0; if (set == on) { return; }; const int oCGame__HandleEvent_G1 = 6680288; //0x65EEE0 const int oCGame__HandleEvent_G2 = 7324016; //0x6FC170 var int addr; addr = MEMINT_SwitchG1G2(oCGame__HandleEvent_G1, oCGame__HandleEvent_G2); if (on) { ReplaceEngineFuncF(addr, 1, Hook_ReturnFalse); } else { RemoveHookF(addr, 5, Hook_ReturnFalse); if (!IsHooked(addr)) { MEM_WriteInt(addr, MEMINT_SwitchG1G2(/*0xA164*/ 41316, /*0x8568FF6A*/ 2238250858)); }; }; set = on; }; /* * Block game menu (ESC key). This actually also disables the hot keys */ func void blockMainMenu(var int on) { const int set = 0; if (set == on) { return; }; const int cGameManager__HandleEvent_G1 = 4363200; //0x4293C0 const int cGameManager__HandleEvent_G2 = 4369744; //0x42AD50 var int addr; addr = MEMINT_SwitchG1G2(cGameManager__HandleEvent_G1, cGameManager__HandleEvent_G2); if (on) { ReplaceEngineFuncF(addr, 1, Hook_ReturnFalse); } else { RemoveHookF(addr, 5, Hook_ReturnFalse); if (!IsHooked(addr)) { MEM_WriteInt(addr, MEMINT_SwitchG1G2(/*0xD98B5351*/ 3649786705, /*0xA164*/ 41316)); }; }; set = on; }; /* * Disable hot keys */ func void blockHotkeys(var int on) { const int set = 0; if (set == on) { return; }; const int cGameManager__HandleEvent_quickload_G1 = 4363453; //0x4294BD const int cGameManager__HandleEvent_quicksave_G1 = 4363312; //0x429430 const int oCGame__s_bUsePotionKeys_G2 = 9118156; //0x8B21CC const int oCGame__s_bUseQuickSave_G2 = 9118160; //0x8B21D0 const int cGameManager__HandleEvent_F9keyJZ_G2 = 4369832; //0x42ADA8 const int enabled_G2 = 0; if (on) { if (GOTHIC_BASE_VERSION == 1) { // Disable quick saving MemoryProtectionOverride(cGameManager__HandleEvent_quicksave_G1, 1); MEM_WriteByte(cGameManager__HandleEvent_quicksave_G1, /*EB short jmp*/ 235); // Disable quick loading MemoryProtectionOverride(cGameManager__HandleEvent_quickload_G1, 1); MEM_WriteByte(cGameManager__HandleEvent_quickload_G1, /*EB short jmp*/ 235); } else { // Back up if they were enabled beforehand enabled_G2 = enabled_G2 | (MEM_ReadInt(oCGame__s_bUsePotionKeys_G2) << 0); enabled_G2 = enabled_G2 | (MEM_ReadInt(oCGame__s_bUseQuickSave_G2) << 1); // Disabled them MEM_WriteInt(oCGame__s_bUsePotionKeys_G2, 0); MEM_WriteInt(oCGame__s_bUseQuickSave_G2, 0); // Quick loading is always possible due to a logic mistake in the engine MemoryProtectionOverride(cGameManager__HandleEvent_F9keyJZ_G2, 4); MEM_WriteInt(cGameManager__HandleEvent_F9keyJZ_G2, 995); // jump beyond broken logic: 4370831-(4369830+6) }; } else { if (GOTHIC_BASE_VERSION == 1) { MEM_WriteByte(cGameManager__HandleEvent_quicksave_G1, /*74 short jz*/ 116); MEM_WriteByte(cGameManager__HandleEvent_quickload_G1, /*74 short jz*/ 116); } else { // Re-enabled if they were enabled beforehand MEM_WriteInt(oCGame__s_bUsePotionKeys_G2, (enabled_G2 & 1)); MEM_WriteInt(oCGame__s_bUseQuickSave_G2, (enabled_G2 >> 1)); // Re-instate original, broken logic MEM_WriteInt(cGameManager__HandleEvent_F9keyJZ_G2, 237); //ED 00 00 00 }; }; set = on; }; /* * Remove player control (essentially turns the hero AI into an NPC AI) */ func void blockControls(var int on) { const int set = 0; if (set == on) { return; }; const int oCAIHuman__DoAI_player_G1 = 6381143; //0x615E57 const int oCAIHuman__DoAI_player_G2 = 6930571; //0x69C08B const int oCNpc__CanDrawWeapon_G1 = 7647728; //0x74B1F0 const int oCNpc__CanDrawWeapon_G2 = 6817216; //0x6805C0 var int doAIplayerAddr; doAIplayerAddr = MEMINT_SwitchG1G2(oCAIHuman__DoAI_player_G1, oCAIHuman__DoAI_player_G2); var int canDrawWeaponAddr; canDrawWeaponAddr = MEMINT_SwitchG1G2(oCNpc__CanDrawWeapon_G1, oCNpc__CanDrawWeapon_G2); if (on) { // Detach player AI MemoryProtectionOverride(doAIplayerAddr, 5); MEM_WriteByte(doAIplayerAddr, MEMINT_SwitchG1G2(/*EB short jmp*/ 235, /*long jmp*/ ASMINT_OP_jmp)); if (GOTHIC_BASE_VERSION == 2) { MEM_WriteInt(doAIplayerAddr+1, 432); // Jump to 0x69C240: 6931008-6930571-5 }; // Block combat keys (1-0) ReplaceEngineFuncF(canDrawWeaponAddr, 0, Hook_ReturnFalse); } else { // Restore player AI MEM_WriteByte(doAIplayerAddr, MEMINT_SwitchG1G2(/*75 jnz*/ 117, /*0F jne*/ 15)); if (GOTHIC_BASE_VERSION == 2) { MEM_WriteInt(doAIplayerAddr+1, 110469); //0x01AF85 }; // Re-instate combat keys (1-0) RemoveHookF(canDrawWeaponAddr, 5, Hook_ReturnFalse); if (!IsHooked(canDrawWeaponAddr)) { MEM_WriteInt(canDrawWeaponAddr, /*0xE8F18B56*/ -386823338); }; }; set = on; }; /* * Backup mouse enable state and then disable it (requires LeGo_Cursor) */ func void blockMouse(var int on) { Cursor_NoEngine = on; }; /* * Block all player input with or without blocking the game menu (not recommended) */ func void blockAllPlayerInput(var int blockGameMenu) { MEM_SendToSpy(zERR_TYPE_WARN, "Blocking all player input"); blockInGameMenus(1); blockHotkeys(1); blockControls(1); //blockMouse(1); if (blockGameMenu) { // Kenny Loggins was here in 1986 blockMainMenu(1); }; }; /* * Re-enable all player input */ func void unblockAllPlayerInput() { MEM_SendToSpy(zERR_TYPE_WARN, "Unblocking all player input"); blockInGameMenus(0); blockHotkeys(0); blockControls(0); //blockMouse(0); blockMainMenu(0); };
D
/Users/vladyslavfil/iOS_Learning/Piscine_Swift_iOS/D00/build/calculator.build/Debug-iphonesimulator/calculator.build/Objects-normal/x86_64/ViewController.o : /Users/vladyslavfil/iOS_Learning/Piscine_Swift_iOS/D00/calculator/AppDelegate.swift /Users/vladyslavfil/iOS_Learning/Piscine_Swift_iOS/D00/calculator/ViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/vladyslavfil/iOS_Learning/Piscine_Swift_iOS/D00/build/calculator.build/Debug-iphonesimulator/calculator.build/Objects-normal/x86_64/ViewController~partial.swiftmodule : /Users/vladyslavfil/iOS_Learning/Piscine_Swift_iOS/D00/calculator/AppDelegate.swift /Users/vladyslavfil/iOS_Learning/Piscine_Swift_iOS/D00/calculator/ViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/vladyslavfil/iOS_Learning/Piscine_Swift_iOS/D00/build/calculator.build/Debug-iphonesimulator/calculator.build/Objects-normal/x86_64/ViewController~partial.swiftdoc : /Users/vladyslavfil/iOS_Learning/Piscine_Swift_iOS/D00/calculator/AppDelegate.swift /Users/vladyslavfil/iOS_Learning/Piscine_Swift_iOS/D00/calculator/ViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
/Users/yinheng/Desktop/code/node/rs/hello/target/debug/deps/hello-74de8f15a60b4e96: src/main.rs /Users/yinheng/Desktop/code/node/rs/hello/target/debug/deps/hello-74de8f15a60b4e96.d: src/main.rs src/main.rs:
D
/Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SQLite.swift.build/Objects-normal/x86_64/Statement.o : /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Extensions/FTS4.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Extensions/FTS5.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Schema.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Core/Blob.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Extensions/RTree.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Core/Value.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Coding.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Expression.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Foundation.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Collation.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Core/Connection.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Setter.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/DateAndTimeFunctions.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/CoreFunctions.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/AggregateFunctions.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/CustomFunctions.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Helpers.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Core/Errors.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Operators.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Core/Statement.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Query.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/sunchuyue/Documents/test/RX_Product/Pods/Target\ Support\ Files/SQLite.swift/SQLite.swift-umbrella.h /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/SQLite.h /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLiteObjc/include/SQLite-Bridging.h /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SQLite.swift.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SQLite.swift.build/Objects-normal/x86_64/Statement~partial.swiftmodule : /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Extensions/FTS4.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Extensions/FTS5.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Schema.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Core/Blob.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Extensions/RTree.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Core/Value.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Coding.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Expression.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Foundation.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Collation.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Core/Connection.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Setter.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/DateAndTimeFunctions.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/CoreFunctions.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/AggregateFunctions.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/CustomFunctions.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Helpers.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Core/Errors.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Operators.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Core/Statement.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Query.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/sunchuyue/Documents/test/RX_Product/Pods/Target\ Support\ Files/SQLite.swift/SQLite.swift-umbrella.h /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/SQLite.h /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLiteObjc/include/SQLite-Bridging.h /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SQLite.swift.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SQLite.swift.build/Objects-normal/x86_64/Statement~partial.swiftdoc : /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Extensions/FTS4.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Extensions/FTS5.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Schema.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Core/Blob.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Extensions/RTree.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Core/Value.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Coding.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Expression.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Foundation.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Collation.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Core/Connection.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Setter.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/DateAndTimeFunctions.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/CoreFunctions.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/AggregateFunctions.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/CustomFunctions.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Helpers.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Core/Errors.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Operators.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Core/Statement.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/Typed/Query.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/sunchuyue/Documents/test/RX_Product/Pods/Target\ Support\ Files/SQLite.swift/SQLite.swift-umbrella.h /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLite/SQLite.h /Users/sunchuyue/Documents/test/RX_Product/Pods/SQLite.swift/Sources/SQLiteObjc/include/SQLite-Bridging.h /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SQLite.swift.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
//Written in the D programming language /++ Module containing Date/Time functionality. This module provides: $(UL $(LI Types to represent points in time: $(D SysTime), $(D Date), $(D TimeOfDay), and $(D DateTime).) $(LI Types to represent intervals of time.) $(LI Types to represent ranges over intervals of time.) $(LI Types to represent time zones (used by $(D SysTime)).) $(LI A platform-independent, high precision stopwatch type: $(D StopWatch)) $(LI Benchmarking functions.) $(LI Various helper functions.) ) Closely related to std.datetime is <a href="core_time.html">$(D core.time)</a>, and some of the time types used in std.datetime come from there - such as $(CXREF time, Duration), $(CXREF time, TickDuration), and $(CXREF time, FracSec). core.time is publically imported into std.datetime, it isn't necessary to import it separately. Three of the main concepts used in this module are time points, time durations, and time intervals. A time point is a specific point in time. e.g. January 5th, 2010 or 5:00. A time duration is a length of time with units. e.g. 5 days or 231 seconds. A time interval indicates a period of time associated with a fixed point in time. It is either two time points associated with each other, indicating the time starting at the first point up to, but not including, the second point - e.g. [January 5th, 2010 - March 10th, 2010$(RPAREN) - or it is a time point and a time duration associated with one another. e.g. January 5th, 2010 and 5 days, indicating [January 5th, 2010 - January 10th, 2010$(RPAREN). Various arithmetic operations are supported between time points and durations (e.g. the difference between two time points is a time duration), and ranges can be gotten from time intervals, so range-based operations may be done on a series of time points. The types that the typical user is most likely to be interested in are $(D Date) (if they want dates but don't care about time), $(D DateTime) (if they want dates and times but don't care about time zones), $(D SysTime) (if they want the date and time from the OS and/or do care about time zones), and StopWatch (a platform-independent, high precision stop watch). $(D Date) and $(D DateTime) are optimized for calendar-based operations, while $(D SysTime) is designed for dealing with time from the OS. Check out their specific documentation for more details. To get the current time, use $(D Clock.currTime). It will return the current time as a $(D SysTime). To print it, $(D toString) is sufficient, but if using $(D toISOString), $(D toISOExtString), or $(D toSimpleString), use the corresponding $(D fromISOString), $(D fromISOExtString), or $(D fromISOExtString) to create a $(D SysTime) from the string. -------------------- auto currentTime = Clock.currTime(); auto timeString = currentTime.toISOExtString(); auto restoredTime = SysTime.fromISOExtString(timeString); -------------------- Various functions take a string (or strings) to represent a unit of time (e.g. $(D convert!("days", "hours")(numDays))). The valid strings to use with such functions are $(D "years"), $(D "months"), $(D "weeks"), $(D "days"), $(D "hours"), $(D "minutes"), $(D "seconds"), $(D "msecs") (milliseconds), $(D "usecs") (microseconds), $(D "hnsecs") (hecto-nanoseconds - i.e. 100 ns), or some subset thereof. There are a few functions in core.time which take $(D "nsecs"), but because nothing in std.datetime has precision greater than hnsecs, and very little in core.time does, no functions in std.datetime accept $(D "nsecs"). To remember which units are abbreviated and which aren't, all units seconds and greater use their full names, and all sub-second units are abbreviated (since they'd be rather long if they weren't). Note: $(D DateTimeException) is an alias for core.time's $(D TimeException), so you don't need to worry about core.time functions and std.datetime functions throwing different exception types (except in the rare case that they throw something other than $(D TimeException) or $(D DateTimeException)). See_Also: <a href="../intro-to-datetime.html">Introduction to std&#46;_datetime </a><br> $(WEB en.wikipedia.org/wiki/ISO_8601, ISO 8601)<br> $(WEB en.wikipedia.org/wiki/Tz_database, Wikipedia entry on TZ Database)<br> $(WEB en.wikipedia.org/wiki/List_of_tz_database_time_zones, List of Time Zones)<br> Copyright: Copyright 2010 - 2011 License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). Authors: Jonathan M Davis and Kato Shoichi Source: $(PHOBOSSRC std/_datetime.d) +/ module std.datetime; public import core.time; import core.exception; import core.stdc.time; import std.array; import std.algorithm; import std.ascii; import std.conv; import std.exception; import std.file; import std.functional; import std.math; import std.metastrings; import std.path; import std.range; import std.stdio; import std.string; import std.system; import std.traits; import std.typecons; import std.utf; version(Windows) { import core.sys.windows.windows; import std.c.windows.winsock; import std.windows.registry; } else version(Posix) { import core.sys.posix.arpa.inet; import core.sys.posix.stdlib; import core.sys.posix.time; import core.sys.posix.sys.time; } //Comment this out to disable std.datetime's unit tests. version = testStdDateTime; version(unittest) { import std.c.string; import std.stdio; } //I'd just alias it to indexOf, but //http://d.puremagic.com/issues/show_bug.cgi?id=6013 would mean that that would //pollute the global namespace. So, for now, I've created an alias which is //highly unlikely to conflict with anything that anyone else is doing. private alias std.string.indexOf stds_indexOf; version(testStdDateTime) unittest { initializeTests(); } //Verify module example. version(testStdDateTime) unittest { auto currentTime = Clock.currTime(); auto timeString = currentTime.toISOExtString(); auto restoredTime = SysTime.fromISOExtString(timeString); } //Verify Examples for core.time.Duration which couldn't be in core.time. version(testStdDateTime) unittest { assert(std.datetime.Date(2010, 9, 7) + dur!"days"(5) == std.datetime.Date(2010, 9, 12)); assert(std.datetime.Date(2010, 9, 7) - std.datetime.Date(2010, 10, 3) == dur!"days"(-26)); } //Note: There various functions which void as their return type and ref of the // struct type which they're in as a commented out return type. Ideally, // they would return the ref, but there are several dmd bugs which prevent // that, relating to both ref and invariants. So, I've left the ref return // types commented out with the idea that those functions can be made to // return a ref to this once those bugs have been fixed. //============================================================================== // Section with public enums and constants. //============================================================================== /++ Represents the 12 months of the Gregorian year (January is 1). +/ enum Month : ubyte { jan = 1, /// feb, /// mar, /// apr, /// may, /// jun, /// jul, /// aug, /// sep, /// oct, /// nov, /// dec /// } /++ Represents the 7 days of the Gregorian week (Sunday is 0). +/ enum DayOfWeek : ubyte { sun = 0, /// mon, /// tue, /// wed, /// thu, /// fri, /// sat /// } /++ In some date calculations, adding months or years can cause the date to fall on a day of the month which is not valid (e.g. February 29th 2001 or June 31st 2000). If overflow is allowed (as is the default), then the month will be incremented accordingly (so, February 29th 2001 would become March 1st 2001, and June 31st 2000 would become July 1st 2000). If overflow is not allowed, then the day will be adjusted to the last valid day in that month (so, February 29th 2001 would become February 28th 2001 and June 31st 2000 would become June 30th 2000). AllowDayOverflow only applies to calculations involving months or years. +/ enum AllowDayOverflow { /// No, don't allow day overflow. no, /// Yes, allow day overflow. yes } /++ Indicates a direction in time. One example of its use is $(D Interval)'s $(D expand) function which uses it to indicate whether the interval should be expanded backwards (into the past), forwards (into the future), or both. +/ enum Direction { /// Backward. bwd, /// Forward. fwd, /// Both backward and forward. both } /++ Used to indicate whether $(D popFront) should be called immediately upon creating a range. The idea is that for some functions used to generate a range for an interval, $(D front) is not necessarily a time point which would ever be generated by the range. To get the first time point in the range to match what the function generates, then use $(D PopFirst.yes) to indicate that the range should have $(D popFront) called on it before the range is returned so that $(D front) is a time point which the function would generate. For instance, if the function used to generate a range of time points generated successive Easters (i.e. you're iterating over all of the Easters within the interval), the initial date probably isn't an Easter. Using $(D PopFirst.yes) would tell the function which returned the range that $(D popFront) was to be called so that front would then be an Easter - the next one generated by the function (which when iterating forward would be the Easter following the original $(D front), while when iterating backward, it would be the Easter prior to the original $(D front)). If $(D PopFirst.no) were used, then $(D front) would remain the original time point and it would not necessarily be a time point which would be generated by the range-generating function (which in many cases is exactly what is desired - e.g. if iterating over every day starting at the beginning of the interval). +/ enum PopFirst { /// No, don't call popFront() before returning the range. no, /// Yes, call popFront() before returning the range. yes } /++ Used by StopWatch to indicate whether it should start immediately upon construction. +/ enum AutoStart { /// No, don't start the StopWatch when it is constructed. no, /// Yes, do start the StopWatch when it is constructed. yes } /++ Array of the strings representing time units, starting with the smallest unit and going to the largest. It does not include $(D "nsecs"). Includes $(D "hnsecs") (hecto-nanoseconds (100 ns)), $(D "usecs") (microseconds), $(D "msecs") (milliseconds), $(D "seconds"), $(D "minutes"), $(D "hours"), $(D "days"), $(D "weeks"), $(D "months"), and $(D "years") +/ immutable string[] timeStrings = ["hnsecs", "usecs", "msecs", "seconds", "minutes", "hours", "days", "weeks", "months", "years"]; //============================================================================== // Section with private constants. //============================================================================== /++ Array of integers representing the last days of each month in a year. +/ private immutable int[13] lastDayNonLeap = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365]; /++ Array of integers representing the last days of each month in a leap year. +/ private immutable int[13] lastDayLeap = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366]; /++ Array of the long names of each month. +/ private immutable string[12] longMonthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; /++ Array of the short (three letter) names of each month. +/ private immutable string[12] shortMonthNames = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ]; //============================================================================== // Section with other types. //============================================================================== /++ Exception type used by std.datetime. It's an alias to TimeException, which is what core.time uses. Either can be caught without concern about which module it came from. +/ alias TimeException DateTimeException; /++ Effectively a namespace to make it clear that the methods it contains are getting the time from the system clock. It cannot be instantiated. +/ final class Clock { public: /++ Returns the current time in the given time zone. Throws: $(D ErrnoException) (on Posix) or $(D Exception) (on Windows) if it fails to get the time of day. +/ static SysTime currTime(immutable TimeZone tz = LocalTime()) { return SysTime(currStdTime, tz); } version(testStdDateTime) unittest { assert(currTime(UTC()).timezone is UTC()); //I have no idea why, but for some reason, Windows/Wine likes to get //time_t wrong when getting it with core.stdc.time.time. On one box //I have (which has its local time set to UTC), it always gives time_t //in the real local time (America/Los_Angeles), and after the most recent //DST switch, every Windows box that I've tried it in is reporting //time_t as being 1 hour off of where it's supposed to be. So, I really //don't know what the deal is, but given what I'm seeing, I don't trust //core.stdc.time.time on Windows, so I'm just going to disable this test //on Windows. version(Posix) { immutable unixTimeD = currTime().toUnixTime(); immutable unixTimeC = core.stdc.time.time(null); immutable diff = unixTimeC - unixTimeD; _assertPred!">="(diff, -2); _assertPred!"<="(diff, 2); } } /++ Returns the number of hnsecs since midnight, January 1st, 1 A.D. for the current time. Throws: $(D DateTimeException) if it fails to get the time. +/ @trusted static @property long currStdTime() { version(Windows) { FILETIME fileTime; GetSystemTimeAsFileTime(&fileTime); return FILETIMEToStdTime(&fileTime); } else version(Posix) { enum hnsecsToUnixEpoch = 621_355_968_000_000_000L; static if(is(typeof(clock_gettime))) { timespec ts; if(clock_gettime(CLOCK_REALTIME, &ts) != 0) throw new TimeException("Failed in clock_gettime()."); return convert!("seconds", "hnsecs")(ts.tv_sec) + ts.tv_nsec / 100 + hnsecsToUnixEpoch; } else { timeval tv; if(gettimeofday(&tv, null) != 0) throw new TimeException("Failed in gettimeofday()."); return convert!("seconds", "hnsecs")(tv.tv_sec) + convert!("usecs", "hnsecs")(tv.tv_usec) + hnsecsToUnixEpoch; } } } /++ The current system tick. The number of ticks per second varies from system to system. currSystemTick uses a monotonic clock, so it's intended for precision timing by comparing relative time values, not for getting the current system time. Warning: On some systems, the monotonic clock may stop counting when the computer goes to sleep or hibernates. So, the monotonic clock could be off if that occurs. This is known to happen on Mac OS X. It has not been tested whether it occurs on either Windows or Linux. Throws: $(D DateTimeException) if it fails to get the time. +/ @safe static @property TickDuration currSystemTick() { return TickDuration.currSystemTick; } version(testStdDateTime) unittest { assert(Clock.currSystemTick.length > 0); } /++ The current number of system ticks since the application started. The number of ticks per second varies from system to system. This uses a monotonic clock. Warning: On some systems, the monotonic clock may stop counting when the computer goes to sleep or hibernates. So, the monotonic clock could be off if that occurs. This is known to happen on Mac OS X. It has not been tested whether it occurs on either Windows or on Linux. Throws: $(D DateTimeException) if it fails to get the time. +/ @safe static @property TickDuration currAppTick() { return currSystemTick - TickDuration.appOrigin; } version(testStdDateTime) unittest { auto a = Clock.currSystemTick; auto b = Clock.currAppTick; assert(a.length); assert(b.length); assert(a > b); } private: @disable this() {} } //============================================================================== // Section with time points. //============================================================================== /++ $(D SysTime) is the type used to get the current time from the system or doing anything that involves time zones. Unlike $(D DateTime), the time zone is an integral part of $(D SysTime) (though for local time applications, time zones can be ignored and it will work, since it defaults to using the local time zone). It holds its internal time in std time (hnsecs since midnight, January 1st, 1 A.D. UTC), so it interfaces well with the system time. However, that means that, unlike $(D DateTime), it is not optimized for calendar-based operations, and getting individual units from it such as years or days is going to involve conversions and be less efficient. For calendar-based operations that don't care about time zones, then $(D DateTime) would be the type to use. For system time, use $(D SysTime). $(D Clock.currTime) will return the current time as a $(D SysTime). To convert a $(D SysTime) to a $(D Date) or $(D DateTime), simply cast it. To convert a $(D Date) or $(D DateTime) to a $(D SysTime), use $(D SysTime)'s constructor, and pass in the intended time zone with it (or don't pass in a $(D TimeZone), and the local time zone will be used). Be aware, however, that converting from a $(D DateTime) to a $(D SysTime) will not necessarily be 100% accurate due to DST (one hour of the year doesn't exist and another occurs twice). To not risk any conversion errors, keep times as $(D SysTime)s. Aside from DST though, there shouldn't be any conversion problems. For using time zones other than local time or UTC, use $(D PosixTimeZone) on Posix systems (or on Windows, if providing the TZ Database files), and use $(D WindowsTimeZone) on Windows systems. The time in $(D SysTime) is kept internally in hnsecs from midnight, January 1st, 1 A.D. UTC. Conversion error cannot happen when changing the time zone of a $(D SysTime). $(D LocalTime) is the $(D TimeZone) class which represents the local time, and $(D UTC) is the $(D TimeZone) class which represents UTC. $(D SysTime) uses $(D LocalTime) if no $(D TimeZone) is provided. For more details on time zones, see the documentation for $(D TimeZone), $(D PosixTimeZone), and $(D WindowsTimeZone). $(D SysTime)'s range is from approximately 29,000 B.C. to approximately 29,000 A.D. +/ struct SysTime { public: /++ Params: dateTime = The $(D DateTime) to use to set this $(D SysTime)'s internal std time. As $(D DateTime) has no concept of time zone, tz is used as its time zone. tz = The $(D TimeZone) to use for this $(D SysTime). If null, $(D LocalTime) will be used. The given $(D DateTime) is assumed to be in the given time zone. +/ this(in DateTime dateTime, immutable TimeZone tz = null) nothrow { try this(dateTime, FracSec.from!"hnsecs"(0), tz); catch(Exception e) assert(0, "FracSec's constructor threw when it shouldn't have."); } version(testStdDateTime) unittest { static void test(DateTime dt, immutable TimeZone tz, long expected) { auto sysTime = SysTime(dt, tz); _assertPred!"=="(sysTime._stdTime, expected); assert(sysTime._timezone is (tz is null ? LocalTime() : tz), format("Given DateTime: %s", dt)); } test(DateTime.init, UTC(), 0); test(DateTime(1, 1, 1, 12, 30, 33), UTC(), 450_330_000_000L); test(DateTime(0, 12, 31, 12, 30, 33), UTC(), -413_670_000_000L); test(DateTime(1, 1, 1, 0, 0, 0), UTC(), 0); test(DateTime(1, 1, 1, 0, 0, 1), UTC(), 10_000_000L); test(DateTime(0, 12, 31, 23, 59, 59), UTC(), -10_000_000L); test(DateTime(1, 1, 1, 0, 0, 0), new SimpleTimeZone(dur!"minutes"(-60)), 36_000_000_000L); test(DateTime(1, 1, 1, 0, 0, 0), new SimpleTimeZone(Duration.zero), 0); test(DateTime(1, 1, 1, 0, 0, 0), new SimpleTimeZone(dur!"minutes"(60)), -36_000_000_000L); } /++ Params: dateTime = The $(D DateTime) to use to set this $(D SysTime)'s internal std time. As $(D DateTime) has no concept of time zone, tz is used as its time zone. fracSec = The fractional seconds portion of the time. tz = The $(D TimeZone) to use for this $(D SysTime). If null, $(D LocalTime) will be used. The given $(D DateTime) is assumed to be in the given time zone. Throws: $(D DateTimeException) if $(D fracSec) is negative. +/ this(in DateTime dateTime, in FracSec fracSec, immutable TimeZone tz = null) { immutable fracHNSecs = fracSec.hnsecs; enforce(fracHNSecs >= 0, new DateTimeException("A SysTime cannot have negative fractional seconds.")); _timezone = tz is null ? LocalTime() : tz; try { immutable dateDiff = (dateTime.date - Date(1, 1, 1)).total!"hnsecs"; immutable todDiff = (dateTime.timeOfDay - TimeOfDay(0, 0, 0)).total!"hnsecs"; immutable adjustedTime = dateDiff + todDiff + fracHNSecs; immutable standardTime = _timezone.tzToUTC(adjustedTime); this(standardTime, _timezone); } catch(Exception e) { assert(0, "Date, TimeOfDay, or DateTime's constructor threw when " ~ "it shouldn't have."); } } version(testStdDateTime) unittest { static void test(DateTime dt, FracSec fracSec, immutable TimeZone tz, long expected) { auto sysTime = SysTime(dt, fracSec, tz); _assertPred!"=="(sysTime._stdTime, expected); assert(sysTime._timezone is (tz is null ? LocalTime() : tz), format("Given DateTime: %s, Given FracSec: %s", dt, fracSec)); } test(DateTime.init, FracSec.init, UTC(), 0); test(DateTime(1, 1, 1, 12, 30, 33), FracSec.init, UTC(), 450_330_000_000L); test(DateTime(0, 12, 31, 12, 30, 33), FracSec.init, UTC(), -413_670_000_000L); test(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"msecs"(1), UTC(), 10_000L); test(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"msecs"(999), UTC(), -10_000L); test(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999), UTC(), -1); test(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(1), UTC(), -9_999_999); test(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(0), UTC(), -10_000_000); assertThrown!DateTimeException(SysTime(DateTime.init, FracSec.from!"hnsecs"(-1), UTC())); } /++ Params: date = The $(D Date) to use to set this $(D SysTime)'s internal std time. As $(D Date) has no concept of time zone, tz is used as its time zone. tz = The $(D TimeZone) to use for this $(D SysTime). If null, $(D LocalTime) will be used. The given $(D Date) is assumed to be in the given time zone. +/ this(in Date date, immutable TimeZone tz = null) nothrow { _timezone = tz is null ? LocalTime() : tz; try { immutable adjustedTime = (date - Date(1, 1, 1)).total!"hnsecs"; immutable standardTime = _timezone.tzToUTC(adjustedTime); this(standardTime, _timezone); } catch(Exception e) assert(0, "Date's constructor through when it shouldn't have."); } version(testStdDateTime) unittest { static void test(Date d, immutable TimeZone tz, long expected) { auto sysTime = SysTime(d, tz); _assertPred!"=="(sysTime._stdTime, expected); assert(sysTime._timezone is (tz is null ? LocalTime() : tz), format("Given Date: %s", d)); } test(Date.init, UTC(), 0); test(Date(1, 1, 1), UTC(), 0); test(Date(1, 1, 2), UTC(), 864000000000); test(Date(0, 12, 31), UTC(), -864000000000); } /++ Note: Whereas the other constructors take in the given date/time, assume that it's in the given time zone, and convert it to hnsecs in UTC since midnight, January 1st, 1 A.D. UTC - i.e. std time - this constructor takes a std time, which is specifically already in UTC, so no conversion takes place. Of course, the various getter properties and functions will use the given time zone's conversion function to convert the results to that time zone, but no conversion of the arguments to this constructor takes place. Params: stdTime = The number of hnsecs since midnight, January 1st, 1 A.D. UTC. tz = The $(D TimeZone) to use for this $(D SysTime). If null, $(D LocalTime) will be used. +/ this(long stdTime, immutable TimeZone tz = null) pure nothrow { _stdTime = stdTime; _timezone = tz is null ? LocalTime() : tz; } version(testStdDateTime) unittest { static void test(long stdTime, immutable TimeZone tz) { auto sysTime = SysTime(stdTime, tz); _assertPred!"=="(sysTime._stdTime, stdTime); assert(sysTime._timezone is (tz is null ? LocalTime() : tz), format("Given stdTime: %s", stdTime)); } foreach(stdTime; [-1234567890L, -250, 0, 250, 1235657390L]) { foreach(tz; testTZs) test(stdTime, tz); } } /++ Params: rhs = The $(D SysTime) to assign to this one. +/ ref SysTime opAssign(const ref SysTime rhs) pure nothrow { _stdTime = rhs._stdTime; _timezone = rhs._timezone; return this; } /++ Params: rhs = The $(D SysTime) to assign to this one. +/ ref SysTime opAssign(SysTime rhs) pure nothrow { _stdTime = rhs._stdTime; _timezone = rhs._timezone; return this; } /++ Checks for equality between this $(D SysTime) and the given $(D SysTime). Note that the time zone is ignored. Only the internal std times (which are in UTC) are compared. +/ bool opEquals(const SysTime rhs) const pure nothrow { return opEquals(rhs); } /// ditto bool opEquals(const ref SysTime rhs) const pure nothrow { return _stdTime == rhs._stdTime; } version(testStdDateTime) unittest { _assertPred!"=="(SysTime(DateTime.init, UTC()), SysTime(0, UTC())); _assertPred!"=="(SysTime(DateTime.init, UTC()), SysTime(0)); _assertPred!"=="(SysTime(Date.init, UTC()), SysTime(0)); _assertPred!"=="(SysTime(0), SysTime(0)); static void test(DateTime dt, immutable TimeZone tz1, immutable TimeZone tz2) { auto st1 = SysTime(dt); st1.timezone = tz1; auto st2 = SysTime(dt); st2.timezone = tz2; _assertPred!"=="(st1, st2); } foreach(tz1; testTZs) { foreach(tz2; testTZs) { foreach(dt; chain(testDateTimesBC, testDateTimesAD)) test(dt, tz1, tz2); } } auto st = SysTime(DateTime(1999, 7, 6, 12, 33, 30)); const cst = SysTime(DateTime(1999, 7, 6, 12, 33, 30)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 33, 30)); static assert(__traits(compiles, st == st)); static assert(__traits(compiles, st == cst)); //static assert(__traits(compiles, st == ist)); static assert(__traits(compiles, cst == st)); static assert(__traits(compiles, cst == cst)); //static assert(__traits(compiles, cst == ist)); //static assert(__traits(compiles, ist == st)); //static assert(__traits(compiles, ist == cst)); //static assert(__traits(compiles, ist == ist)); } /++ Compares this $(D SysTime) with the given $(D SysTime). Time zone is irrelevant when comparing $(D SysTime)s. Returns: $(BOOKTABLE, $(TR $(TD this &lt; rhs) $(TD &lt; 0)) $(TR $(TD this == rhs) $(TD 0)) $(TR $(TD this &gt; rhs) $(TD &gt; 0)) ) +/ int opCmp(in SysTime rhs) const pure nothrow { if(_stdTime < rhs._stdTime) return -1; if(_stdTime > rhs._stdTime) return 1; return 0; } version(testStdDateTime) unittest { _assertPred!("opCmp", "==")(SysTime(DateTime.init, UTC()), SysTime(0, UTC())); _assertPred!("opCmp", "==")(SysTime(DateTime.init, UTC()), SysTime(0)); _assertPred!("opCmp", "==")(SysTime(Date.init, UTC()), SysTime(0)); _assertPred!("opCmp", "==")(SysTime(0), SysTime(0)); static void testEqual(SysTime st, immutable TimeZone tz1, immutable TimeZone tz2) { auto st1 = st; st1.timezone = tz1; auto st2 = st; st2.timezone = tz2; _assertPred!("opCmp", "==")(st1, st2); } auto sts = array(map!SysTime(chain(testDateTimesBC, testDateTimesAD))); foreach(st; sts) foreach(tz1; testTZs) foreach(tz2; testTZs) testEqual(st, tz1, tz2); static void testCmp(SysTime st1, immutable TimeZone tz1, SysTime st2, immutable TimeZone tz2) { st1.timezone = tz1; st2.timezone = tz2; _assertPred!("opCmp", "<")(st1, st2); _assertPred!("opCmp", ">")(st2, st1); } foreach(si, st1; sts) foreach(st2; sts[si+1 .. $]) foreach(tz1; testTZs) foreach(tz2; testTZs) testCmp(st1, tz1, st2, tz2); auto st = SysTime(DateTime(1999, 7, 6, 12, 33, 30)); const cst = SysTime(DateTime(1999, 7, 6, 12, 33, 30)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 33, 30)); static assert(__traits(compiles, st.opCmp(st))); static assert(__traits(compiles, st.opCmp(cst))); //static assert(__traits(compiles, st.opCmp(ist))); static assert(__traits(compiles, cst.opCmp(st))); static assert(__traits(compiles, cst.opCmp(cst))); //static assert(__traits(compiles, cst.opCmp(ist))); //static assert(__traits(compiles, ist.opCmp(st))); //static assert(__traits(compiles, ist.opCmp(cst))); //static assert(__traits(compiles, ist.opCmp(ist))); } /++ Year of the Gregorian Calendar. Positive numbers are A.D. Non-positive are B.C. +/ @property short year() const nothrow { return (cast(Date)this).year; } version(testStdDateTime) unittest { static void test(SysTime sysTime, long expected, size_t line = __LINE__) { _assertPred!"=="(sysTime.year, expected, format("Value given: %s", sysTime), __FILE__, line); } test(SysTime(0, UTC()), 1); test(SysTime(1, UTC()), 1); test(SysTime(-1, UTC()), 0); foreach(year; chain(testYearsBC, testYearsAD)) { foreach(md; testMonthDays) { foreach(tod; testTODs) { auto dt = DateTime(Date(year, md.month, md.day), tod); foreach(tz; testTZs) { foreach(fs; testFracSecs) test(SysTime(dt, fs, tz), year); } } } } const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cst.year)); //static assert(__traits(compiles, ist.year)); } /++ Year of the Gregorian Calendar. Positive numbers are A.D. Non-positive are B.C. Params: year = The year to set this $(D SysTime)'s year to. Throws: $(D DateTimeException) if the new year is not a leap year and the resulting date would be on February 29th. Examples: -------------------- assert(SysTime(DateTime(1999, 7, 6, 9, 7, 5)).year == 1999); assert(SysTime(DateTime(2010, 10, 4, 0, 0, 30)).year == 2010); assert(SysTime(DateTime(-7, 4, 5, 7, 45, 2)).year == -7); -------------------- +/ @property void year(int year) { auto hnsecs = adjTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs) + 1; if(hnsecs < 0) { hnsecs += convert!("hours", "hnsecs")(24); --days; } auto date = Date(cast(int)days); date.year = year; immutable newDaysHNSecs = convert!("days", "hnsecs")(date.dayOfGregorianCal - 1); adjTime = newDaysHNSecs + hnsecs; } //Verify Examples. version(testStdDateTime) unittest { assert(SysTime(DateTime(1999, 7, 6, 9, 7, 5)).year == 1999); assert(SysTime(DateTime(2010, 10, 4, 0, 0, 30)).year == 2010); assert(SysTime(DateTime(-7, 4, 5, 7, 45, 2)).year == -7); } version(testStdDateTime) unittest { static void test(SysTime st, int year, in SysTime expected, size_t line = __LINE__) { st.year = year; _assertPred!"=="(st, expected, "", __FILE__, line); } foreach(st; chain(testSysTimesBC, testSysTimesAD)) { auto dt = cast(DateTime)st; foreach(year; chain(testYearsBC, testYearsAD)) { auto e = SysTime(DateTime(year, dt.month, dt.day, dt.hour, dt.minute, dt.second), st.fracSec, st.timezone); test(st, year, e); } } foreach(fs; testFracSecs) { foreach(tz; testTZs) { foreach(tod; testTODs) { test(SysTime(DateTime(Date(1999, 2, 28), tod), fs, tz), 2000, SysTime(DateTime(Date(2000, 2, 28), tod), fs, tz)); test(SysTime(DateTime(Date(2000, 2, 28), tod), fs, tz), 1999, SysTime(DateTime(Date(1999, 2, 28), tod), fs, tz)); } foreach(tod; testTODsThrown) { auto st = SysTime(DateTime(Date(2000, 2, 29), tod), fs, tz); assertThrown!DateTimeException(st.year = 1999); } } } const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.year = 7)); //static assert(!__traits(compiles, ist.year = 7)); } /++ Year B.C. of the Gregorian Calendar counting year 0 as 1 B.C. Throws: $(D DateTimeException) if $(D isAD) is true. Examples: -------------------- assert(SysTime(DateTime(0, 1, 1, 12, 30, 33)).yearBC == 1); assert(SysTime(DateTime(-1, 1, 1, 10, 7, 2)).yearBC == 2); assert(SysTime(DateTime(-100, 1, 1, 4, 59, 0)).yearBC == 101); -------------------- +/ @property ushort yearBC() const { return (cast(Date)this).yearBC; } //Verify Examples. version(testStdDateTime) unittest { assert(SysTime(DateTime(0, 1, 1, 12, 30, 33)).yearBC == 1); assert(SysTime(DateTime(-1, 1, 1, 10, 7, 2)).yearBC == 2); assert(SysTime(DateTime(-100, 1, 1, 4, 59, 0)).yearBC == 101); } version(testStdDateTime) unittest { foreach(st; testSysTimesBC) { auto msg = format("SysTime: %s", st); assertNotThrown!DateTimeException(st.yearBC, msg); _assertPred!"=="(st.yearBC, (st.year * -1) + 1, msg); } foreach(st; [testSysTimesAD[0], testSysTimesAD[$/2], testSysTimesAD[$-1]]) assertThrown!DateTimeException(st.yearBC, format("SysTime: %s", st)); auto st = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, st.year = 12)); static assert(!__traits(compiles, cst.year = 12)); //static assert(!__traits(compiles, ist.year = 12)); } /++ Year B.C. of the Gregorian Calendar counting year 0 as 1 B.C. Params: year = The year B.C. to set this $(D SysTime)'s year to. Throws: $(D DateTimeException) if a non-positive value is given. Examples: -------------------- auto st = SysTime(DateTime(2010, 1, 1, 7, 30, 0)); st.yearBC = 1; assert(st == SysTime(DateTime(0, 1, 1, 7, 30, 0))); st.yearBC = 10; assert(st == SysTime(DateTime(-9, 1, 1, 7, 30, 0))); -------------------- +/ @property void yearBC(int year) { auto hnsecs = adjTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs) + 1; if(hnsecs < 0) { hnsecs += convert!("hours", "hnsecs")(24); --days; } auto date = Date(cast(int)days); date.yearBC = year; immutable newDaysHNSecs = convert!("days", "hnsecs")(date.dayOfGregorianCal - 1); adjTime = newDaysHNSecs + hnsecs; } //Verify Examples version(testStdDateTime) unittest { auto st = SysTime(DateTime(2010, 1, 1, 7, 30, 0)); st.yearBC = 1; assert(st == SysTime(DateTime(0, 1, 1, 7, 30, 0))); st.yearBC = 10; assert(st == SysTime(DateTime(-9, 1, 1, 7, 30, 0))); } version(testStdDateTime) unittest { static void test(SysTime st, int year, in SysTime expected, size_t line = __LINE__) { st.yearBC = year; _assertPred!"=="(st, expected, format("SysTime: %s", st), __FILE__, line); } foreach(st; chain(testSysTimesBC, testSysTimesAD)) { auto dt = cast(DateTime)st; foreach(year; testYearsBC) { auto e = SysTime(DateTime(year, dt.month, dt.day, dt.hour, dt.minute, dt.second), st.fracSec, st.timezone); test(st, (year * -1) + 1, e); } } foreach(st; [testSysTimesBC[0], testSysTimesBC[$ - 1], testSysTimesAD[0], testSysTimesAD[$ - 1]]) { foreach(year; testYearsBC) assertThrown!DateTimeException(st.yearBC = year); } foreach(fs; testFracSecs) { foreach(tz; testTZs) { foreach(tod; testTODs) { test(SysTime(DateTime(Date(-1999, 2, 28), tod), fs, tz), 2001, SysTime(DateTime(Date(-2000, 2, 28), tod), fs, tz)); test(SysTime(DateTime(Date(-2000, 2, 28), tod), fs, tz), 2000, SysTime(DateTime(Date(-1999, 2, 28), tod), fs, tz)); } foreach(tod; testTODsThrown) { auto st = SysTime(DateTime(Date(-2000, 2, 29), tod), fs, tz); assertThrown!DateTimeException(st.year = -1999); } } } auto st = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, st.yearBC = 12)); static assert(!__traits(compiles, cst.yearBC = 12)); //static assert(!__traits(compiles, ist.yearBC = 12)); } /++ Month of a Gregorian Year. Examples: -------------------- assert(SysTime(DateTime(1999, 7, 6, 9, 7, 5)).month == 7); assert(SysTime(DateTime(2010, 10, 4, 0, 0, 30)).month == 10); assert(SysTime(DateTime(-7, 4, 5, 7, 45, 2)).month == 4); -------------------- +/ @property Month month() const nothrow { return (cast(Date)this).month; } //Verify Examples. version(testStdDateTime) unittest { assert(SysTime(DateTime(1999, 7, 6, 9, 7, 5)).month == 7); assert(SysTime(DateTime(2010, 10, 4, 0, 0, 30)).month == 10); assert(SysTime(DateTime(-7, 4, 5, 7, 45, 2)).month == 4); } version(testStdDateTime) unittest { static void test(SysTime sysTime, Month expected, size_t line = __LINE__) { _assertPred!"=="(sysTime.month, expected, format("Value given: %s", sysTime), __FILE__, line); } test(SysTime(0, UTC()), Month.jan); test(SysTime(1, UTC()), Month.jan); test(SysTime(-1, UTC()), Month.dec); foreach(year; chain(testYearsBC, testYearsAD)) { foreach(md; testMonthDays) { foreach(tod; testTODs) { auto dt = DateTime(Date(year, md.month, md.day), tod); foreach(fs; testFracSecs) { foreach(tz; testTZs) test(SysTime(dt, fs, tz), md.month); } } } } const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cst.month)); //static assert(__traits(compiles, ist.month)); } /++ Month of a Gregorian Year. Params: month = The month to set this $(D SysTime)'s month to. Throws: $(D DateTimeException) if the given month is not a valid month. +/ @property void month(Month month) { auto hnsecs = adjTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs) + 1; if(hnsecs < 0) { hnsecs += convert!("hours", "hnsecs")(24); --days; } auto date = Date(cast(int)days); date.month = month; immutable newDaysHNSecs = convert!("days", "hnsecs")(date.dayOfGregorianCal - 1); adjTime = newDaysHNSecs + hnsecs; } version(testStdDateTime) unittest { static void test(SysTime st, Month month, in SysTime expected, size_t line = __LINE__) { st.month = cast(Month)month; _assertPred!"=="(st, expected, "", __FILE__, line); } foreach(st; chain(testSysTimesBC, testSysTimesAD)) { auto dt = cast(DateTime)st; foreach(md; testMonthDays) { if(st.day > maxDay(dt.year, md.month)) continue; auto e = SysTime(DateTime(dt.year, md.month, dt.day, dt.hour, dt.minute, dt.second), st.fracSec, st.timezone); test(st, md.month, e); } } foreach(fs; testFracSecs) { foreach(tz; testTZs) { foreach(tod; testTODs) { foreach(year; filter!((a){return yearIsLeapYear(a);}) (chain(testYearsBC, testYearsAD))) { test(SysTime(DateTime(Date(year, 1, 29), tod), fs, tz), Month.feb, SysTime(DateTime(Date(year, 2, 29), tod), fs, tz)); } foreach(year; chain(testYearsBC, testYearsAD)) { test(SysTime(DateTime(Date(year, 1, 28), tod), fs, tz), Month.feb, SysTime(DateTime(Date(year, 2, 28), tod), fs, tz)); test(SysTime(DateTime(Date(year, 7, 30), tod), fs, tz), Month.jun, SysTime(DateTime(Date(year, 6, 30), tod), fs, tz)); } } } } foreach(fs; [testFracSecs[0], testFracSecs[$-1]]) { foreach(tz; testTZs) { foreach(tod; testTODsThrown) { foreach(year; [testYearsBC[$-3], testYearsBC[$-2], testYearsBC[$-2], testYearsAD[0], testYearsAD[$-2], testYearsAD[$-1]]) { auto day = yearIsLeapYear(year) ? 30 : 29; auto st1 = SysTime(DateTime(Date(year, 1, day), tod), fs, tz); assertThrown!DateTimeException(st1.month = Month.feb); auto st2 = SysTime(DateTime(Date(year, 7, 31), tod), fs, tz); assertThrown!DateTimeException(st2.month = Month.jun); } } } } const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.month = 12)); //static assert(!__traits(compiles, ist.month = 12)); } /++ Day of a Gregorian Month. Examples: -------------------- assert(SysTime(DateTime(1999, 7, 6, 9, 7, 5)).day == 6); assert(SysTime(DateTime(2010, 10, 4, 0, 0, 30)).day == 4); assert(SysTime(DateTime(-7, 4, 5, 7, 45, 2)).day == 5); -------------------- +/ @property ubyte day() const nothrow { return (cast(Date)this).day; } //Verify Examples. version(testStdDateTime) unittest { assert(SysTime(DateTime(1999, 7, 6, 9, 7, 5)).day == 6); assert(SysTime(DateTime(2010, 10, 4, 0, 0, 30)).day == 4); assert(SysTime(DateTime(-7, 4, 5, 7, 45, 2)).day == 5); } version(testStdDateTime) unittest { static void test(SysTime sysTime, int expected, size_t line = __LINE__) { _assertPred!"=="(sysTime.day, expected, format("Value given: %s", sysTime), __FILE__, line); } test(SysTime(0, UTC()), 1); test(SysTime(1, UTC()), 1); test(SysTime(-1, UTC()), 31); foreach(year; chain(testYearsBC, testYearsAD)) { foreach(md; testMonthDays) { foreach(tod; testTODs) { auto dt = DateTime(Date(year, md.month, md.day), tod); foreach(tz; testTZs) { foreach(fs; testFracSecs) test(SysTime(dt, fs, tz), md.day); } } } } const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cst.day)); //static assert(__traits(compiles, ist.day)); } /++ Day of a Gregorian Month. Params: day = The day of the month to set this $(D SysTime)'s day to. Throws: $(D DateTimeException) if the given day is not a valid day of the current month. +/ @property void day(int day) { auto hnsecs = adjTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs) + 1; if(hnsecs < 0) { hnsecs += convert!("hours", "hnsecs")(24); --days; } auto date = Date(cast(int)days); date.day = day; immutable newDaysHNSecs = convert!("days", "hnsecs")(date.dayOfGregorianCal - 1); adjTime = newDaysHNSecs + hnsecs; } version(testStdDateTime) unittest { foreach(day; chain(testDays)) { foreach(st; chain(testSysTimesBC, testSysTimesAD)) { auto dt = cast(DateTime)st; if(day > maxDay(dt.year, dt.month)) continue; auto expected = SysTime(DateTime(dt.year, dt.month, day, dt.hour, dt.minute, dt.second), st.fracSec, st.timezone); st.day = day; assert(st == expected, format("[%s] [%s]", st, expected)); } } foreach(tz; testTZs) { foreach(tod; testTODs) { foreach(fs; testFracSecs) { foreach(year; chain(testYearsBC, testYearsAD)) { foreach(month; EnumMembers!Month) { auto st = SysTime(DateTime(Date(year, month, 1), tod), fs, tz); immutable max = maxDay(year, month); auto expected = SysTime(DateTime(Date(year, month, max), tod), fs, tz); st.day = max; assert(st == expected, format("[%s] [%s]", st, expected)); } } } } } foreach(tz; testTZs) { foreach(tod; testTODsThrown) { foreach(fs; [testFracSecs[0], testFracSecs[$-1]]) { foreach(year; [testYearsBC[$-3], testYearsBC[$-2], testYearsBC[$-2], testYearsAD[0], testYearsAD[$-2], testYearsAD[$-1]]) { foreach(month; EnumMembers!Month) { auto st = SysTime(DateTime(Date(year, month, 1), tod), fs, tz); immutable max = maxDay(year, month); assertThrown!DateTimeException(st.day = max + 1); } } } } } const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.day = 27)); //static assert(!__traits(compiles, ist.day = 27)); } /++ Hours past midnight. +/ @property ubyte hour() const nothrow { auto hnsecs = adjTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs) + 1; if(hnsecs < 0) { hnsecs += convert!("hours", "hnsecs")(24); --days; } return cast(ubyte)getUnitsFromHNSecs!"hours"(hnsecs); } version(testStdDateTime) unittest { static void test(SysTime sysTime, int expected, size_t line = __LINE__) { _assertPred!"=="(sysTime.hour, expected, format("Value given: %s", sysTime), __FILE__, line); } test(SysTime(0, UTC()), 0); test(SysTime(1, UTC()), 0); test(SysTime(-1, UTC()), 23); foreach(tz; testTZs) { foreach(year; chain(testYearsBC, testYearsAD)) { foreach(md; testMonthDays) { foreach(hour; testHours) { foreach(minute; testMinSecs) { foreach(second; testMinSecs) { auto dt = DateTime(Date(year, md.month, md.day), TimeOfDay(hour, minute, second)); foreach(fs; testFracSecs) test(SysTime(dt, fs, tz), hour); } } } } } } const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cst.hour)); //static assert(__traits(compiles, ist.hour)); } /++ Hours past midnight. Params: hour = The hours to set this $(D SysTime)'s hour to. Throws: $(D DateTimeException) if the given hour are not a valid hour of the day. +/ @property void hour(int hour) { enforceValid!"hours"(hour); auto hnsecs = adjTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs); immutable daysHNSecs = convert!("days", "hnsecs")(days); immutable negative = hnsecs < 0; if(negative) hnsecs += convert!("hours", "hnsecs")(24); hnsecs = removeUnitsFromHNSecs!"hours"(hnsecs); hnsecs += convert!("hours", "hnsecs")(hour); if(negative) hnsecs -= convert!("hours", "hnsecs")(24); adjTime = daysHNSecs + hnsecs; } version(testStdDateTime) unittest { foreach(hour; chain(testHours)) { foreach(st; chain(testSysTimesBC, testSysTimesAD)) { auto dt = cast(DateTime)st; auto expected = SysTime(DateTime(dt.year, dt.month, dt.day, hour, dt.minute, dt.second), st.fracSec, st.timezone); st.hour = hour; assert(st == expected, format("[%s] [%s]", st, expected)); } } auto st = testSysTimesAD[0]; assertThrown!DateTimeException(st.hour = -1); assertThrown!DateTimeException(st.hour = 60); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.hour = 27)); //static assert(!__traits(compiles, ist.hour = 27)); } /++ Minutes past the current hour. +/ @property ubyte minute() const nothrow { auto hnsecs = adjTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs) + 1; if(hnsecs < 0) { hnsecs += convert!("hours", "hnsecs")(24); --days; } hnsecs = removeUnitsFromHNSecs!"hours"(hnsecs); return cast(ubyte)getUnitsFromHNSecs!"minutes"(hnsecs); } version(testStdDateTime) unittest { static void test(SysTime sysTime, int expected, size_t line = __LINE__) { _assertPred!"=="(sysTime.minute, expected, format("Value given: %s", sysTime), __FILE__, line); } test(SysTime(0, UTC()), 0); test(SysTime(1, UTC()), 0); test(SysTime(-1, UTC()), 59); foreach(tz; testTZs) { foreach(year; chain(testYearsBC, testYearsAD)) { foreach(md; testMonthDays) { foreach(hour; testHours) { foreach(minute; testMinSecs) { foreach(second; testMinSecs) { auto dt = DateTime(Date(year, md.month, md.day), TimeOfDay(hour, minute, second)); foreach(fs; testFracSecs) test(SysTime(dt, fs, tz), minute); } } } } } } const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cst.minute)); //static assert(__traits(compiles, ist.minute)); } /++ Minutes past the current hour. Params: minutes = The minute to set this $(D SysTime)'s minute to. Throws: $(D DateTimeException) if the given minute are not a valid minute of an hour. +/ @property void minute(int minute) { enforceValid!"minutes"(minute); auto hnsecs = adjTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs); immutable daysHNSecs = convert!("days", "hnsecs")(days); immutable negative = hnsecs < 0; if(negative) hnsecs += convert!("hours", "hnsecs")(24); immutable hour = splitUnitsFromHNSecs!"hours"(hnsecs); hnsecs = removeUnitsFromHNSecs!"minutes"(hnsecs); hnsecs += convert!("hours", "hnsecs")(hour); hnsecs += convert!("minutes", "hnsecs")(minute); if(negative) hnsecs -= convert!("hours", "hnsecs")(24); adjTime = daysHNSecs + hnsecs; } version(testStdDateTime) unittest { foreach(minute; testMinSecs) { foreach(st; chain(testSysTimesBC, testSysTimesAD)) { auto dt = cast(DateTime)st; auto expected = SysTime(DateTime(dt.year, dt.month, dt.day, dt.hour, minute, dt.second), st.fracSec, st.timezone); st.minute = minute; assert(st == expected, format("[%s] [%s]", st, expected)); } } auto st = testSysTimesAD[0]; assertThrown!DateTimeException(st.minute = -1); assertThrown!DateTimeException(st.minute = 60); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.minute = 27)); //static assert(!__traits(compiles, ist.minute = 27)); } /++ Seconds past the current minute. +/ @property ubyte second() const nothrow { auto hnsecs = adjTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs) + 1; if(hnsecs < 0) { hnsecs += convert!("hours", "hnsecs")(24); --days; } hnsecs = removeUnitsFromHNSecs!"hours"(hnsecs); hnsecs = removeUnitsFromHNSecs!"minutes"(hnsecs); return cast(ubyte)getUnitsFromHNSecs!"seconds"(hnsecs); } version(testStdDateTime) unittest { static void test(SysTime sysTime, int expected, size_t line = __LINE__) { _assertPred!"=="(sysTime.second, expected, format("Value given: %s", sysTime), __FILE__, line); } test(SysTime(0, UTC()), 0); test(SysTime(1, UTC()), 0); test(SysTime(-1, UTC()), 59); foreach(tz; testTZs) { foreach(year; chain(testYearsBC, testYearsAD)) { foreach(md; testMonthDays) { foreach(hour; testHours) { foreach(minute; testMinSecs) { foreach(second; testMinSecs) { auto dt = DateTime(Date(year, md.month, md.day), TimeOfDay(hour, minute, second)); foreach(fs; testFracSecs) test(SysTime(dt, fs, tz), second); } } } } } } const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cst.second)); //static assert(__traits(compiles, ist.second)); } /++ Seconds past the current minute. Params: second = The second to set this $(D SysTime)'s second to. Throws: $(D DateTimeException) if the given second are not a valid second of a minute. +/ @property void second(int second) { enforceValid!"seconds"(second); auto hnsecs = adjTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs); immutable daysHNSecs = convert!("days", "hnsecs")(days); immutable negative = hnsecs < 0; if(negative) hnsecs += convert!("hours", "hnsecs")(24); immutable hour = splitUnitsFromHNSecs!"hours"(hnsecs); immutable minute = splitUnitsFromHNSecs!"minutes"(hnsecs); hnsecs = removeUnitsFromHNSecs!"seconds"(hnsecs); hnsecs += convert!("hours", "hnsecs")(hour); hnsecs += convert!("minutes", "hnsecs")(minute); hnsecs += convert!("seconds", "hnsecs")(second); if(negative) hnsecs -= convert!("hours", "hnsecs")(24); adjTime = daysHNSecs + hnsecs; } version(testStdDateTime) unittest { foreach(second; testMinSecs) { foreach(st; chain(testSysTimesBC, testSysTimesAD)) { auto dt = cast(DateTime)st; auto expected = SysTime(DateTime(dt.year, dt.month, dt.day, dt.hour, dt.minute, second), st.fracSec, st.timezone); st.second = second; assert(st == expected, format("[%s] [%s]", st, expected)); } } auto st = testSysTimesAD[0]; assertThrown!DateTimeException(st.second = -1); assertThrown!DateTimeException(st.second = 60); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.seconds = 27)); //static assert(!__traits(compiles, ist.seconds = 27)); } /++ Fractional seconds passed the second. +/ @property FracSec fracSec() const nothrow { try { auto hnsecs = removeUnitsFromHNSecs!"days"(adjTime); if(hnsecs < 0) hnsecs += convert!("hours", "hnsecs")(24); hnsecs = removeUnitsFromHNSecs!"seconds"(hnsecs); return FracSec.from!"hnsecs"(cast(int)hnsecs); } catch(Exception e) assert(0, "FracSec.from!\"hnsecs\"() threw."); } version(testStdDateTime) unittest { static void test(SysTime sysTime, FracSec expected, size_t line = __LINE__) { _assertPred!"=="(sysTime.fracSec, expected, format("Value given: %s", sysTime), __FILE__, line); } test(SysTime(0, UTC()), FracSec.from!"hnsecs"(0)); test(SysTime(1, UTC()), FracSec.from!"hnsecs"(1)); test(SysTime(-1, UTC()), FracSec.from!"hnsecs"(9_999_999)); foreach(tz; testTZs) { foreach(year; chain(testYearsBC, testYearsAD)) { foreach(md; testMonthDays) { foreach(hour; testHours) { foreach(minute; testMinSecs) { foreach(second; testMinSecs) { auto dt = DateTime(Date(year, md.month, md.day), TimeOfDay(hour, minute, second)); foreach(fs; testFracSecs) test(SysTime(dt, fs, tz), fs); } } } } } } const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cst.fracSec)); //static assert(__traits(compiles, ist.fracSec)); } /++ Fractional seconds passed the second. Params: fracSec = The fractional seconds to set this $(D SysTimes)'s fractional seconds to. Throws: $(D DateTimeException) if $(D fracSec) is negative. +/ @property void fracSec(FracSec fracSec) { immutable fracHNSecs = fracSec.hnsecs; enforce(fracHNSecs >= 0, new DateTimeException("A SysTime cannot have negative fractional seconds.")); auto hnsecs = adjTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs); immutable daysHNSecs = convert!("days", "hnsecs")(days); immutable negative = hnsecs < 0; if(negative) hnsecs += convert!("hours", "hnsecs")(24); immutable hour = splitUnitsFromHNSecs!"hours"(hnsecs); immutable minute = splitUnitsFromHNSecs!"minutes"(hnsecs); immutable second = getUnitsFromHNSecs!"seconds"(hnsecs); hnsecs = fracHNSecs; hnsecs += convert!("hours", "hnsecs")(hour); hnsecs += convert!("minutes", "hnsecs")(minute); hnsecs += convert!("seconds", "hnsecs")(second); if(negative) hnsecs -= convert!("hours", "hnsecs")(24); adjTime = daysHNSecs + hnsecs; } version(testStdDateTime) unittest { foreach(fracSec; testFracSecs) { foreach(st; chain(testSysTimesBC, testSysTimesAD)) { auto dt = cast(DateTime)st; auto expected = SysTime(DateTime(dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second), fracSec, st.timezone); st.fracSec = fracSec; assert(st == expected, format("[%s] [%s]", st, expected)); } } auto st = testSysTimesAD[0]; assertThrown!DateTimeException(st.fracSec = FracSec.from!"hnsecs"(-1)); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.fracSec = FracSec.from!"msecs"(7))); //static assert(!__traits(compiles, ist.fracSec = FracSec.from!"msecs"(7))); } /++ The total hnsecs from midnight, January 1st, 1 A.D. UTC. This is the internal representation of $(D SysTime). +/ @property long stdTime() const pure nothrow { return _stdTime; } version(testStdDateTime) unittest { _assertPred!"=="(SysTime(0).stdTime, 0); _assertPred!"=="(SysTime(1).stdTime, 1); _assertPred!"=="(SysTime(-1).stdTime, -1); _assertPred!"=="(SysTime(DateTime(1, 1, 1, 0, 0, 33), FracSec.from!"hnsecs"(502), UTC()).stdTime, 330000502L); _assertPred!"=="(SysTime(DateTime(1970, 1, 1, 0, 0, 0), UTC()).stdTime, 621355968000000000L); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cst.stdTime)); //static assert(__traits(compiles, ist.stdTime)); } /++ The total hnsecs from midnight, January 1st, 1 A.D. UTC. This is the internal representation of $(D SysTime). Params: stdTime = The number of hnsecs since January 1st, 1 A.D. UTC. +/ @property void stdTime(long stdTime) pure nothrow { _stdTime = stdTime; } version(testStdDateTime) unittest { static void test(long stdTime, in SysTime expected, size_t line = __LINE__) { auto st = SysTime(0, UTC()); st.stdTime = stdTime; _assertPred!"=="(st, expected); } test(0, SysTime(Date(1, 1, 1), UTC())); test(1, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1), UTC())); test(-1, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999), UTC())); test(330_000_502L, SysTime(DateTime(1, 1, 1, 0, 0, 33), FracSec.from!"hnsecs"(502), UTC())); test(621_355_968_000_000_000L, SysTime(DateTime(1970, 1, 1, 0, 0, 0), UTC())); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.stdTime = 27)); //static assert(!__traits(compiles, ist.stdTime = 27)); } /++ The current time zone of this $(D SysTime). Its internal time is always kept in UTC, so there are no conversion issues between time zones due to DST. Functions which return all or part of the time - such as hours - adjust the time to this $(D SysTime)'s time zone before returning. +/ @property immutable(TimeZone) timezone() const pure nothrow { return _timezone; } /++ The current time zone of this $(D SysTime). It's internal time is always kept in UTC, so there are no conversion issues between time zones due to DST. Functions which return all or part of the time - such as hours - adjust the time to this $(D SysTime)'s time zone before returning. Params: tz = The $(D TimeZone) to set this $(D SysTime)'s time zone to. +/ @property void timezone(immutable TimeZone timezone) pure nothrow { if(timezone is null) _timezone = LocalTime(); else _timezone = timezone; } /++ Returns whether DST is in effect for this $(D SysTime). +/ @property bool dstInEffect() const nothrow { return _timezone.dstInEffect(_stdTime); //This function's unit testing is done in the time zone classes. } /++ Returns what the offset from UTC is for this $(D SysTime). It includes the DST offset in effect at that time (if any). +/ @property Duration utcOffset() const nothrow { return _timezone.utcOffsetAt(_stdTime); } /++ Returns a $(D SysTime) with the same std time as this one, but with $(D LocalTime) as its time zone. +/ SysTime toLocalTime() const nothrow { return SysTime(_stdTime, LocalTime()); } unittest { version(testStdDateTime) { { auto sysTime = SysTime(DateTime(1982, 1, 4, 8, 59, 7), FracSec.from!"hnsecs"(27)); _assertPred!"=="(sysTime, sysTime.toLocalTime()); _assertPred!"=="(sysTime._stdTime, sysTime.toLocalTime()._stdTime); assert(sysTime.toLocalTime().timezone is LocalTime()); assert(sysTime.toLocalTime().timezone is sysTime.timezone); assert(sysTime.toLocalTime().timezone !is UTC()); } { immutable stz = new SimpleTimeZone(dur!"minutes"(-3 * 60)); auto sysTime = SysTime(DateTime(1982, 1, 4, 8, 59, 7), FracSec.from!"hnsecs"(27), stz); _assertPred!"=="(sysTime, sysTime.toLocalTime()); _assertPred!"=="(sysTime._stdTime, sysTime.toLocalTime()._stdTime); assert(sysTime.toLocalTime().timezone is LocalTime()); assert(sysTime.toLocalTime().timezone !is UTC()); assert(sysTime.toLocalTime().timezone !is stz); } } } /++ Returns a $(D SysTime) with the same std time as this one, but with $(D UTC) as its time zone. +/ SysTime toUTC() const pure nothrow { return SysTime(_stdTime, UTC()); } unittest { version(testStdDateTime) { auto sysTime = SysTime(DateTime(1982, 1, 4, 8, 59, 7), FracSec.from!"hnsecs"(27)); _assertPred!"=="(sysTime, sysTime.toUTC()); _assertPred!"=="(sysTime._stdTime, sysTime.toUTC()._stdTime); assert(sysTime.toUTC().timezone is UTC()); assert(sysTime.toUTC().timezone !is LocalTime()); assert(sysTime.toUTC().timezone !is sysTime.timezone); } } /++ Returns a $(D SysTime) with the same std time as this one, but with given time zone as its time zone. +/ SysTime toOtherTZ(immutable TimeZone tz) const pure nothrow { if(tz is null) return SysTime(_stdTime, LocalTime()); else return SysTime(_stdTime, tz); } unittest { version(testStdDateTime) { immutable stz = new SimpleTimeZone(dur!"minutes"(11 * 60)); auto sysTime = SysTime(DateTime(1982, 1, 4, 8, 59, 7), FracSec.from!"hnsecs"(27)); _assertPred!"=="(sysTime, sysTime.toOtherTZ(stz)); _assertPred!"=="(sysTime._stdTime, sysTime.toOtherTZ(stz)._stdTime); assert(sysTime.toOtherTZ(stz).timezone is stz); assert(sysTime.toOtherTZ(stz).timezone !is LocalTime()); assert(sysTime.toOtherTZ(stz).timezone !is UTC()); } } /++ Returns a $(D time_t) which represents the same time as this $(D SysTime). Note that like all conversions in std.datetime, this is a truncating conversion. If $(D time_t) is 32 bits, rather than 64, and the result can't fit in a 32-bit value, then the closest value that can be held in 32 bits will be used (so $(D time_t.max) if it goes over and $(D time_t.min) if it goes under). +/ time_t toUnixTime() const pure nothrow { return stdTimeToUnixTime(_stdTime); } unittest { version(testStdDateTime) { _assertPred!"=="(SysTime(DateTime(1970, 1, 1), UTC()).toUnixTime(), 0); _assertPred!"=="(SysTime(DateTime(1970, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1), UTC()).toUnixTime(), 0); _assertPred!"=="(SysTime(DateTime(1970, 1, 1, 0, 0, 0), FracSec.from!"usecs"(1), UTC()).toUnixTime(), 0); _assertPred!"=="(SysTime(DateTime(1970, 1, 1, 0, 0, 0), FracSec.from!"msecs"(1), UTC()).toUnixTime(), 0); _assertPred!"=="(SysTime(DateTime(1970, 1, 1, 0, 0, 1), UTC()).toUnixTime(), 1); _assertPred!"=="(SysTime(DateTime(1969, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999), UTC()).toUnixTime(), 0); _assertPred!"=="(SysTime(DateTime(1969, 12, 31, 23, 59, 59), FracSec.from!"usecs"(999_999), UTC()).toUnixTime(), 0); _assertPred!"=="(SysTime(DateTime(1969, 12, 31, 23, 59, 59), FracSec.from!"msecs"(999), UTC()).toUnixTime(), 0); _assertPred!"=="(SysTime(DateTime(1969, 12, 31, 23, 59, 59), UTC()).toUnixTime(), -1); } } /++ Returns a $(D timeval) which represents this $(D SysTime). Note that like all conversions in std.datetime, this is a truncating conversion. If $(D time_t) is 32 bits, rather than 64, and the result can't fit in a 32-bit value, then the closest value that can be held in 32 bits will be used for $(D tv_sec). (so $(D time_t.max) if it goes over and $(D time_t.min) if it goes under). +/ timeval toTimeVal() const pure nothrow { immutable tv_sec = toUnixTime(); immutable fracHNSecs = removeUnitsFromHNSecs!"seconds"(_stdTime - 621355968000000000L); immutable tv_usec = cast(int)convert!("hnsecs", "usecs")(fracHNSecs); return timeval(tv_sec, tv_usec); } unittest { version(testStdDateTime) { assert(SysTime(DateTime(1970, 1, 1), UTC()).toTimeVal() == timeval(0, 0)); assert(SysTime(DateTime(1970, 1, 1), FracSec.from!"hnsecs"(9), UTC()).toTimeVal() == timeval(0, 0)); assert(SysTime(DateTime(1970, 1, 1), FracSec.from!"hnsecs"(10), UTC()).toTimeVal() == timeval(0, 1)); assert(SysTime(DateTime(1970, 1, 1), FracSec.from!"usecs"(7), UTC()).toTimeVal() == timeval(0, 7)); assert(SysTime(DateTime(1970, 1, 1, 0, 0, 1), UTC()).toTimeVal() == timeval(1, 0)); assert(SysTime(DateTime(1970, 1, 1, 0, 0, 1), FracSec.from!"hnsecs"(9), UTC()).toTimeVal() == timeval(1, 0)); assert(SysTime(DateTime(1970, 1, 1, 0, 0, 1), FracSec.from!"hnsecs"(10), UTC()).toTimeVal() == timeval(1, 1)); assert(SysTime(DateTime(1970, 1, 1, 0, 0, 1), FracSec.from!"usecs"(7), UTC()).toTimeVal() == timeval(1, 7)); assert(SysTime(DateTime(1969, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999), UTC()).toTimeVal() == timeval(0, 0)); assert(SysTime(DateTime(1969, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_990), UTC()).toTimeVal() == timeval(0, -1)); assert(SysTime(DateTime(1969, 12, 31, 23, 59, 59), FracSec.from!"usecs"(999_999), UTC()).toTimeVal() == timeval(0, -1)); assert(SysTime(DateTime(1969, 12, 31, 23, 59, 59), FracSec.from!"usecs"(999), UTC()).toTimeVal() == timeval(0, -999_001)); assert(SysTime(DateTime(1969, 12, 31, 23, 59, 59), FracSec.from!"msecs"(999), UTC()).toTimeVal() == timeval(0, -1000)); assert(SysTime(DateTime(1969, 12, 31, 23, 59, 59), UTC()).toTimeVal() == timeval(-1, 0)); assert(SysTime(DateTime(1969, 12, 31, 23, 59, 58), FracSec.from!"usecs"(17), UTC()).toTimeVal() == timeval(-1, -999_983)); } } /++ Returns a $(D tm) which represents this $(D SysTime). +/ tm toTM() const nothrow { try { auto dateTime = cast(DateTime)this; tm timeInfo; timeInfo.tm_sec = dateTime.second; timeInfo.tm_min = dateTime.minute; timeInfo.tm_hour = dateTime.hour; timeInfo.tm_mday = dateTime.day; timeInfo.tm_mon = dateTime.month - 1; timeInfo.tm_year = dateTime.year - 1900; timeInfo.tm_wday = dateTime.dayOfWeek; timeInfo.tm_yday = dateTime.dayOfYear - 1; timeInfo.tm_isdst = _timezone.dstInEffect(_stdTime); version(Posix) { char[] zone = (timeInfo.tm_isdst ? _timezone.dstName : _timezone.stdName).dup; zone ~= "\0"; timeInfo.tm_gmtoff = cast(int)convert!("hnsecs", "seconds")(adjTime - _stdTime); timeInfo.tm_zone = zone.ptr; } return timeInfo; } catch(Exception e) assert(0, "Either DateTime's constructor threw."); } unittest { version(testStdDateTime) { version(Posix) { scope(exit) clearTZEnvVar(); setTZEnvVar("America/Los_Angeles"); } { auto timeInfo = SysTime(DateTime(1970, 1, 1)).toTM(); _assertPred!"=="(timeInfo.tm_sec, 0); _assertPred!"=="(timeInfo.tm_min, 0); _assertPred!"=="(timeInfo.tm_hour, 0); _assertPred!"=="(timeInfo.tm_mday, 1); _assertPred!"=="(timeInfo.tm_mon, 0); _assertPred!"=="(timeInfo.tm_year, 70); _assertPred!"=="(timeInfo.tm_wday, 4); _assertPred!"=="(timeInfo.tm_yday, 0); version(Posix) _assertPred!"=="(timeInfo.tm_isdst, 0); else version(Windows) assert(timeInfo.tm_isdst == 0 || timeInfo.tm_isdst == 1); version(Posix) { _assertPred!"=="(timeInfo.tm_gmtoff, -8 * 60 * 60); _assertPred!"=="(to!string(timeInfo.tm_zone), "PST"); } } { auto timeInfo = SysTime(DateTime(2010, 7, 4, 12, 15, 7), FracSec.from!"hnsecs"(15)).toTM(); _assertPred!"=="(timeInfo.tm_sec, 7); _assertPred!"=="(timeInfo.tm_min, 15); _assertPred!"=="(timeInfo.tm_hour, 12); _assertPred!"=="(timeInfo.tm_mday, 4); _assertPred!"=="(timeInfo.tm_mon, 6); _assertPred!"=="(timeInfo.tm_year, 110); _assertPred!"=="(timeInfo.tm_wday, 0); _assertPred!"=="(timeInfo.tm_yday, 184); version(Posix) _assertPred!"=="(timeInfo.tm_isdst, 1); else version(Windows) assert(timeInfo.tm_isdst == 0 || timeInfo.tm_isdst == 1); version(Posix) { _assertPred!"=="(timeInfo.tm_gmtoff, -7 * 60 * 60); _assertPred!"=="(to!string(timeInfo.tm_zone), "PDT"); } } } } /++ Adds the given number of years or months to this $(D SysTime). A negative number will subtract. Note that if day overflow is allowed, and the date with the adjusted year/month overflows the number of days in the new month, then the month will be incremented by one, and the day set to the number of days overflowed. (e.g. if the day were 31 and the new month were June, then the month would be incremented to July, and the new day would be 1). If day overflow is not allowed, then the day will be set to the last valid day in the month (e.g. June 31st would become June 30th). Params: units = The type of units to add ("years" or "months"). value = The number of months or years to add to this $(D SysTime). allowOverflow = Whether the days should be allowed to overflow, causing the month to increment. Examples: -------------------- auto st1 = SysTime(DateTime(2010, 1, 1, 12, 30, 33)); st1.add!"months"(11); assert(st1 == SysTime(DateTime(2010, 12, 1, 12, 30, 33))); auto st2 = SysTime(DateTime(2010, 1, 1, 12, 30, 33)); st2.add!"months"(-11); assert(st2 == SysTime(DateTime(2009, 2, 1, 12, 30, 33))); auto st3 = SysTime(DateTime(2000, 2, 29, 12, 30, 33)); st3.add!"years"(1); assert(st3 == SysTime(DateTime(2001, 3, 1, 12, 30, 33))); auto st4 = SysTime(DateTime(2000, 2, 29, 12, 30, 33)); st4.add!"years"(1, AllowDayOverflow.no); assert(st4 == SysTime(DateTime(2001, 2, 28, 12, 30, 33))); -------------------- +/ ref SysTime add(string units)(long value, AllowDayOverflow allowOverflow = AllowDayOverflow.yes) nothrow if(units == "years" || units == "months") { auto hnsecs = adjTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs) + 1; if(hnsecs < 0) { hnsecs += convert!("hours", "hnsecs")(24); --days; } auto date = Date(cast(int)days); date.add!units(value, allowOverflow); days = date.dayOfGregorianCal - 1; if(days < 0) { hnsecs -= convert!("hours", "hnsecs")(24); ++days; } immutable newDaysHNSecs = convert!("days", "hnsecs")(days); adjTime = newDaysHNSecs + hnsecs; return this; } //Verify Examples. unittest { version (testStdDateTime) { auto st1 = SysTime(DateTime(2010, 1, 1, 12, 30, 33)); st1.add!"months"(11); assert(st1 == SysTime(DateTime(2010, 12, 1, 12, 30, 33))); auto st2 = SysTime(DateTime(2010, 1, 1, 12, 30, 33)); st2.add!"months"(-11); assert(st2 == SysTime(DateTime(2009, 2, 1, 12, 30, 33))); auto st3 = SysTime(DateTime(2000, 2, 29, 12, 30, 33)); st3.add!"years"(1); assert(st3 == SysTime(DateTime(2001, 3, 1, 12, 30, 33))); auto st4 = SysTime(DateTime(2000, 2, 29, 12, 30, 33)); st4.add!"years"(1, AllowDayOverflow.no); assert(st4 == SysTime(DateTime(2001, 2, 28, 12, 30, 33))); } } //Test add!"years"() with AllowDayOverlow.yes unittest { version(testStdDateTime) { //Test A.D. { auto sysTime = SysTime(Date(1999, 7, 6)); sysTime.add!"years"(7); _assertPred!"=="(sysTime, SysTime(Date(2006, 7, 6))); sysTime.add!"years"(-9); _assertPred!"=="(sysTime, SysTime(Date(1997, 7, 6))); } { auto sysTime = SysTime(Date(1999, 2, 28)); sysTime.add!"years"(1); _assertPred!"=="(sysTime, SysTime(Date(2000, 2, 28))); } { auto sysTime = SysTime(Date(2000, 2, 29)); sysTime.add!"years"(-1); _assertPred!"=="(sysTime, SysTime(Date(1999, 3, 1))); } { auto sysTime = SysTime(DateTime(1999, 7, 6, 12, 7, 3), FracSec.from!"msecs"(234)); sysTime.add!"years"(7); _assertPred!"=="(sysTime, SysTime(DateTime(2006, 7, 6, 12, 7, 3), FracSec.from!"msecs"(234))); sysTime.add!"years"(-9); _assertPred!"=="(sysTime, SysTime(DateTime(1997, 7, 6, 12, 7, 3), FracSec.from!"msecs"(234))); } { auto sysTime = SysTime(DateTime(1999, 2, 28, 0, 7, 2), FracSec.from!"usecs"(1207)); sysTime.add!"years"(1); _assertPred!"=="(sysTime, SysTime(DateTime(2000, 2, 28, 0, 7, 2), FracSec.from!"usecs"(1207))); } { auto sysTime = SysTime(DateTime(2000, 2, 29, 0, 7, 2), FracSec.from!"usecs"(1207)); sysTime.add!"years"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 3, 1, 0, 7, 2), FracSec.from!"usecs"(1207))); } //Test B.C. { auto sysTime = SysTime(Date(-1999, 7, 6)); sysTime.add!"years"(-7); _assertPred!"=="(sysTime, SysTime(Date(-2006, 7, 6))); sysTime.add!"years"(9); _assertPred!"=="(sysTime, SysTime(Date(-1997, 7, 6))); } { auto sysTime = SysTime(Date(-1999, 2, 28)); sysTime.add!"years"(-1); _assertPred!"=="(sysTime, SysTime(Date(-2000, 2, 28))); } { auto sysTime = SysTime(Date(-2000, 2, 29)); sysTime.add!"years"(1); _assertPred!"=="(sysTime, SysTime(Date(-1999, 3, 1))); } { auto sysTime = SysTime(DateTime(-1999, 7, 6, 12, 7, 3), FracSec.from!"msecs"(234)); sysTime.add!"years"(-7); _assertPred!"=="(sysTime, SysTime(DateTime(-2006, 7, 6, 12, 7, 3), FracSec.from!"msecs"(234))); sysTime.add!"years"(9); _assertPred!"=="(sysTime, SysTime(DateTime(-1997, 7, 6, 12, 7, 3), FracSec.from!"msecs"(234))); } { auto sysTime = SysTime(DateTime(-1999, 2, 28, 3, 3, 3), FracSec.from!"hnsecs"(3)); sysTime.add!"years"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(-2000, 2, 28, 3, 3, 3), FracSec.from!"hnsecs"(3))); } { auto sysTime = SysTime(DateTime(-2000, 2, 29, 3, 3, 3), FracSec.from!"hnsecs"(3)); sysTime.add!"years"(1); _assertPred!"=="(sysTime, SysTime(DateTime(-1999, 3, 1, 3, 3, 3), FracSec.from!"hnsecs"(3))); } //Test Both { auto sysTime = SysTime(Date(4, 7, 6)); sysTime.add!"years"(-5); _assertPred!"=="(sysTime, SysTime(Date(-1, 7, 6))); sysTime.add!"years"(5); _assertPred!"=="(sysTime, SysTime(Date(4, 7, 6))); } { auto sysTime = SysTime(Date(-4, 7, 6)); sysTime.add!"years"(5); _assertPred!"=="(sysTime, SysTime(Date(1, 7, 6))); sysTime.add!"years"(-5); _assertPred!"=="(sysTime, SysTime(Date(-4, 7, 6))); } { auto sysTime = SysTime(Date(4, 7, 6)); sysTime.add!"years"(-8); _assertPred!"=="(sysTime, SysTime(Date(-4, 7, 6))); sysTime.add!"years"(8); _assertPred!"=="(sysTime, SysTime(Date(4, 7, 6))); } { auto sysTime = SysTime(Date(-4, 7, 6)); sysTime.add!"years"(8); _assertPred!"=="(sysTime, SysTime(Date(4, 7, 6))); sysTime.add!"years"(-8); _assertPred!"=="(sysTime, SysTime(Date(-4, 7, 6))); } { auto sysTime = SysTime(Date(-4, 2, 29)); sysTime.add!"years"(5); _assertPred!"=="(sysTime, SysTime(Date(1, 3, 1))); } { auto sysTime = SysTime(Date(4, 2, 29)); sysTime.add!"years"(-5); _assertPred!"=="(sysTime, SysTime(Date(-1, 3, 1))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.add!"years"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); sysTime.add!"years"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.add!"years"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.add!"years"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } { auto sysTime = SysTime(DateTime(0, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.add!"years"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); sysTime.add!"years"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(0, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.add!"years"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.add!"years"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } { auto sysTime = SysTime(DateTime(4, 7, 6, 14, 7, 1), FracSec.from!"usecs"(54329)); sysTime.add!"years"(-5); _assertPred!"=="(sysTime, SysTime(DateTime(-1, 7, 6, 14, 7, 1), FracSec.from!"usecs"(54329))); sysTime.add!"years"(5); _assertPred!"=="(sysTime, SysTime(DateTime(4, 7, 6, 14, 7, 1), FracSec.from!"usecs"(54329))); } { auto sysTime = SysTime(DateTime(-4, 7, 6, 14, 7, 1), FracSec.from!"usecs"(54329)); sysTime.add!"years"(5); _assertPred!"=="(sysTime, SysTime(DateTime(1, 7, 6, 14, 7, 1), FracSec.from!"usecs"(54329))); sysTime.add!"years"(-5); _assertPred!"=="(sysTime, SysTime(DateTime(-4, 7, 6, 14, 7, 1), FracSec.from!"usecs"(54329))); } { auto sysTime = SysTime(DateTime(-4, 2, 29, 5, 5, 5), FracSec.from!"msecs"(555)); sysTime.add!"years"(5); _assertPred!"=="(sysTime, SysTime(DateTime(1, 3, 1, 5, 5, 5), FracSec.from!"msecs"(555))); } { auto sysTime = SysTime(DateTime(4, 2, 29, 5, 5, 5), FracSec.from!"msecs"(555)); sysTime.add!"years"(-5); _assertPred!"=="(sysTime, SysTime(DateTime(-1, 3, 1, 5, 5, 5), FracSec.from!"msecs"(555))); } const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.add!"years"(4))); //static assert(!__traits(compiles, ist.add!"years"(4))); } } //Test add!"years"() with AllowDayOverlow.no unittest { version(testStdDateTime) { //Test A.D. { auto sysTime = SysTime(Date(1999, 7, 6)); sysTime.add!"years"(7, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(2006, 7, 6))); sysTime.add!"years"(-9, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1997, 7, 6))); } { auto sysTime = SysTime(Date(1999, 2, 28)); sysTime.add!"years"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(2000, 2, 28))); } { auto sysTime = SysTime(Date(2000, 2, 29)); sysTime.add!"years"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 2, 28))); } { auto sysTime = SysTime(DateTime(1999, 7, 6, 12, 7, 3), FracSec.from!"msecs"(234)); sysTime.add!"years"(7, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(2006, 7, 6, 12, 7, 3), FracSec.from!"msecs"(234))); sysTime.add!"years"(-9, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1997, 7, 6, 12, 7, 3), FracSec.from!"msecs"(234))); } { auto sysTime = SysTime(DateTime(1999, 2, 28, 0, 7, 2), FracSec.from!"usecs"(1207)); sysTime.add!"years"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(2000, 2, 28, 0, 7, 2), FracSec.from!"usecs"(1207))); } { auto sysTime = SysTime(DateTime(2000, 2, 29, 0, 7, 2), FracSec.from!"usecs"(1207)); sysTime.add!"years"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 2, 28, 0, 7, 2), FracSec.from!"usecs"(1207))); } //Test B.C. { auto sysTime = SysTime(Date(-1999, 7, 6)); sysTime.add!"years"(-7, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-2006, 7, 6))); sysTime.add!"years"(9, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1997, 7, 6))); } { auto sysTime = SysTime(Date(-1999, 2, 28)); sysTime.add!"years"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-2000, 2, 28))); } { auto sysTime = SysTime(Date(-2000, 2, 29)); sysTime.add!"years"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 2, 28))); } { auto sysTime = SysTime(DateTime(-1999, 7, 6, 12, 7, 3), FracSec.from!"msecs"(234)); sysTime.add!"years"(-7, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-2006, 7, 6, 12, 7, 3), FracSec.from!"msecs"(234))); sysTime.add!"years"(9, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-1997, 7, 6, 12, 7, 3), FracSec.from!"msecs"(234))); } { auto sysTime = SysTime(DateTime(-1999, 2, 28, 3, 3, 3), FracSec.from!"hnsecs"(3)); sysTime.add!"years"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-2000, 2, 28, 3, 3, 3), FracSec.from!"hnsecs"(3))); } { auto sysTime = SysTime(DateTime(-2000, 2, 29, 3, 3, 3), FracSec.from!"hnsecs"(3)); sysTime.add!"years"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-1999, 2, 28, 3, 3, 3), FracSec.from!"hnsecs"(3))); } //Test Both { auto sysTime = SysTime(Date(4, 7, 6)); sysTime.add!"years"(-5, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1, 7, 6))); sysTime.add!"years"(5, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(4, 7, 6))); } { auto sysTime = SysTime(Date(-4, 7, 6)); sysTime.add!"years"(5, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1, 7, 6))); sysTime.add!"years"(-5, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-4, 7, 6))); } { auto sysTime = SysTime(Date(4, 7, 6)); sysTime.add!"years"(-8, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-4, 7, 6))); sysTime.add!"years"(8, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(4, 7, 6))); } { auto sysTime = SysTime(Date(-4, 7, 6)); sysTime.add!"years"(8, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(4, 7, 6))); sysTime.add!"years"(-8, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-4, 7, 6))); } { auto sysTime = SysTime(Date(-4, 2, 29)); sysTime.add!"years"(5, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1, 2, 28))); } { auto sysTime = SysTime(Date(4, 2, 29)); sysTime.add!"years"(-5, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1, 2, 28))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.add!"years"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(0, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); sysTime.add!"years"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.add!"years"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(0, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.add!"years"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } { auto sysTime = SysTime(DateTime(0, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.add!"years"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); sysTime.add!"years"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(0, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(0, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.add!"years"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.add!"years"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(0, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } { auto sysTime = SysTime(DateTime(4, 7, 6, 14, 7, 1), FracSec.from!"usecs"(54329)); sysTime.add!"years"(-5); _assertPred!"=="(sysTime, SysTime(DateTime(-1, 7, 6, 14, 7, 1), FracSec.from!"usecs"(54329))); sysTime.add!"years"(5); _assertPred!"=="(sysTime, SysTime(DateTime(4, 7, 6, 14, 7, 1), FracSec.from!"usecs"(54329))); } { auto sysTime = SysTime(DateTime(4, 7, 6, 14, 7, 1), FracSec.from!"usecs"(54329)); sysTime.add!"years"(-5, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-1, 7, 6, 14, 7, 1), FracSec.from!"usecs"(54329))); sysTime.add!"years"(5, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(4, 7, 6, 14, 7, 1), FracSec.from!"usecs"(54329))); } { auto sysTime = SysTime(DateTime(-4, 7, 6, 14, 7, 1), FracSec.from!"usecs"(54329)); sysTime.add!"years"(5, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1, 7, 6, 14, 7, 1), FracSec.from!"usecs"(54329))); sysTime.add!"years"(-5, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-4, 7, 6, 14, 7, 1), FracSec.from!"usecs"(54329))); } { auto sysTime = SysTime(DateTime(-4, 2, 29, 5, 5, 5), FracSec.from!"msecs"(555)); sysTime.add!"years"(5, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1, 2, 28, 5, 5, 5), FracSec.from!"msecs"(555))); } { auto sysTime = SysTime(DateTime(4, 2, 29, 5, 5, 5), FracSec.from!"msecs"(555)); sysTime.add!"years"(-5, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-1, 2, 28, 5, 5, 5), FracSec.from!"msecs"(555))); } } } //Test add!"months"() with AllowDayOverlow.yes unittest { version(testStdDateTime) { //Test A.D. { auto sysTime = SysTime(Date(1999, 7, 6)); sysTime.add!"months"(3); _assertPred!"=="(sysTime, SysTime(Date(1999, 10, 6))); sysTime.add!"months"(-4); _assertPred!"=="(sysTime, SysTime(Date(1999, 6, 6))); } { auto sysTime = SysTime(Date(1999, 7, 6)); sysTime.add!"months"(6); _assertPred!"=="(sysTime, SysTime(Date(2000, 1, 6))); sysTime.add!"months"(-6); _assertPred!"=="(sysTime, SysTime(Date(1999, 7, 6))); } { auto sysTime = SysTime(Date(1999, 7, 6)); sysTime.add!"months"(27); _assertPred!"=="(sysTime, SysTime(Date(2001, 10, 6))); sysTime.add!"months"(-28); _assertPred!"=="(sysTime, SysTime(Date(1999, 6, 6))); } { auto sysTime = SysTime(Date(1999, 5, 31)); sysTime.add!"months"(1); _assertPred!"=="(sysTime, SysTime(Date(1999, 7, 1))); } { auto sysTime = SysTime(Date(1999, 5, 31)); sysTime.add!"months"(-1); _assertPred!"=="(sysTime, SysTime(Date(1999, 5, 1))); } { auto sysTime = SysTime(Date(1999, 2, 28)); sysTime.add!"months"(12); _assertPred!"=="(sysTime, SysTime(Date(2000, 2, 28))); } { auto sysTime = SysTime(Date(2000, 2, 29)); sysTime.add!"months"(12); _assertPred!"=="(sysTime, SysTime(Date(2001, 3, 1))); } { auto sysTime = SysTime(Date(1999, 7, 31)); sysTime.add!"months"(1); _assertPred!"=="(sysTime, SysTime(Date(1999, 8, 31))); sysTime.add!"months"(1); _assertPred!"=="(sysTime, SysTime(Date(1999, 10, 1))); } { auto sysTime = SysTime(Date(1998, 8, 31)); sysTime.add!"months"(13); _assertPred!"=="(sysTime, SysTime(Date(1999, 10, 1))); sysTime.add!"months"(-13); _assertPred!"=="(sysTime, SysTime(Date(1998, 9, 1))); } { auto sysTime = SysTime(Date(1997, 12, 31)); sysTime.add!"months"(13); _assertPred!"=="(sysTime, SysTime(Date(1999, 1, 31))); sysTime.add!"months"(-13); _assertPred!"=="(sysTime, SysTime(Date(1997, 12, 31))); } { auto sysTime = SysTime(Date(1997, 12, 31)); sysTime.add!"months"(14); _assertPred!"=="(sysTime, SysTime(Date(1999, 3, 3))); sysTime.add!"months"(-14); _assertPred!"=="(sysTime, SysTime(Date(1998, 1, 3))); } { auto sysTime = SysTime(Date(1998, 12, 31)); sysTime.add!"months"(14); _assertPred!"=="(sysTime, SysTime(Date(2000, 3, 2))); sysTime.add!"months"(-14); _assertPred!"=="(sysTime, SysTime(Date(1999, 1, 2))); } { auto sysTime = SysTime(Date(1999, 12, 31)); sysTime.add!"months"(14); _assertPred!"=="(sysTime, SysTime(Date(2001, 3, 3))); sysTime.add!"months"(-14); _assertPred!"=="(sysTime, SysTime(Date(2000, 1, 3))); } { auto sysTime = SysTime(DateTime(1999, 7, 6, 12, 2, 7), FracSec.from!"usecs"(5007)); sysTime.add!"months"(3); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 10, 6, 12, 2, 7), FracSec.from!"usecs"(5007))); sysTime.add!"months"(-4); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 6, 6, 12, 2, 7), FracSec.from!"usecs"(5007))); } { auto sysTime = SysTime(DateTime(1998, 12, 31, 7, 7, 7), FracSec.from!"hnsecs"(422202)); sysTime.add!"months"(14); _assertPred!"=="(sysTime, SysTime(DateTime(2000, 3, 2, 7, 7, 7), FracSec.from!"hnsecs"(422202))); sysTime.add!"months"(-14); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 1, 2, 7, 7, 7), FracSec.from!"hnsecs"(422202))); } { auto sysTime = SysTime(DateTime(1999, 12, 31, 7, 7, 7), FracSec.from!"hnsecs"(422202)); sysTime.add!"months"(14); _assertPred!"=="(sysTime, SysTime(DateTime(2001, 3, 3, 7, 7, 7), FracSec.from!"hnsecs"(422202))); sysTime.add!"months"(-14); _assertPred!"=="(sysTime, SysTime(DateTime(2000, 1, 3, 7, 7, 7), FracSec.from!"hnsecs"(422202))); } //Test B.C. { auto sysTime = SysTime(Date(-1999, 7, 6)); sysTime.add!"months"(3); _assertPred!"=="(sysTime, SysTime(Date(-1999, 10, 6))); sysTime.add!"months"(-4); _assertPred!"=="(sysTime, SysTime(Date(-1999, 6, 6))); } { auto sysTime = SysTime(Date(-1999, 7, 6)); sysTime.add!"months"(6); _assertPred!"=="(sysTime, SysTime(Date(-1998, 1, 6))); sysTime.add!"months"(-6); _assertPred!"=="(sysTime, SysTime(Date(-1999, 7, 6))); } { auto sysTime = SysTime(Date(-1999, 7, 6)); sysTime.add!"months"(-27); _assertPred!"=="(sysTime, SysTime(Date(-2001, 4, 6))); sysTime.add!"months"(28); _assertPred!"=="(sysTime, SysTime(Date(-1999, 8, 6))); } { auto sysTime = SysTime(Date(-1999, 5, 31)); sysTime.add!"months"(1); _assertPred!"=="(sysTime, SysTime(Date(-1999, 7, 1))); } { auto sysTime = SysTime(Date(-1999, 5, 31)); sysTime.add!"months"(-1); _assertPred!"=="(sysTime, SysTime(Date(-1999, 5, 1))); } { auto sysTime = SysTime(Date(-1999, 2, 28)); sysTime.add!"months"(-12); _assertPred!"=="(sysTime, SysTime(Date(-2000, 2, 28))); } { auto sysTime = SysTime(Date(-2000, 2, 29)); sysTime.add!"months"(-12); _assertPred!"=="(sysTime, SysTime(Date(-2001, 3, 1))); } { auto sysTime = SysTime(Date(-1999, 7, 31)); sysTime.add!"months"(1); _assertPred!"=="(sysTime, SysTime(Date(-1999, 8, 31))); sysTime.add!"months"(1); _assertPred!"=="(sysTime, SysTime(Date(-1999, 10, 1))); } { auto sysTime = SysTime(Date(-1998, 8, 31)); sysTime.add!"months"(13); _assertPred!"=="(sysTime, SysTime(Date(-1997, 10, 1))); sysTime.add!"months"(-13); _assertPred!"=="(sysTime, SysTime(Date(-1998, 9, 1))); } { auto sysTime = SysTime(Date(-1997, 12, 31)); sysTime.add!"months"(13); _assertPred!"=="(sysTime, SysTime(Date(-1995, 1, 31))); sysTime.add!"months"(-13); _assertPred!"=="(sysTime, SysTime(Date(-1997, 12, 31))); } { auto sysTime = SysTime(Date(-1997, 12, 31)); sysTime.add!"months"(14); _assertPred!"=="(sysTime, SysTime(Date(-1995, 3, 3))); sysTime.add!"months"(-14); _assertPred!"=="(sysTime, SysTime(Date(-1996, 1, 3))); } { auto sysTime = SysTime(Date(-2002, 12, 31)); sysTime.add!"months"(14); _assertPred!"=="(sysTime, SysTime(Date(-2000, 3, 2))); sysTime.add!"months"(-14); _assertPred!"=="(sysTime, SysTime(Date(-2001, 1, 2))); } { auto sysTime = SysTime(Date(-2001, 12, 31)); sysTime.add!"months"(14); _assertPred!"=="(sysTime, SysTime(Date(-1999, 3, 3))); sysTime.add!"months"(-14); _assertPred!"=="(sysTime, SysTime(Date(-2000, 1, 3))); } { auto sysTime = SysTime(DateTime(-1999, 7, 6, 12, 2, 7), FracSec.from!"usecs"(5007)); sysTime.add!"months"(3); _assertPred!"=="(sysTime, SysTime(DateTime(-1999, 10, 6, 12, 2, 7), FracSec.from!"usecs"(5007))); sysTime.add!"months"(-4); _assertPred!"=="(sysTime, SysTime(DateTime(-1999, 6, 6, 12, 2, 7), FracSec.from!"usecs"(5007))); } { auto sysTime = SysTime(DateTime(-2002, 12, 31, 7, 7, 7), FracSec.from!"hnsecs"(422202)); sysTime.add!"months"(14); _assertPred!"=="(sysTime, SysTime(DateTime(-2000, 3, 2, 7, 7, 7), FracSec.from!"hnsecs"(422202))); sysTime.add!"months"(-14); _assertPred!"=="(sysTime, SysTime(DateTime(-2001, 1, 2, 7, 7, 7), FracSec.from!"hnsecs"(422202))); } { auto sysTime = SysTime(DateTime(-2001, 12, 31, 7, 7, 7), FracSec.from!"hnsecs"(422202)); sysTime.add!"months"(14); _assertPred!"=="(sysTime, SysTime(DateTime(-1999, 3, 3, 7, 7, 7), FracSec.from!"hnsecs"(422202))); sysTime.add!"months"(-14); _assertPred!"=="(sysTime, SysTime(DateTime(-2000, 1, 3, 7, 7, 7), FracSec.from!"hnsecs"(422202))); } //Test Both { auto sysTime = SysTime(Date(1, 1, 1)); sysTime.add!"months"(-1); _assertPred!"=="(sysTime, SysTime(Date(0, 12, 1))); sysTime.add!"months"(1); _assertPred!"=="(sysTime, SysTime(Date(1, 1, 1))); } { auto sysTime = SysTime(Date(4, 1, 1)); sysTime.add!"months"(-48); _assertPred!"=="(sysTime, SysTime(Date(0, 1, 1))); sysTime.add!"months"(48); _assertPred!"=="(sysTime, SysTime(Date(4, 1, 1))); } { auto sysTime = SysTime(Date(4, 3, 31)); sysTime.add!"months"(-49); _assertPred!"=="(sysTime, SysTime(Date(0, 3, 2))); sysTime.add!"months"(49); _assertPred!"=="(sysTime, SysTime(Date(4, 4, 2))); } { auto sysTime = SysTime(Date(4, 3, 31)); sysTime.add!"months"(-85); _assertPred!"=="(sysTime, SysTime(Date(-3, 3, 3))); sysTime.add!"months"(85); _assertPred!"=="(sysTime, SysTime(Date(4, 4, 3))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.add!"months"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); sysTime.add!"months"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.add!"months"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.add!"months"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } { auto sysTime = SysTime(DateTime(0, 12, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.add!"months"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); sysTime.add!"months"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(0, 12, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.add!"months"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.add!"months"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 0, 7, 9), FracSec.from!"hnsecs"(17)); sysTime.add!"months"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 1, 0, 7, 9), FracSec.from!"hnsecs"(17))); sysTime.add!"months"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 7, 9), FracSec.from!"hnsecs"(17))); } { auto sysTime = SysTime(DateTime(4, 3, 31, 12, 11, 10), FracSec.from!"msecs"(9)); sysTime.add!"months"(-85); _assertPred!"=="(sysTime, SysTime(DateTime(-3, 3, 3, 12, 11, 10), FracSec.from!"msecs"(9))); sysTime.add!"months"(85); _assertPred!"=="(sysTime, SysTime(DateTime(4, 4, 3, 12, 11, 10), FracSec.from!"msecs"(9))); } { auto sysTime = SysTime(DateTime(-3, 3, 31, 12, 11, 10), FracSec.from!"msecs"(9)); sysTime.add!"months"(85); _assertPred!"=="(sysTime, SysTime(DateTime(4, 5, 1, 12, 11, 10), FracSec.from!"msecs"(9))); sysTime.add!"months"(-85); _assertPred!"=="(sysTime, SysTime(DateTime(-3, 4, 1, 12, 11, 10), FracSec.from!"msecs"(9))); } const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.add!"months"(4))); //static assert(!__traits(compiles, ist.add!"months"(4))); } } //Test add!"months"() with AllowDayOverlow.no unittest { version(testStdDateTime) { //Test A.D. { auto sysTime = SysTime(Date(1999, 7, 6)); sysTime.add!"months"(3, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 10, 6))); sysTime.add!"months"(-4, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 6, 6))); } { auto sysTime = SysTime(Date(1999, 7, 6)); sysTime.add!"months"(6, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(2000, 1, 6))); sysTime.add!"months"(-6, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 7, 6))); } { auto sysTime = SysTime(Date(1999, 7, 6)); sysTime.add!"months"(27, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(2001, 10, 6))); sysTime.add!"months"(-28, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 6, 6))); } { auto sysTime = SysTime(Date(1999, 5, 31)); sysTime.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 6, 30))); } { auto sysTime = SysTime(Date(1999, 5, 31)); sysTime.add!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 4, 30))); } { auto sysTime = SysTime(Date(1999, 2, 28)); sysTime.add!"months"(12, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(2000, 2, 28))); } { auto sysTime = SysTime(Date(2000, 2, 29)); sysTime.add!"months"(12, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(2001, 2, 28))); } { auto sysTime = SysTime(Date(1999, 7, 31)); sysTime.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 8, 31))); sysTime.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 9, 30))); } { auto sysTime = SysTime(Date(1998, 8, 31)); sysTime.add!"months"(13, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 9, 30))); sysTime.add!"months"(-13, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1998, 8, 30))); } { auto sysTime = SysTime(Date(1997, 12, 31)); sysTime.add!"months"(13, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 1, 31))); sysTime.add!"months"(-13, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1997, 12, 31))); } { auto sysTime = SysTime(Date(1997, 12, 31)); sysTime.add!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 2, 28))); sysTime.add!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1997, 12, 28))); } { auto sysTime = SysTime(Date(1998, 12, 31)); sysTime.add!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(2000, 2, 29))); sysTime.add!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1998, 12, 29))); } { auto sysTime = SysTime(Date(1999, 12, 31)); sysTime.add!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(2001, 2, 28))); sysTime.add!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 12, 28))); } { auto sysTime = SysTime(DateTime(1999, 7, 6, 12, 2, 7), FracSec.from!"usecs"(5007)); sysTime.add!"months"(3, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 10, 6, 12, 2, 7), FracSec.from!"usecs"(5007))); sysTime.add!"months"(-4, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 6, 6, 12, 2, 7), FracSec.from!"usecs"(5007))); } { auto sysTime = SysTime(DateTime(1998, 12, 31, 7, 7, 7), FracSec.from!"hnsecs"(422202)); sysTime.add!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(2000, 2, 29, 7, 7, 7), FracSec.from!"hnsecs"(422202))); sysTime.add!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1998, 12, 29, 7, 7, 7), FracSec.from!"hnsecs"(422202))); } { auto sysTime = SysTime(DateTime(1999, 12, 31, 7, 7, 7), FracSec.from!"hnsecs"(422202)); sysTime.add!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(2001, 2, 28, 7, 7, 7), FracSec.from!"hnsecs"(422202))); sysTime.add!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 12, 28, 7, 7, 7), FracSec.from!"hnsecs"(422202))); } //Test B.C. { auto sysTime = SysTime(Date(-1999, 7, 6)); sysTime.add!"months"(3, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 10, 6))); sysTime.add!"months"(-4, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 6, 6))); } { auto sysTime = SysTime(Date(-1999, 7, 6)); sysTime.add!"months"(6, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1998, 1, 6))); sysTime.add!"months"(-6, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 7, 6))); } { auto sysTime = SysTime(Date(-1999, 7, 6)); sysTime.add!"months"(-27, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-2001, 4, 6))); sysTime.add!"months"(28, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 8, 6))); } { auto sysTime = SysTime(Date(-1999, 5, 31)); sysTime.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 6, 30))); } { auto sysTime = SysTime(Date(-1999, 5, 31)); sysTime.add!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 4, 30))); } { auto sysTime = SysTime(Date(-1999, 2, 28)); sysTime.add!"months"(-12, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-2000, 2, 28))); } { auto sysTime = SysTime(Date(-2000, 2, 29)); sysTime.add!"months"(-12, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-2001, 2, 28))); } { auto sysTime = SysTime(Date(-1999, 7, 31)); sysTime.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 8, 31))); sysTime.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 9, 30))); } { auto sysTime = SysTime(Date(-1998, 8, 31)); sysTime.add!"months"(13, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1997, 9, 30))); sysTime.add!"months"(-13, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1998, 8, 30))); } { auto sysTime = SysTime(Date(-1997, 12, 31)); sysTime.add!"months"(13, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1995, 1, 31))); sysTime.add!"months"(-13, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1997, 12, 31))); } { auto sysTime = SysTime(Date(-1997, 12, 31)); sysTime.add!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1995, 2, 28))); sysTime.add!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1997, 12, 28))); } { auto sysTime = SysTime(Date(-2002, 12, 31)); sysTime.add!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-2000, 2, 29))); sysTime.add!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-2002, 12, 29))); } { auto sysTime = SysTime(Date(-2001, 12, 31)); sysTime.add!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 2, 28))); sysTime.add!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-2001, 12, 28))); } { auto sysTime = SysTime(DateTime(-1999, 7, 6, 12, 2, 7), FracSec.from!"usecs"(5007)); sysTime.add!"months"(3, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-1999, 10, 6, 12, 2, 7), FracSec.from!"usecs"(5007))); sysTime.add!"months"(-4, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-1999, 6, 6, 12, 2, 7), FracSec.from!"usecs"(5007))); } { auto sysTime = SysTime(DateTime(-2002, 12, 31, 7, 7, 7), FracSec.from!"hnsecs"(422202)); sysTime.add!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-2000, 2, 29, 7, 7, 7), FracSec.from!"hnsecs"(422202))); sysTime.add!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-2002, 12, 29, 7, 7, 7), FracSec.from!"hnsecs"(422202))); } { auto sysTime = SysTime(DateTime(-2001, 12, 31, 7, 7, 7), FracSec.from!"hnsecs"(422202)); sysTime.add!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-1999, 2, 28, 7, 7, 7), FracSec.from!"hnsecs"(422202))); sysTime.add!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-2001, 12, 28, 7, 7, 7), FracSec.from!"hnsecs"(422202))); } //Test Both { auto sysTime = SysTime(Date(1, 1, 1)); sysTime.add!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(0, 12, 1))); sysTime.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1, 1, 1))); } { auto sysTime = SysTime(Date(4, 1, 1)); sysTime.add!"months"(-48, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(0, 1, 1))); sysTime.add!"months"(48, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(4, 1, 1))); } { auto sysTime = SysTime(Date(4, 3, 31)); sysTime.add!"months"(-49, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(0, 2, 29))); sysTime.add!"months"(49, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(4, 3, 29))); } { auto sysTime = SysTime(Date(4, 3, 31)); sysTime.add!"months"(-85, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-3, 2, 28))); sysTime.add!"months"(85, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(4, 3, 28))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.add!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); sysTime.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.add!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } { auto sysTime = SysTime(DateTime(0, 12, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); sysTime.add!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(0, 12, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.add!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 0, 7, 9), FracSec.from!"hnsecs"(17)); sysTime.add!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 1, 0, 7, 9), FracSec.from!"hnsecs"(17))); sysTime.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 7, 9), FracSec.from!"hnsecs"(17))); } { auto sysTime = SysTime(DateTime(4, 3, 31, 12, 11, 10), FracSec.from!"msecs"(9)); sysTime.add!"months"(-85, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-3, 2, 28, 12, 11, 10), FracSec.from!"msecs"(9))); sysTime.add!"months"(85, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(4, 3, 28, 12, 11, 10), FracSec.from!"msecs"(9))); } { auto sysTime = SysTime(DateTime(-3, 3, 31, 12, 11, 10), FracSec.from!"msecs"(9)); sysTime.add!"months"(85, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(4, 4, 30, 12, 11, 10), FracSec.from!"msecs"(9))); sysTime.add!"months"(-85, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-3, 3, 30, 12, 11, 10), FracSec.from!"msecs"(9))); } } } /++ Adds the given number of years or months to this $(D SysTime). A negative number will subtract. The difference between rolling and adding is that rolling does not affect larger units. Rolling a $(D SysTime) 12 months gets the exact same $(D SysTime). However, the days can still be affected due to the differing number of days in each month. Because there are no units larger than years, there is no difference between adding and rolling years. Params: units = The type of units to add ("years" or "months"). value = The number of months or years to add to this $(D SysTime). allowOverflow = Whether the days should be allowed to overflow, causing the month to increment. Examples: -------------------- auto st1 = SysTime(DateTime(2010, 1, 1, 12, 33, 33)); st1.roll!"months"(1); assert(st1 == SysTime(DateTime(2010, 2, 1, 12, 33, 33))); auto st2 = SysTime(DateTime(2010, 1, 1, 12, 33, 33)); st2.roll!"months"(-1); assert(st2 == SysTime(DateTime(2010, 12, 1, 12, 33, 33))); auto st3 = SysTime(DateTime(1999, 1, 29, 12, 33, 33)); st3.roll!"months"(1); assert(st3 == SysTime(DateTime(1999, 3, 1, 12, 33, 33))); auto st4 = SysTime(DateTime(1999, 1, 29, 12, 33, 33)); st4.roll!"months"(1, AllowDayOverflow.no); assert(st4 == SysTime(DateTime(1999, 2, 28, 12, 33, 33))); auto st5 = SysTime(DateTime(2000, 2, 29, 12, 30, 33)); st5.roll!"years"(1); assert(st5 == SysTime(DateTime(2001, 3, 1, 12, 30, 33))); auto st6 = SysTime(DateTime(2000, 2, 29, 12, 30, 33)); st6.roll!"years"(1, AllowDayOverflow.no); assert(st6 == SysTime(DateTime(2001, 2, 28, 12, 30, 33))); -------------------- +/ /+ref SysTime+/ void roll(string units)(long value, AllowDayOverflow allowOverflow = AllowDayOverflow.yes) nothrow if(units == "years") { add!"years"(value, allowOverflow); } unittest { version(testStdDateTime) { //Verify Examples. auto st1 = SysTime(DateTime(2010, 1, 1, 12, 33, 33)); st1.roll!"months"(1); assert(st1 == SysTime(DateTime(2010, 2, 1, 12, 33, 33))); auto st2 = SysTime(DateTime(2010, 1, 1, 12, 33, 33)); st2.roll!"months"(-1); assert(st2 == SysTime(DateTime(2010, 12, 1, 12, 33, 33))); auto st3 = SysTime(DateTime(1999, 1, 29, 12, 33, 33)); st3.roll!"months"(1); assert(st3 == SysTime(DateTime(1999, 3, 1, 12, 33, 33))); auto st4 = SysTime(DateTime(1999, 1, 29, 12, 33, 33)); st4.roll!"months"(1, AllowDayOverflow.no); assert(st4 == SysTime(DateTime(1999, 2, 28, 12, 33, 33))); auto st5 = SysTime(DateTime(2000, 2, 29, 12, 30, 33)); st5.roll!"years"(1); assert(st5 == SysTime(DateTime(2001, 3, 1, 12, 30, 33))); auto st6 = SysTime(DateTime(2000, 2, 29, 12, 30, 33)); st6.roll!"years"(1, AllowDayOverflow.no); assert(st6 == SysTime(DateTime(2001, 2, 28, 12, 30, 33))); } } unittest { version(testStdDateTime) { auto st = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, st.roll!"years"(4))); static assert(!__traits(compiles, cst.roll!"years"(4))); //static assert(!__traits(compiles, ist.roll!"years"(4))); } } //Shares documentation with "years" version. /+ref SysTime+/ void roll(string units)(long value, AllowDayOverflow allowOverflow = AllowDayOverflow.yes) nothrow if(units == "months") { auto hnsecs = adjTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs) + 1; if(hnsecs < 0) { hnsecs += convert!("hours", "hnsecs")(24); --days; } auto date = Date(cast(int)days); date.roll!"months"(value, allowOverflow); days = date.dayOfGregorianCal - 1; if(days < 0) { hnsecs -= convert!("hours", "hnsecs")(24); ++days; } immutable newDaysHNSecs = convert!("days", "hnsecs")(days); adjTime = newDaysHNSecs + hnsecs; } //Test roll!"months"() with AllowDayOverlow.yes unittest { version(testStdDateTime) { //Test A.D. { auto sysTime = SysTime(Date(1999, 7, 6)); sysTime.roll!"months"(3); _assertPred!"=="(sysTime, SysTime(Date(1999, 10, 6))); sysTime.roll!"months"(-4); _assertPred!"=="(sysTime, SysTime(Date(1999, 6, 6))); } { auto sysTime = SysTime(Date(1999, 7, 6)); sysTime.roll!"months"(6); _assertPred!"=="(sysTime, SysTime(Date(1999, 1, 6))); sysTime.roll!"months"(-6); _assertPred!"=="(sysTime, SysTime(Date(1999, 7, 6))); } { auto sysTime = SysTime(Date(1999, 7, 6)); sysTime.roll!"months"(27); _assertPred!"=="(sysTime, SysTime(Date(1999, 10, 6))); sysTime.roll!"months"(-28); _assertPred!"=="(sysTime, SysTime(Date(1999, 6, 6))); } { auto sysTime = SysTime(Date(1999, 5, 31)); sysTime.roll!"months"(1); _assertPred!"=="(sysTime, SysTime(Date(1999, 7, 1))); } { auto sysTime = SysTime(Date(1999, 5, 31)); sysTime.roll!"months"(-1); _assertPred!"=="(sysTime, SysTime(Date(1999, 5, 1))); } { auto sysTime = SysTime(Date(1999, 2, 28)); sysTime.roll!"months"(12); _assertPred!"=="(sysTime, SysTime(Date(1999, 2, 28))); } { auto sysTime = SysTime(Date(2000, 2, 29)); sysTime.roll!"months"(12); _assertPred!"=="(sysTime, SysTime(Date(2000, 2, 29))); } { auto sysTime = SysTime(Date(1999, 7, 31)); sysTime.roll!"months"(1); _assertPred!"=="(sysTime, SysTime(Date(1999, 8, 31))); sysTime.roll!"months"(1); _assertPred!"=="(sysTime, SysTime(Date(1999, 10, 1))); } { auto sysTime = SysTime(Date(1998, 8, 31)); sysTime.roll!"months"(13); _assertPred!"=="(sysTime, SysTime(Date(1998, 10, 1))); sysTime.roll!"months"(-13); _assertPred!"=="(sysTime, SysTime(Date(1998, 9, 1))); } { auto sysTime = SysTime(Date(1997, 12, 31)); sysTime.roll!"months"(13); _assertPred!"=="(sysTime, SysTime(Date(1997, 1, 31))); sysTime.roll!"months"(-13); _assertPred!"=="(sysTime, SysTime(Date(1997, 12, 31))); } { auto sysTime = SysTime(Date(1997, 12, 31)); sysTime.roll!"months"(14); _assertPred!"=="(sysTime, SysTime(Date(1997, 3, 3))); sysTime.roll!"months"(-14); _assertPred!"=="(sysTime, SysTime(Date(1997, 1, 3))); } { auto sysTime = SysTime(Date(1998, 12, 31)); sysTime.roll!"months"(14); _assertPred!"=="(sysTime, SysTime(Date(1998, 3, 3))); sysTime.roll!"months"(-14); _assertPred!"=="(sysTime, SysTime(Date(1998, 1, 3))); } { auto sysTime = SysTime(Date(1999, 12, 31)); sysTime.roll!"months"(14); _assertPred!"=="(sysTime, SysTime(Date(1999, 3, 3))); sysTime.roll!"months"(-14); _assertPred!"=="(sysTime, SysTime(Date(1999, 1, 3))); } { auto sysTime = SysTime(DateTime(1999, 7, 6, 12, 2, 7), FracSec.from!"usecs"(5007)); sysTime.roll!"months"(3); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 10, 6, 12, 2, 7), FracSec.from!"usecs"(5007))); sysTime.roll!"months"(-4); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 6, 6, 12, 2, 7), FracSec.from!"usecs"(5007))); } { auto sysTime = SysTime(DateTime(1998, 12, 31, 7, 7, 7), FracSec.from!"hnsecs"(422202)); sysTime.roll!"months"(14); _assertPred!"=="(sysTime, SysTime(DateTime(1998, 3, 3, 7, 7, 7), FracSec.from!"hnsecs"(422202))); sysTime.roll!"months"(-14); _assertPred!"=="(sysTime, SysTime(DateTime(1998, 1, 3, 7, 7, 7), FracSec.from!"hnsecs"(422202))); } { auto sysTime = SysTime(DateTime(1999, 12, 31, 7, 7, 7), FracSec.from!"hnsecs"(422202)); sysTime.roll!"months"(14); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 3, 3, 7, 7, 7), FracSec.from!"hnsecs"(422202))); sysTime.roll!"months"(-14); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 1, 3, 7, 7, 7), FracSec.from!"hnsecs"(422202))); } //Test B.C. { auto sysTime = SysTime(Date(-1999, 7, 6)); sysTime.roll!"months"(3); _assertPred!"=="(sysTime, SysTime(Date(-1999, 10, 6))); sysTime.roll!"months"(-4); _assertPred!"=="(sysTime, SysTime(Date(-1999, 6, 6))); } { auto sysTime = SysTime(Date(-1999, 7, 6)); sysTime.roll!"months"(6); _assertPred!"=="(sysTime, SysTime(Date(-1999, 1, 6))); sysTime.roll!"months"(-6); _assertPred!"=="(sysTime, SysTime(Date(-1999, 7, 6))); } { auto sysTime = SysTime(Date(-1999, 7, 6)); sysTime.roll!"months"(-27); _assertPred!"=="(sysTime, SysTime(Date(-1999, 4, 6))); sysTime.roll!"months"(28); _assertPred!"=="(sysTime, SysTime(Date(-1999, 8, 6))); } { auto sysTime = SysTime(Date(-1999, 5, 31)); sysTime.roll!"months"(1); _assertPred!"=="(sysTime, SysTime(Date(-1999, 7, 1))); } { auto sysTime = SysTime(Date(-1999, 5, 31)); sysTime.roll!"months"(-1); _assertPred!"=="(sysTime, SysTime(Date(-1999, 5, 1))); } { auto sysTime = SysTime(Date(-1999, 2, 28)); sysTime.roll!"months"(-12); _assertPred!"=="(sysTime, SysTime(Date(-1999, 2, 28))); } { auto sysTime = SysTime(Date(-2000, 2, 29)); sysTime.roll!"months"(-12); _assertPred!"=="(sysTime, SysTime(Date(-2000, 2, 29))); } { auto sysTime = SysTime(Date(-1999, 7, 31)); sysTime.roll!"months"(1); _assertPred!"=="(sysTime, SysTime(Date(-1999, 8, 31))); sysTime.roll!"months"(1); _assertPred!"=="(sysTime, SysTime(Date(-1999, 10, 1))); } { auto sysTime = SysTime(Date(-1998, 8, 31)); sysTime.roll!"months"(13); _assertPred!"=="(sysTime, SysTime(Date(-1998, 10, 1))); sysTime.roll!"months"(-13); _assertPred!"=="(sysTime, SysTime(Date(-1998, 9, 1))); } { auto sysTime = SysTime(Date(-1997, 12, 31)); sysTime.roll!"months"(13); _assertPred!"=="(sysTime, SysTime(Date(-1997, 1, 31))); sysTime.roll!"months"(-13); _assertPred!"=="(sysTime, SysTime(Date(-1997, 12, 31))); } { auto sysTime = SysTime(Date(-1997, 12, 31)); sysTime.roll!"months"(14); _assertPred!"=="(sysTime, SysTime(Date(-1997, 3, 3))); sysTime.roll!"months"(-14); _assertPred!"=="(sysTime, SysTime(Date(-1997, 1, 3))); } { auto sysTime = SysTime(Date(-2002, 12, 31)); sysTime.roll!"months"(14); _assertPred!"=="(sysTime, SysTime(Date(-2002, 3, 3))); sysTime.roll!"months"(-14); _assertPred!"=="(sysTime, SysTime(Date(-2002, 1, 3))); } { auto sysTime = SysTime(Date(-2001, 12, 31)); sysTime.roll!"months"(14); _assertPred!"=="(sysTime, SysTime(Date(-2001, 3, 3))); sysTime.roll!"months"(-14); _assertPred!"=="(sysTime, SysTime(Date(-2001, 1, 3))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.roll!"months"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 12, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); sysTime.roll!"months"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.roll!"months"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 12, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.roll!"months"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } { auto sysTime = SysTime(DateTime(0, 12, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.roll!"months"(1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); sysTime.roll!"months"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(0, 12, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.roll!"months"(1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.roll!"months"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } { auto sysTime = SysTime(DateTime(-1999, 7, 6, 12, 2, 7), FracSec.from!"hnsecs"(5007)); sysTime.roll!"months"(3); _assertPred!"=="(sysTime, SysTime(DateTime(-1999, 10, 6, 12, 2, 7), FracSec.from!"hnsecs"(5007))); sysTime.roll!"months"(-4); _assertPred!"=="(sysTime, SysTime(DateTime(-1999, 6, 6, 12, 2, 7), FracSec.from!"hnsecs"(5007))); } { auto sysTime = SysTime(DateTime(-2002, 12, 31, 7, 7, 7), FracSec.from!"hnsecs"(422202)); sysTime.roll!"months"(14); _assertPred!"=="(sysTime, SysTime(DateTime(-2002, 3, 3, 7, 7, 7), FracSec.from!"hnsecs"(422202))); sysTime.roll!"months"(-14); _assertPred!"=="(sysTime, SysTime(DateTime(-2002, 1, 3, 7, 7, 7), FracSec.from!"hnsecs"(422202))); } { auto sysTime = SysTime(DateTime(-2001, 12, 31, 7, 7, 7), FracSec.from!"hnsecs"(422202)); sysTime.roll!"months"(14); _assertPred!"=="(sysTime, SysTime(DateTime(-2001, 3, 3, 7, 7, 7), FracSec.from!"hnsecs"(422202))); sysTime.roll!"months"(-14); _assertPred!"=="(sysTime, SysTime(DateTime(-2001, 1, 3, 7, 7, 7), FracSec.from!"hnsecs"(422202))); } //Test Both { auto sysTime = SysTime(Date(1, 1, 1)); sysTime.roll!"months"(-1); _assertPred!"=="(sysTime, SysTime(Date(1, 12, 1))); sysTime.roll!"months"(1); _assertPred!"=="(sysTime, SysTime(Date(1, 1, 1))); } { auto sysTime = SysTime(Date(4, 1, 1)); sysTime.roll!"months"(-48); _assertPred!"=="(sysTime, SysTime(Date(4, 1, 1))); sysTime.roll!"months"(48); _assertPred!"=="(sysTime, SysTime(Date(4, 1, 1))); } { auto sysTime = SysTime(Date(4, 3, 31)); sysTime.roll!"months"(-49); _assertPred!"=="(sysTime, SysTime(Date(4, 3, 2))); sysTime.roll!"months"(49); _assertPred!"=="(sysTime, SysTime(Date(4, 4, 2))); } { auto sysTime = SysTime(Date(4, 3, 31)); sysTime.roll!"months"(-85); _assertPred!"=="(sysTime, SysTime(Date(4, 3, 2))); sysTime.roll!"months"(85); _assertPred!"=="(sysTime, SysTime(Date(4, 4, 2))); } { auto sysTime = SysTime(Date(-1, 1, 1)); sysTime.roll!"months"(-1); _assertPred!"=="(sysTime, SysTime(Date(-1, 12, 1))); sysTime.roll!"months"(1); _assertPred!"=="(sysTime, SysTime(Date(-1, 1, 1))); } { auto sysTime = SysTime(Date(-4, 1, 1)); sysTime.roll!"months"(-48); _assertPred!"=="(sysTime, SysTime(Date(-4, 1, 1))); sysTime.roll!"months"(48); _assertPred!"=="(sysTime, SysTime(Date(-4, 1, 1))); } { auto sysTime = SysTime(Date(-4, 3, 31)); sysTime.roll!"months"(-49); _assertPred!"=="(sysTime, SysTime(Date(-4, 3, 2))); sysTime.roll!"months"(49); _assertPred!"=="(sysTime, SysTime(Date(-4, 4, 2))); } { auto sysTime = SysTime(Date(-4, 3, 31)); sysTime.roll!"months"(-85); _assertPred!"=="(sysTime, SysTime(Date(-4, 3, 2))); sysTime.roll!"months"(85); _assertPred!"=="(sysTime, SysTime(Date(-4, 4, 2))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 0, 7, 9), FracSec.from!"hnsecs"(17)); sysTime.roll!"months"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 12, 1, 0, 7, 9), FracSec.from!"hnsecs"(17))); sysTime.roll!"months"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 7, 9), FracSec.from!"hnsecs"(17))); } { auto sysTime = SysTime(DateTime(4, 3, 31, 12, 11, 10), FracSec.from!"msecs"(9)); sysTime.roll!"months"(-85); _assertPred!"=="(sysTime, SysTime(DateTime(4, 3, 2, 12, 11, 10), FracSec.from!"msecs"(9))); sysTime.roll!"months"(85); _assertPred!"=="(sysTime, SysTime(DateTime(4, 4, 2, 12, 11, 10), FracSec.from!"msecs"(9))); } { auto sysTime = SysTime(DateTime(-3, 3, 31, 12, 11, 10), FracSec.from!"msecs"(9)); sysTime.roll!"months"(85); _assertPred!"=="(sysTime, SysTime(DateTime(-3, 5, 1, 12, 11, 10), FracSec.from!"msecs"(9))); sysTime.roll!"months"(-85); _assertPred!"=="(sysTime, SysTime(DateTime(-3, 4, 1, 12, 11, 10), FracSec.from!"msecs"(9))); } const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.roll!"months"(4))); //static assert(!__traits(compiles, ist.roll!"months"(4))); //Verify Examples. auto st1 = SysTime(DateTime(2010, 1, 1, 12, 33, 33)); st1.roll!"months"(1); assert(st1 == SysTime(DateTime(2010, 2, 1, 12, 33, 33))); auto st2 = SysTime(DateTime(2010, 1, 1, 12, 33, 33)); st2.roll!"months"(-1); assert(st2 == SysTime(DateTime(2010, 12, 1, 12, 33, 33))); auto st3 = SysTime(DateTime(1999, 1, 29, 12, 33, 33)); st3.roll!"months"(1); assert(st3 == SysTime(DateTime(1999, 3, 1, 12, 33, 33))); auto st4 = SysTime(DateTime(1999, 1, 29, 12, 33, 33)); st4.roll!"months"(1, AllowDayOverflow.no); assert(st4 == SysTime(DateTime(1999, 2, 28, 12, 33, 33))); } } //Test roll!"months"() with AllowDayOverlow.no unittest { version(testStdDateTime) { //Test A.D. { auto sysTime = SysTime(Date(1999, 7, 6)); sysTime.roll!"months"(3, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 10, 6))); sysTime.roll!"months"(-4, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 6, 6))); } { auto sysTime = SysTime(Date(1999, 7, 6)); sysTime.roll!"months"(6, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 1, 6))); sysTime.roll!"months"(-6, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 7, 6))); } { auto sysTime = SysTime(Date(1999, 7, 6)); sysTime.roll!"months"(27, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 10, 6))); sysTime.roll!"months"(-28, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 6, 6))); } { auto sysTime = SysTime(Date(1999, 5, 31)); sysTime.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 6, 30))); } { auto sysTime = SysTime(Date(1999, 5, 31)); sysTime.roll!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 4, 30))); } { auto sysTime = SysTime(Date(1999, 2, 28)); sysTime.roll!"months"(12, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 2, 28))); } { auto sysTime = SysTime(Date(2000, 2, 29)); sysTime.roll!"months"(12, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(2000, 2, 29))); } { auto sysTime = SysTime(Date(1999, 7, 31)); sysTime.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 8, 31))); sysTime.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 9, 30))); } { auto sysTime = SysTime(Date(1998, 8, 31)); sysTime.roll!"months"(13, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1998, 9, 30))); sysTime.roll!"months"(-13, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1998, 8, 30))); } { auto sysTime = SysTime(Date(1997, 12, 31)); sysTime.roll!"months"(13, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1997, 1, 31))); sysTime.roll!"months"(-13, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1997, 12, 31))); } { auto sysTime = SysTime(Date(1997, 12, 31)); sysTime.roll!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1997, 2, 28))); sysTime.roll!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1997, 12, 28))); } { auto sysTime = SysTime(Date(1998, 12, 31)); sysTime.roll!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1998, 2, 28))); sysTime.roll!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1998, 12, 28))); } { auto sysTime = SysTime(Date(1999, 12, 31)); sysTime.roll!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 2, 28))); sysTime.roll!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1999, 12, 28))); } { auto sysTime = SysTime(DateTime(1999, 7, 6, 12, 2, 7), FracSec.from!"usecs"(5007)); sysTime.roll!"months"(3, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 10, 6, 12, 2, 7), FracSec.from!"usecs"(5007))); sysTime.roll!"months"(-4, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 6, 6, 12, 2, 7), FracSec.from!"usecs"(5007))); } { auto sysTime = SysTime(DateTime(1998, 12, 31, 7, 7, 7), FracSec.from!"hnsecs"(422202)); sysTime.roll!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1998, 2, 28, 7, 7, 7), FracSec.from!"hnsecs"(422202))); sysTime.roll!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1998, 12, 28, 7, 7, 7), FracSec.from!"hnsecs"(422202))); } { auto sysTime = SysTime(DateTime(1999, 12, 31, 7, 7, 7), FracSec.from!"hnsecs"(422202)); sysTime.roll!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 2, 28, 7, 7, 7), FracSec.from!"hnsecs"(422202))); sysTime.roll!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 12, 28, 7, 7, 7), FracSec.from!"hnsecs"(422202))); } //Test B.C. { auto sysTime = SysTime(Date(-1999, 7, 6)); sysTime.roll!"months"(3, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 10, 6))); sysTime.roll!"months"(-4, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 6, 6))); } { auto sysTime = SysTime(Date(-1999, 7, 6)); sysTime.roll!"months"(6, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 1, 6))); sysTime.roll!"months"(-6, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 7, 6))); } { auto sysTime = SysTime(Date(-1999, 7, 6)); sysTime.roll!"months"(-27, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 4, 6))); sysTime.roll!"months"(28, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 8, 6))); } { auto sysTime = SysTime(Date(-1999, 5, 31)); sysTime.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 6, 30))); } { auto sysTime = SysTime(Date(-1999, 5, 31)); sysTime.roll!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 4, 30))); } { auto sysTime = SysTime(Date(-1999, 2, 28)); sysTime.roll!"months"(-12, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 2, 28))); } { auto sysTime = SysTime(Date(-2000, 2, 29)); sysTime.roll!"months"(-12, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-2000, 2, 29))); } { auto sysTime = SysTime(Date(-1999, 7, 31)); sysTime.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 8, 31))); sysTime.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1999, 9, 30))); } { auto sysTime = SysTime(Date(-1998, 8, 31)); sysTime.roll!"months"(13, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1998, 9, 30))); sysTime.roll!"months"(-13, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1998, 8, 30))); } { auto sysTime = SysTime(Date(-1997, 12, 31)); sysTime.roll!"months"(13, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1997, 1, 31))); sysTime.roll!"months"(-13, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1997, 12, 31))); } { auto sysTime = SysTime(Date(-1997, 12, 31)); sysTime.roll!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1997, 2, 28))); sysTime.roll!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1997, 12, 28))); } { auto sysTime = SysTime(Date(-2002, 12, 31)); sysTime.roll!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-2002, 2, 28))); sysTime.roll!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-2002, 12, 28))); } { auto sysTime = SysTime(Date(-2001, 12, 31)); sysTime.roll!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-2001, 2, 28))); sysTime.roll!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-2001, 12, 28))); } { auto sysTime = SysTime(DateTime(-1999, 7, 6, 12, 2, 7), FracSec.from!"usecs"(5007)); sysTime.roll!"months"(3, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-1999, 10, 6, 12, 2, 7), FracSec.from!"usecs"(5007))); sysTime.roll!"months"(-4, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-1999, 6, 6, 12, 2, 7), FracSec.from!"usecs"(5007))); } { auto sysTime = SysTime(DateTime(-2002, 12, 31, 7, 7, 7), FracSec.from!"hnsecs"(422202)); sysTime.roll!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-2002, 2, 28, 7, 7, 7), FracSec.from!"hnsecs"(422202))); sysTime.roll!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-2002, 12, 28, 7, 7, 7), FracSec.from!"hnsecs"(422202))); } { auto sysTime = SysTime(DateTime(-2001, 12, 31, 7, 7, 7), FracSec.from!"hnsecs"(422202)); sysTime.roll!"months"(14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-2001, 2, 28, 7, 7, 7), FracSec.from!"hnsecs"(422202))); sysTime.roll!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-2001, 12, 28, 7, 7, 7), FracSec.from!"hnsecs"(422202))); } //Test Both { auto sysTime = SysTime(Date(1, 1, 1)); sysTime.roll!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1, 12, 1))); sysTime.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(1, 1, 1))); } { auto sysTime = SysTime(Date(4, 1, 1)); sysTime.roll!"months"(-48, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(4, 1, 1))); sysTime.roll!"months"(48, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(4, 1, 1))); } { auto sysTime = SysTime(Date(4, 3, 31)); sysTime.roll!"months"(-49, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(4, 2, 29))); sysTime.roll!"months"(49, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(4, 3, 29))); } { auto sysTime = SysTime(Date(4, 3, 31)); sysTime.roll!"months"(-85, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(4, 2, 29))); sysTime.roll!"months"(85, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(4, 3, 29))); } { auto sysTime = SysTime(Date(-1, 1, 1)); sysTime.roll!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1, 12, 1))); sysTime.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-1, 1, 1))); } { auto sysTime = SysTime(Date(-4, 1, 1)); sysTime.roll!"months"(-48, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-4, 1, 1))); sysTime.roll!"months"(48, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-4, 1, 1))); } { auto sysTime = SysTime(Date(-4, 3, 31)); sysTime.roll!"months"(-49, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-4, 2, 29))); sysTime.roll!"months"(49, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-4, 3, 29))); } { auto sysTime = SysTime(Date(-4, 3, 31)); sysTime.roll!"months"(-85, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-4, 2, 29))); sysTime.roll!"months"(85, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(Date(-4, 3, 29))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.roll!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1, 12, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); sysTime.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.roll!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1, 12, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } { auto sysTime = SysTime(DateTime(0, 12, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(0, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); sysTime.roll!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(0, 12, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(0, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.roll!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 0, 7, 9), FracSec.from!"hnsecs"(17)); sysTime.roll!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1, 12, 1, 0, 7, 9), FracSec.from!"hnsecs"(17))); sysTime.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 7, 9), FracSec.from!"hnsecs"(17))); } { auto sysTime = SysTime(DateTime(4, 3, 31, 12, 11, 10), FracSec.from!"msecs"(9)); sysTime.roll!"months"(-85, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(4, 2, 29, 12, 11, 10), FracSec.from!"msecs"(9))); sysTime.roll!"months"(85, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(4, 3, 29, 12, 11, 10), FracSec.from!"msecs"(9))); } { auto sysTime = SysTime(DateTime(-3, 3, 31, 12, 11, 10), FracSec.from!"msecs"(9)); sysTime.roll!"months"(85, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-3, 4, 30, 12, 11, 10), FracSec.from!"msecs"(9))); sysTime.roll!"months"(-85, AllowDayOverflow.no); _assertPred!"=="(sysTime, SysTime(DateTime(-3, 3, 30, 12, 11, 10), FracSec.from!"msecs"(9))); } } } /++ Adds the given number of units to this $(D SysTime). A negative number will subtract. The difference between rolling and adding is that rolling does not affect larger units. For instance, rolling a $(D SysTime) one year's worth of days gets the exact same $(D SysTime). Accepted units are $(D "days"), $(D "minutes"), $(D "hours"), $(D "minutes"), $(D "seconds"), $(D "msecs"), $(D "usecs"), and $(D "hnsecs"). Note that when rolling msecs, usecs or hnsecs, they all add up to a second. So, for example, rolling 1000 msecs is exactly the same as rolling 100,000 usecs. Params: units = The units to add. value = The number of $(D_PARAM units) to add to this $(D SysTime). Examples: -------------------- auto st1 = SysTime(DateTime(2010, 1, 1, 11, 23, 12)); st1.roll!"days"(1); assert(st1 == SysTime(DateTime(2010, 1, 2, 11, 23, 12))); st1.roll!"days"(365); assert(st1 == SysTime(DateTime(2010, 1, 26, 11, 23, 12))); st1.roll!"days"(-32); assert(st1 == SysTime(DateTime(2010, 1, 25, 11, 23, 12))); auto st2 = SysTime(DateTime(2010, 7, 4, 12, 0, 0)); st2.roll!"hours"(1); assert(st2 == SysTime(DateTime(2010, 7, 4, 13, 0, 0))); auto st3 = SysTime(DateTime(2010, 1, 1, 0, 0, 0)); st3.roll!"seconds"(-1); assert(st3 == SysTime(DateTime(2010, 1, 1, 0, 0, 59))); auto st4 = SysTime(DateTime(2010, 1, 1, 0, 0, 0), FracSec.from!"usecs"(2_400)); st4.roll!"usecs"(-1_200_000); assert(st4 == SysTime(DateTime(2010, 1, 1, 0, 0, 0), FracSec.from!"usecs"(802_400))); -------------------- +/ /+ref SysTime+/ void roll(string units)(long value) nothrow if(units == "days") { auto hnsecs = adjTime; auto gdays = splitUnitsFromHNSecs!"days"(hnsecs) + 1; if(hnsecs < 0) { hnsecs += convert!("hours", "hnsecs")(24); --gdays; } auto date = Date(cast(int)gdays); date.roll!"days"(value); gdays = date.dayOfGregorianCal - 1; if(gdays < 0) { hnsecs -= convert!("hours", "hnsecs")(24); ++gdays; } immutable newDaysHNSecs = convert!("days", "hnsecs")(gdays); adjTime = newDaysHNSecs + hnsecs; } //Verify Examples. unittest { version(testStdDateTime) { auto st1 = SysTime(DateTime(2010, 1, 1, 11, 23, 12)); st1.roll!"days"(1); assert(st1 == SysTime(DateTime(2010, 1, 2, 11, 23, 12))); st1.roll!"days"(365); assert(st1 == SysTime(DateTime(2010, 1, 26, 11, 23, 12))); st1.roll!"days"(-32); assert(st1 == SysTime(DateTime(2010, 1, 25, 11, 23, 12))); auto st2 = SysTime(DateTime(2010, 7, 4, 12, 0, 0)); st2.roll!"hours"(1); assert(st2 == SysTime(DateTime(2010, 7, 4, 13, 0, 0))); auto st3 = SysTime(DateTime(2010, 1, 1, 0, 0, 0)); st3.roll!"seconds"(-1); assert(st3 == SysTime(DateTime(2010, 1, 1, 0, 0, 59))); auto st4 = SysTime(DateTime(2010, 1, 1, 0, 0, 0), FracSec.from!"usecs"(2_400)); st4.roll!"usecs"(-1_200_000); assert(st4 == SysTime(DateTime(2010, 1, 1, 0, 0, 0), FracSec.from!"usecs"(802_400))); } } unittest { version(testStdDateTime) { //Test A.D. { auto sysTime = SysTime(Date(1999, 2, 28)); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(Date(1999, 2, 1))); sysTime.roll!"days"(-1); _assertPred!"=="(sysTime, SysTime(Date(1999, 2, 28))); } { auto sysTime = SysTime(Date(2000, 2, 28)); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(Date(2000, 2, 29))); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(Date(2000, 2, 1))); sysTime.roll!"days"(-1); _assertPred!"=="(sysTime, SysTime(Date(2000, 2, 29))); } { auto sysTime = SysTime(Date(1999, 6, 30)); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(Date(1999, 6, 1))); sysTime.roll!"days"(-1); _assertPred!"=="(sysTime, SysTime(Date(1999, 6, 30))); } { auto sysTime = SysTime(Date(1999, 7, 31)); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(Date(1999, 7, 1))); sysTime.roll!"days"(-1); _assertPred!"=="(sysTime, SysTime(Date(1999, 7, 31))); } { auto sysTime = SysTime(Date(1999, 1, 1)); sysTime.roll!"days"(-1); _assertPred!"=="(sysTime, SysTime(Date(1999, 1, 31))); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(Date(1999, 1, 1))); } { auto sysTime = SysTime(Date(1999, 7, 6)); sysTime.roll!"days"(9); _assertPred!"=="(sysTime, SysTime(Date(1999, 7, 15))); sysTime.roll!"days"(-11); _assertPred!"=="(sysTime, SysTime(Date(1999, 7, 4))); sysTime.roll!"days"(30); _assertPred!"=="(sysTime, SysTime(Date(1999, 7, 3))); sysTime.roll!"days"(-3); _assertPred!"=="(sysTime, SysTime(Date(1999, 7, 31))); } { auto sysTime = SysTime(Date(1999, 7, 6)); sysTime.roll!"days"(365); _assertPred!"=="(sysTime, SysTime(Date(1999, 7, 30))); sysTime.roll!"days"(-365); _assertPred!"=="(sysTime, SysTime(Date(1999, 7, 6))); sysTime.roll!"days"(366); _assertPred!"=="(sysTime, SysTime(Date(1999, 7, 31))); sysTime.roll!"days"(730); _assertPred!"=="(sysTime, SysTime(Date(1999, 7, 17))); sysTime.roll!"days"(-1096); _assertPred!"=="(sysTime, SysTime(Date(1999, 7, 6))); } { auto sysTime = SysTime(Date(1999, 2, 6)); sysTime.roll!"days"(365); _assertPred!"=="(sysTime, SysTime(Date(1999, 2, 7))); sysTime.roll!"days"(-365); _assertPred!"=="(sysTime, SysTime(Date(1999, 2, 6))); sysTime.roll!"days"(366); _assertPred!"=="(sysTime, SysTime(Date(1999, 2, 8))); sysTime.roll!"days"(730); _assertPred!"=="(sysTime, SysTime(Date(1999, 2, 10))); sysTime.roll!"days"(-1096); _assertPred!"=="(sysTime, SysTime(Date(1999, 2, 6))); } { auto sysTime = SysTime(DateTime(1999, 2, 28, 7, 9, 2), FracSec.from!"usecs"(234578)); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 2, 1, 7, 9, 2), FracSec.from!"usecs"(234578))); sysTime.roll!"days"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 2, 28, 7, 9, 2), FracSec.from!"usecs"(234578))); } { auto sysTime = SysTime(DateTime(1999, 7, 6, 7, 9, 2), FracSec.from!"usecs"(234578)); sysTime.roll!"days"(9); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 7, 15, 7, 9, 2), FracSec.from!"usecs"(234578))); sysTime.roll!"days"(-11); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 7, 4, 7, 9, 2), FracSec.from!"usecs"(234578))); sysTime.roll!"days"(30); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 7, 3, 7, 9, 2), FracSec.from!"usecs"(234578))); sysTime.roll!"days"(-3); _assertPred!"=="(sysTime, SysTime(DateTime(1999, 7, 31, 7, 9, 2), FracSec.from!"usecs"(234578))); } //Test B.C. { auto sysTime = SysTime(Date(-1999, 2, 28)); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(Date(-1999, 2, 1))); sysTime.roll!"days"(-1); _assertPred!"=="(sysTime, SysTime(Date(-1999, 2, 28))); } { auto sysTime = SysTime(Date(-2000, 2, 28)); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(Date(-2000, 2, 29))); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(Date(-2000, 2, 1))); sysTime.roll!"days"(-1); _assertPred!"=="(sysTime, SysTime(Date(-2000, 2, 29))); } { auto sysTime = SysTime(Date(-1999, 6, 30)); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(Date(-1999, 6, 1))); sysTime.roll!"days"(-1); _assertPred!"=="(sysTime, SysTime(Date(-1999, 6, 30))); } { auto sysTime = SysTime(Date(-1999, 7, 31)); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(Date(-1999, 7, 1))); sysTime.roll!"days"(-1); _assertPred!"=="(sysTime, SysTime(Date(-1999, 7, 31))); } { auto sysTime = SysTime(Date(-1999, 1, 1)); sysTime.roll!"days"(-1); _assertPred!"=="(sysTime, SysTime(Date(-1999, 1, 31))); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(Date(-1999, 1, 1))); } { auto sysTime = SysTime(Date(-1999, 7, 6)); sysTime.roll!"days"(9); _assertPred!"=="(sysTime, SysTime(Date(-1999, 7, 15))); sysTime.roll!"days"(-11); _assertPred!"=="(sysTime, SysTime(Date(-1999, 7, 4))); sysTime.roll!"days"(30); _assertPred!"=="(sysTime, SysTime(Date(-1999, 7, 3))); sysTime.roll!"days"(-3); _assertPred!"=="(sysTime, SysTime(Date(-1999, 7, 31))); } { auto sysTime = SysTime(Date(-1999, 7, 6)); sysTime.roll!"days"(365); _assertPred!"=="(sysTime, SysTime(Date(-1999, 7, 30))); sysTime.roll!"days"(-365); _assertPred!"=="(sysTime, SysTime(Date(-1999, 7, 6))); sysTime.roll!"days"(366); _assertPred!"=="(sysTime, SysTime(Date(-1999, 7, 31))); sysTime.roll!"days"(730); _assertPred!"=="(sysTime, SysTime(Date(-1999, 7, 17))); sysTime.roll!"days"(-1096); _assertPred!"=="(sysTime, SysTime(Date(-1999, 7, 6))); } { auto sysTime = SysTime(DateTime(-1999, 2, 28, 7, 9, 2), FracSec.from!"usecs"(234578)); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(DateTime(-1999, 2, 1, 7, 9, 2), FracSec.from!"usecs"(234578))); sysTime.roll!"days"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(-1999, 2, 28, 7, 9, 2), FracSec.from!"usecs"(234578))); } { auto sysTime = SysTime(DateTime(-1999, 7, 6, 7, 9, 2), FracSec.from!"usecs"(234578)); sysTime.roll!"days"(9); _assertPred!"=="(sysTime, SysTime(DateTime(-1999, 7, 15, 7, 9, 2), FracSec.from!"usecs"(234578))); sysTime.roll!"days"(-11); _assertPred!"=="(sysTime, SysTime(DateTime(-1999, 7, 4, 7, 9, 2), FracSec.from!"usecs"(234578))); sysTime.roll!"days"(30); _assertPred!"=="(sysTime, SysTime(DateTime(-1999, 7, 3, 7, 9, 2), FracSec.from!"usecs"(234578))); sysTime.roll!"days"(-3); } //Test Both { auto sysTime = SysTime(Date(1, 7, 6)); sysTime.roll!"days"(-365); _assertPred!"=="(sysTime, SysTime(Date(1, 7, 13))); sysTime.roll!"days"(365); _assertPred!"=="(sysTime, SysTime(Date(1, 7, 6))); sysTime.roll!"days"(-731); _assertPred!"=="(sysTime, SysTime(Date(1, 7, 19))); sysTime.roll!"days"(730); _assertPred!"=="(sysTime, SysTime(Date(1, 7, 5))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.roll!"days"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 31, 0, 0, 0), FracSec.from!"hnsecs"(0))); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.roll!"days"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } { auto sysTime = SysTime(DateTime(0, 12, 31, 0, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); sysTime.roll!"days"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 31, 0, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.roll!"days"(1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.roll!"days"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } { auto sysTime = SysTime(DateTime(1, 7, 6, 13, 13, 9), FracSec.from!"msecs"(22)); sysTime.roll!"days"(-365); _assertPred!"=="(sysTime, SysTime(DateTime(1, 7, 13, 13, 13, 9), FracSec.from!"msecs"(22))); sysTime.roll!"days"(365); _assertPred!"=="(sysTime, SysTime(DateTime(1, 7, 6, 13, 13, 9), FracSec.from!"msecs"(22))); sysTime.roll!"days"(-731); _assertPred!"=="(sysTime, SysTime(DateTime(1, 7, 19, 13, 13, 9), FracSec.from!"msecs"(22))); sysTime.roll!"days"(730); _assertPred!"=="(sysTime, SysTime(DateTime(1, 7, 5, 13, 13, 9), FracSec.from!"msecs"(22))); } { auto sysTime = SysTime(DateTime(0, 7, 6, 13, 13, 9), FracSec.from!"msecs"(22)); sysTime.roll!"days"(-365); _assertPred!"=="(sysTime, SysTime(DateTime(0, 7, 13, 13, 13, 9), FracSec.from!"msecs"(22))); sysTime.roll!"days"(365); _assertPred!"=="(sysTime, SysTime(DateTime(0, 7, 6, 13, 13, 9), FracSec.from!"msecs"(22))); sysTime.roll!"days"(-731); _assertPred!"=="(sysTime, SysTime(DateTime(0, 7, 19, 13, 13, 9), FracSec.from!"msecs"(22))); sysTime.roll!"days"(730); _assertPred!"=="(sysTime, SysTime(DateTime(0, 7, 5, 13, 13, 9), FracSec.from!"msecs"(22))); } const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.roll!"days"(4))); //static assert(!__traits(compiles, ist.roll!"days"(4))); //Verify Examples. auto st = SysTime(DateTime(2010, 1, 1, 11, 23, 12)); st.roll!"days"(1); assert(st == SysTime(DateTime(2010, 1, 2, 11, 23, 12))); st.roll!"days"(365); assert(st == SysTime(DateTime(2010, 1, 26, 11, 23, 12))); st.roll!"days"(-32); assert(st == SysTime(DateTime(2010, 1, 25, 11, 23, 12))); } } //Shares documentation with "days" version. /+ref SysTime+/ void roll(string units)(long value) nothrow if(units == "hours" || units == "minutes" || units == "seconds") { try { auto hnsecs = adjTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs) + 1; if(hnsecs < 0) { hnsecs += convert!("hours", "hnsecs")(24); --days; } immutable hour = splitUnitsFromHNSecs!"hours"(hnsecs); immutable minute = splitUnitsFromHNSecs!"minutes"(hnsecs); immutable second = splitUnitsFromHNSecs!"seconds"(hnsecs); auto dateTime = DateTime(Date(cast(int)days), TimeOfDay(cast(int)hour, cast(int)minute, cast(int)second)); dateTime.roll!units(value); --days; hnsecs += convert!("hours", "hnsecs")(dateTime.hour); hnsecs += convert!("minutes", "hnsecs")(dateTime.minute); hnsecs += convert!("seconds", "hnsecs")(dateTime.second); if(days < 0) { hnsecs -= convert!("hours", "hnsecs")(24); ++days; } immutable newDaysHNSecs = convert!("days", "hnsecs")(days); adjTime = newDaysHNSecs + hnsecs; } catch(Exception e) assert(0, "Either DateTime's constructor or TimeOfDay's constructor threw."); } //Test roll!"hours"(). unittest { version(testStdDateTime) { static void TestST(SysTime orig, int hours, in SysTime expected, size_t line = __LINE__) { orig.roll!"hours"(hours); _assertPred!"=="(orig, expected, "", __FILE__, line); } //Test A.D. TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 0, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 1, SysTime(DateTime(1999, 7, 6, 13, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 2, SysTime(DateTime(1999, 7, 6, 14, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 3, SysTime(DateTime(1999, 7, 6, 15, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 4, SysTime(DateTime(1999, 7, 6, 16, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 5, SysTime(DateTime(1999, 7, 6, 17, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 6, SysTime(DateTime(1999, 7, 6, 18, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 7, SysTime(DateTime(1999, 7, 6, 19, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 8, SysTime(DateTime(1999, 7, 6, 20, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 9, SysTime(DateTime(1999, 7, 6, 21, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 10, SysTime(DateTime(1999, 7, 6, 22, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 11, SysTime(DateTime(1999, 7, 6, 23, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 12, SysTime(DateTime(1999, 7, 6, 0, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 13, SysTime(DateTime(1999, 7, 6, 1, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 14, SysTime(DateTime(1999, 7, 6, 2, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 15, SysTime(DateTime(1999, 7, 6, 3, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 16, SysTime(DateTime(1999, 7, 6, 4, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 17, SysTime(DateTime(1999, 7, 6, 5, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 18, SysTime(DateTime(1999, 7, 6, 6, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 19, SysTime(DateTime(1999, 7, 6, 7, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 20, SysTime(DateTime(1999, 7, 6, 8, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 21, SysTime(DateTime(1999, 7, 6, 9, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 22, SysTime(DateTime(1999, 7, 6, 10, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 23, SysTime(DateTime(1999, 7, 6, 11, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 24, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 25, SysTime(DateTime(1999, 7, 6, 13, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 50, SysTime(DateTime(1999, 7, 6, 14, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 10_000, SysTime(DateTime(1999, 7, 6, 4, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -1, SysTime(DateTime(1999, 7, 6, 11, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -2, SysTime(DateTime(1999, 7, 6, 10, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -3, SysTime(DateTime(1999, 7, 6, 9, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -4, SysTime(DateTime(1999, 7, 6, 8, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -5, SysTime(DateTime(1999, 7, 6, 7, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -6, SysTime(DateTime(1999, 7, 6, 6, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -7, SysTime(DateTime(1999, 7, 6, 5, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -8, SysTime(DateTime(1999, 7, 6, 4, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -9, SysTime(DateTime(1999, 7, 6, 3, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -10, SysTime(DateTime(1999, 7, 6, 2, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -11, SysTime(DateTime(1999, 7, 6, 1, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -12, SysTime(DateTime(1999, 7, 6, 0, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -13, SysTime(DateTime(1999, 7, 6, 23, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -14, SysTime(DateTime(1999, 7, 6, 22, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -15, SysTime(DateTime(1999, 7, 6, 21, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -16, SysTime(DateTime(1999, 7, 6, 20, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -17, SysTime(DateTime(1999, 7, 6, 19, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -18, SysTime(DateTime(1999, 7, 6, 18, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -19, SysTime(DateTime(1999, 7, 6, 17, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -20, SysTime(DateTime(1999, 7, 6, 16, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -21, SysTime(DateTime(1999, 7, 6, 15, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -22, SysTime(DateTime(1999, 7, 6, 14, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -23, SysTime(DateTime(1999, 7, 6, 13, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -24, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -25, SysTime(DateTime(1999, 7, 6, 11, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -50, SysTime(DateTime(1999, 7, 6, 10, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -10_000, SysTime(DateTime(1999, 7, 6, 20, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 0, 30, 33), FracSec.from!"msecs"(45)), 1, SysTime(DateTime(1999, 7, 6, 1, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 0, 30, 33), FracSec.from!"msecs"(45)), 0, SysTime(DateTime(1999, 7, 6, 0, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 0, 30, 33), FracSec.from!"msecs"(45)), -1, SysTime(DateTime(1999, 7, 6, 23, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 23, 30, 33), FracSec.from!"msecs"(45)), 1, SysTime(DateTime(1999, 7, 6, 0, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 23, 30, 33), FracSec.from!"msecs"(45)), 0, SysTime(DateTime(1999, 7, 6, 23, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 6, 23, 30, 33), FracSec.from!"msecs"(45)), -1, SysTime(DateTime(1999, 7, 6, 22, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 7, 31, 23, 30, 33), FracSec.from!"msecs"(45)), 1, SysTime(DateTime(1999, 7, 31, 0, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 8, 1, 0, 30, 33), FracSec.from!"msecs"(45)), -1, SysTime(DateTime(1999, 8, 1, 23, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 12, 31, 23, 30, 33), FracSec.from!"msecs"(45)), 1, SysTime(DateTime(1999, 12, 31, 0, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(2000, 1, 1, 0, 30, 33), FracSec.from!"msecs"(45)), -1, SysTime(DateTime(2000, 1, 1, 23, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 2, 28, 23, 30, 33), FracSec.from!"msecs"(45)), 25, SysTime(DateTime(1999, 2, 28, 0, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1999, 3, 2, 0, 30, 33), FracSec.from!"msecs"(45)), -25, SysTime(DateTime(1999, 3, 2, 23, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(2000, 2, 28, 23, 30, 33), FracSec.from!"msecs"(45)), 25, SysTime(DateTime(2000, 2, 28, 0, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(2000, 3, 1, 0, 30, 33), FracSec.from!"msecs"(45)), -25, SysTime(DateTime(2000, 3, 1, 23, 30, 33), FracSec.from!"msecs"(45))); //Test B.C. TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 0, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 1, SysTime(DateTime(-1999, 7, 6, 13, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 2, SysTime(DateTime(-1999, 7, 6, 14, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 3, SysTime(DateTime(-1999, 7, 6, 15, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 4, SysTime(DateTime(-1999, 7, 6, 16, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 5, SysTime(DateTime(-1999, 7, 6, 17, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 6, SysTime(DateTime(-1999, 7, 6, 18, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 7, SysTime(DateTime(-1999, 7, 6, 19, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 8, SysTime(DateTime(-1999, 7, 6, 20, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 9, SysTime(DateTime(-1999, 7, 6, 21, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 10, SysTime(DateTime(-1999, 7, 6, 22, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 11, SysTime(DateTime(-1999, 7, 6, 23, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 12, SysTime(DateTime(-1999, 7, 6, 0, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 13, SysTime(DateTime(-1999, 7, 6, 1, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 14, SysTime(DateTime(-1999, 7, 6, 2, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 15, SysTime(DateTime(-1999, 7, 6, 3, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 16, SysTime(DateTime(-1999, 7, 6, 4, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 17, SysTime(DateTime(-1999, 7, 6, 5, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 18, SysTime(DateTime(-1999, 7, 6, 6, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 19, SysTime(DateTime(-1999, 7, 6, 7, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 20, SysTime(DateTime(-1999, 7, 6, 8, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 21, SysTime(DateTime(-1999, 7, 6, 9, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 22, SysTime(DateTime(-1999, 7, 6, 10, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 23, SysTime(DateTime(-1999, 7, 6, 11, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 24, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 25, SysTime(DateTime(-1999, 7, 6, 13, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 50, SysTime(DateTime(-1999, 7, 6, 14, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), 10_000, SysTime(DateTime(-1999, 7, 6, 4, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -1, SysTime(DateTime(-1999, 7, 6, 11, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -2, SysTime(DateTime(-1999, 7, 6, 10, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -3, SysTime(DateTime(-1999, 7, 6, 9, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -4, SysTime(DateTime(-1999, 7, 6, 8, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -5, SysTime(DateTime(-1999, 7, 6, 7, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -6, SysTime(DateTime(-1999, 7, 6, 6, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -7, SysTime(DateTime(-1999, 7, 6, 5, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -8, SysTime(DateTime(-1999, 7, 6, 4, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -9, SysTime(DateTime(-1999, 7, 6, 3, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -10, SysTime(DateTime(-1999, 7, 6, 2, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -11, SysTime(DateTime(-1999, 7, 6, 1, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -12, SysTime(DateTime(-1999, 7, 6, 0, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -13, SysTime(DateTime(-1999, 7, 6, 23, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -14, SysTime(DateTime(-1999, 7, 6, 22, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -15, SysTime(DateTime(-1999, 7, 6, 21, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -16, SysTime(DateTime(-1999, 7, 6, 20, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -17, SysTime(DateTime(-1999, 7, 6, 19, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -18, SysTime(DateTime(-1999, 7, 6, 18, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -19, SysTime(DateTime(-1999, 7, 6, 17, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -20, SysTime(DateTime(-1999, 7, 6, 16, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -21, SysTime(DateTime(-1999, 7, 6, 15, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -22, SysTime(DateTime(-1999, 7, 6, 14, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -23, SysTime(DateTime(-1999, 7, 6, 13, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -24, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -25, SysTime(DateTime(-1999, 7, 6, 11, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -50, SysTime(DateTime(-1999, 7, 6, 10, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(45)), -10_000, SysTime(DateTime(-1999, 7, 6, 20, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 0, 30, 33), FracSec.from!"msecs"(45)), 1, SysTime(DateTime(-1999, 7, 6, 1, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 0, 30, 33), FracSec.from!"msecs"(45)), 0, SysTime(DateTime(-1999, 7, 6, 0, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 0, 30, 33), FracSec.from!"msecs"(45)), -1, SysTime(DateTime(-1999, 7, 6, 23, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 23, 30, 33), FracSec.from!"msecs"(45)), 1, SysTime(DateTime(-1999, 7, 6, 0, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 23, 30, 33), FracSec.from!"msecs"(45)), 0, SysTime(DateTime(-1999, 7, 6, 23, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 6, 23, 30, 33), FracSec.from!"msecs"(45)), -1, SysTime(DateTime(-1999, 7, 6, 22, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 7, 31, 23, 30, 33), FracSec.from!"msecs"(45)), 1, SysTime(DateTime(-1999, 7, 31, 0, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-1999, 8, 1, 0, 30, 33), FracSec.from!"msecs"(45)), -1, SysTime(DateTime(-1999, 8, 1, 23, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-2001, 12, 31, 23, 30, 33), FracSec.from!"msecs"(45)), 1, SysTime(DateTime(-2001, 12, 31, 0, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-2000, 1, 1, 0, 30, 33), FracSec.from!"msecs"(45)), -1, SysTime(DateTime(-2000, 1, 1, 23, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-2001, 2, 28, 23, 30, 33), FracSec.from!"msecs"(45)), 25, SysTime(DateTime(-2001, 2, 28, 0, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-2001, 3, 2, 0, 30, 33), FracSec.from!"msecs"(45)), -25, SysTime(DateTime(-2001, 3, 2, 23, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-2000, 2, 28, 23, 30, 33), FracSec.from!"msecs"(45)), 25, SysTime(DateTime(-2000, 2, 28, 0, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(-2000, 3, 1, 0, 30, 33), FracSec.from!"msecs"(45)), -25, SysTime(DateTime(-2000, 3, 1, 23, 30, 33), FracSec.from!"msecs"(45))); //Test Both TestST(SysTime(DateTime(-1, 1, 1, 11, 30, 33), FracSec.from!"msecs"(45)), 17_546, SysTime(DateTime(-1, 1, 1, 13, 30, 33), FracSec.from!"msecs"(45))); TestST(SysTime(DateTime(1, 1, 1, 13, 30, 33), FracSec.from!"msecs"(45)), -17_546, SysTime(DateTime(1, 1, 1, 11, 30, 33), FracSec.from!"msecs"(45))); { auto sysTime = SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.roll!"hours"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 23, 0, 0), FracSec.from!"hnsecs"(0))); sysTime.roll!"hours"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 0, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.roll!"hours"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.roll!"hours"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } { auto sysTime = SysTime(DateTime(0, 12, 31, 23, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.roll!"hours"(1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 31, 0, 0, 0), FracSec.from!"hnsecs"(0))); sysTime.roll!"hours"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 31, 23, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.roll!"hours"(1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 31, 0, 59, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.roll!"hours"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.roll!"hours"(4))); //static assert(!__traits(compiles, ist.roll!"hours"(4))); //Verify Examples. auto st1 = SysTime(DateTime(2010, 7, 4, 12, 0, 0)); st1.roll!"hours"(1); assert(st1 == SysTime(DateTime(2010, 7, 4, 13, 0, 0))); auto st2 = SysTime(DateTime(2010, 2, 12, 12, 0, 0)); st2.roll!"hours"(-1); assert(st2 == SysTime(DateTime(2010, 2, 12, 11, 0, 0))); auto st3 = SysTime(DateTime(2009, 12, 31, 0, 0, 0)); st3.roll!"minutes"(1); assert(st3 == SysTime(DateTime(2009, 12, 31, 0, 1, 0))); auto st4 = SysTime(DateTime(2010, 1, 1, 0, 0, 0)); st4.roll!"minutes"(-1); assert(st4 == SysTime(DateTime(2010, 1, 1, 0, 59, 0))); auto st5 = SysTime(DateTime(2009, 12, 31, 0, 0, 0)); st5.roll!"seconds"(1); assert(st5 == SysTime(DateTime(2009, 12, 31, 0, 0, 1))); auto st6 = SysTime(DateTime(2010, 1, 1, 0, 0, 0)); st6.roll!"seconds"(-1); assert(st6 == SysTime(DateTime(2010, 1, 1, 0, 0, 59))); } } //Test roll!"minutes"(). unittest { version(testStdDateTime) { static void TestST(SysTime orig, int minutes, in SysTime expected, size_t line = __LINE__) { orig.roll!"minutes"(minutes); _assertPred!"=="(orig, expected, "", __FILE__, line); } //Test A.D. TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 0, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 1, SysTime(DateTime(1999, 7, 6, 12, 31, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 2, SysTime(DateTime(1999, 7, 6, 12, 32, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 3, SysTime(DateTime(1999, 7, 6, 12, 33, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 4, SysTime(DateTime(1999, 7, 6, 12, 34, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 5, SysTime(DateTime(1999, 7, 6, 12, 35, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 10, SysTime(DateTime(1999, 7, 6, 12, 40, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 15, SysTime(DateTime(1999, 7, 6, 12, 45, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 29, SysTime(DateTime(1999, 7, 6, 12, 59, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 30, SysTime(DateTime(1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 45, SysTime(DateTime(1999, 7, 6, 12, 15, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 60, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 75, SysTime(DateTime(1999, 7, 6, 12, 45, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 90, SysTime(DateTime(1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 100, SysTime(DateTime(1999, 7, 6, 12, 10, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 689, SysTime(DateTime(1999, 7, 6, 12, 59, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 690, SysTime(DateTime(1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 691, SysTime(DateTime(1999, 7, 6, 12, 1, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 960, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 1439, SysTime(DateTime(1999, 7, 6, 12, 29, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 1440, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 1441, SysTime(DateTime(1999, 7, 6, 12, 31, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 2880, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -1, SysTime(DateTime(1999, 7, 6, 12, 29, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -2, SysTime(DateTime(1999, 7, 6, 12, 28, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -3, SysTime(DateTime(1999, 7, 6, 12, 27, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -4, SysTime(DateTime(1999, 7, 6, 12, 26, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -5, SysTime(DateTime(1999, 7, 6, 12, 25, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -10, SysTime(DateTime(1999, 7, 6, 12, 20, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -15, SysTime(DateTime(1999, 7, 6, 12, 15, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -29, SysTime(DateTime(1999, 7, 6, 12, 1, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -30, SysTime(DateTime(1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -45, SysTime(DateTime(1999, 7, 6, 12, 45, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -60, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -75, SysTime(DateTime(1999, 7, 6, 12, 15, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -90, SysTime(DateTime(1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -100, SysTime(DateTime(1999, 7, 6, 12, 50, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -749, SysTime(DateTime(1999, 7, 6, 12, 1, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -750, SysTime(DateTime(1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -751, SysTime(DateTime(1999, 7, 6, 12, 59, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -960, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -1439, SysTime(DateTime(1999, 7, 6, 12, 31, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -1440, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -1441, SysTime(DateTime(1999, 7, 6, 12, 29, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -2880, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203)), 1, SysTime(DateTime(1999, 7, 6, 12, 1, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203)), 0, SysTime(DateTime(1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203)), -1, SysTime(DateTime(1999, 7, 6, 12, 59, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 11, 59, 33), FracSec.from!"usecs"(7203)), 1, SysTime(DateTime(1999, 7, 6, 11, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 11, 59, 33), FracSec.from!"usecs"(7203)), 0, SysTime(DateTime(1999, 7, 6, 11, 59, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 11, 59, 33), FracSec.from!"usecs"(7203)), -1, SysTime(DateTime(1999, 7, 6, 11, 58, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 0, 0, 33), FracSec.from!"usecs"(7203)), 1, SysTime(DateTime(1999, 7, 6, 0, 1, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 0, 0, 33), FracSec.from!"usecs"(7203)), 0, SysTime(DateTime(1999, 7, 6, 0, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 6, 0, 0, 33), FracSec.from!"usecs"(7203)), -1, SysTime(DateTime(1999, 7, 6, 0, 59, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 5, 23, 59, 33), FracSec.from!"usecs"(7203)), 1, SysTime(DateTime(1999, 7, 5, 23, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 5, 23, 59, 33), FracSec.from!"usecs"(7203)), 0, SysTime(DateTime(1999, 7, 5, 23, 59, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1999, 7, 5, 23, 59, 33), FracSec.from!"usecs"(7203)), -1, SysTime(DateTime(1999, 7, 5, 23, 58, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1998, 12, 31, 23, 59, 33), FracSec.from!"usecs"(7203)), 1, SysTime(DateTime(1998, 12, 31, 23, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1998, 12, 31, 23, 59, 33), FracSec.from!"usecs"(7203)), 0, SysTime(DateTime(1998, 12, 31, 23, 59, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1998, 12, 31, 23, 59, 33), FracSec.from!"usecs"(7203)), -1, SysTime(DateTime(1998, 12, 31, 23, 58, 33), FracSec.from!"usecs"(7203))); //Test B.C. TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 0, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 1, SysTime(DateTime(-1999, 7, 6, 12, 31, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 2, SysTime(DateTime(-1999, 7, 6, 12, 32, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 3, SysTime(DateTime(-1999, 7, 6, 12, 33, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 4, SysTime(DateTime(-1999, 7, 6, 12, 34, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 5, SysTime(DateTime(-1999, 7, 6, 12, 35, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 10, SysTime(DateTime(-1999, 7, 6, 12, 40, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 15, SysTime(DateTime(-1999, 7, 6, 12, 45, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 29, SysTime(DateTime(-1999, 7, 6, 12, 59, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 30, SysTime(DateTime(-1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 45, SysTime(DateTime(-1999, 7, 6, 12, 15, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 60, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 75, SysTime(DateTime(-1999, 7, 6, 12, 45, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 90, SysTime(DateTime(-1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 100, SysTime(DateTime(-1999, 7, 6, 12, 10, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 689, SysTime(DateTime(-1999, 7, 6, 12, 59, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 690, SysTime(DateTime(-1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 691, SysTime(DateTime(-1999, 7, 6, 12, 1, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 960, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 1439, SysTime(DateTime(-1999, 7, 6, 12, 29, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 1440, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 1441, SysTime(DateTime(-1999, 7, 6, 12, 31, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), 2880, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -1, SysTime(DateTime(-1999, 7, 6, 12, 29, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -2, SysTime(DateTime(-1999, 7, 6, 12, 28, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -3, SysTime(DateTime(-1999, 7, 6, 12, 27, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -4, SysTime(DateTime(-1999, 7, 6, 12, 26, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -5, SysTime(DateTime(-1999, 7, 6, 12, 25, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -10, SysTime(DateTime(-1999, 7, 6, 12, 20, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -15, SysTime(DateTime(-1999, 7, 6, 12, 15, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -29, SysTime(DateTime(-1999, 7, 6, 12, 1, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -30, SysTime(DateTime(-1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -45, SysTime(DateTime(-1999, 7, 6, 12, 45, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -60, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -75, SysTime(DateTime(-1999, 7, 6, 12, 15, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -90, SysTime(DateTime(-1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -100, SysTime(DateTime(-1999, 7, 6, 12, 50, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -749, SysTime(DateTime(-1999, 7, 6, 12, 1, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -750, SysTime(DateTime(-1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -751, SysTime(DateTime(-1999, 7, 6, 12, 59, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -960, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -1439, SysTime(DateTime(-1999, 7, 6, 12, 31, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -1440, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -1441, SysTime(DateTime(-1999, 7, 6, 12, 29, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203)), -2880, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203)), 1, SysTime(DateTime(-1999, 7, 6, 12, 1, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203)), 0, SysTime(DateTime(-1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 0, 33), FracSec.from!"usecs"(7203)), -1, SysTime(DateTime(-1999, 7, 6, 12, 59, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 11, 59, 33), FracSec.from!"usecs"(7203)), 1, SysTime(DateTime(-1999, 7, 6, 11, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 11, 59, 33), FracSec.from!"usecs"(7203)), 0, SysTime(DateTime(-1999, 7, 6, 11, 59, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 11, 59, 33), FracSec.from!"usecs"(7203)), -1, SysTime(DateTime(-1999, 7, 6, 11, 58, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 0, 0, 33), FracSec.from!"usecs"(7203)), 1, SysTime(DateTime(-1999, 7, 6, 0, 1, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 0, 0, 33), FracSec.from!"usecs"(7203)), 0, SysTime(DateTime(-1999, 7, 6, 0, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 6, 0, 0, 33), FracSec.from!"usecs"(7203)), -1, SysTime(DateTime(-1999, 7, 6, 0, 59, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 5, 23, 59, 33), FracSec.from!"usecs"(7203)), 1, SysTime(DateTime(-1999, 7, 5, 23, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 5, 23, 59, 33), FracSec.from!"usecs"(7203)), 0, SysTime(DateTime(-1999, 7, 5, 23, 59, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1999, 7, 5, 23, 59, 33), FracSec.from!"usecs"(7203)), -1, SysTime(DateTime(-1999, 7, 5, 23, 58, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-2000, 12, 31, 23, 59, 33), FracSec.from!"usecs"(7203)), 1, SysTime(DateTime(-2000, 12, 31, 23, 0, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-2000, 12, 31, 23, 59, 33), FracSec.from!"usecs"(7203)), 0, SysTime(DateTime(-2000, 12, 31, 23, 59, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-2000, 12, 31, 23, 59, 33), FracSec.from!"usecs"(7203)), -1, SysTime(DateTime(-2000, 12, 31, 23, 58, 33), FracSec.from!"usecs"(7203))); //Test Both TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0)), -1, SysTime(DateTime(1, 1, 1, 0, 59, 0))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 0)), 1, SysTime(DateTime(0, 12, 31, 23, 0, 0))); TestST(SysTime(DateTime(0, 1, 1, 0, 0, 0)), -1, SysTime(DateTime(0, 1, 1, 0, 59, 0))); TestST(SysTime(DateTime(-1, 12, 31, 23, 59, 0)), 1, SysTime(DateTime(-1, 12, 31, 23, 0, 0))); TestST(SysTime(DateTime(-1, 1, 1, 11, 30, 33), FracSec.from!"usecs"(7203)), 1_052_760, SysTime(DateTime(-1, 1, 1, 11, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1, 1, 1, 13, 30, 33), FracSec.from!"usecs"(7203)), -1_052_760, SysTime(DateTime(1, 1, 1, 13, 30, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(-1, 1, 1, 11, 30, 33), FracSec.from!"usecs"(7203)), 1_052_782, SysTime(DateTime(-1, 1, 1, 11, 52, 33), FracSec.from!"usecs"(7203))); TestST(SysTime(DateTime(1, 1, 1, 13, 52, 33), FracSec.from!"usecs"(7203)), -1_052_782, SysTime(DateTime(1, 1, 1, 13, 30, 33), FracSec.from!"usecs"(7203))); { auto sysTime = SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.roll!"minutes"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 59, 0), FracSec.from!"hnsecs"(0))); sysTime.roll!"minutes"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 0, 0, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.roll!"minutes"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 59, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.roll!"minutes"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 59), FracSec.from!"hnsecs"(9_999_999))); } { auto sysTime = SysTime(DateTime(0, 12, 31, 23, 59, 0), FracSec.from!"hnsecs"(0)); sysTime.roll!"minutes"(1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 31, 23, 0, 0), FracSec.from!"hnsecs"(0))); sysTime.roll!"minutes"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 31, 23, 59, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.roll!"minutes"(1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 31, 23, 0, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.roll!"minutes"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.roll!"minutes"(4))); //static assert(!__traits(compiles, ist.roll!"minutes"(4))); } } //Test roll!"seconds"(). unittest { version(testStdDateTime) { static void TestST(SysTime orig, int seconds, in SysTime expected, size_t line = __LINE__) { orig.roll!"seconds"(seconds); _assertPred!"=="(orig, expected, "", __FILE__, line); } //Test A.D. TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 0, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1, SysTime(DateTime(1999, 7, 6, 12, 30, 34), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 2, SysTime(DateTime(1999, 7, 6, 12, 30, 35), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 3, SysTime(DateTime(1999, 7, 6, 12, 30, 36), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 4, SysTime(DateTime(1999, 7, 6, 12, 30, 37), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 5, SysTime(DateTime(1999, 7, 6, 12, 30, 38), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 10, SysTime(DateTime(1999, 7, 6, 12, 30, 43), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 15, SysTime(DateTime(1999, 7, 6, 12, 30, 48), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 26, SysTime(DateTime(1999, 7, 6, 12, 30, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 27, SysTime(DateTime(1999, 7, 6, 12, 30, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 30, SysTime(DateTime(1999, 7, 6, 12, 30, 3), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 59, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 60, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 61, SysTime(DateTime(1999, 7, 6, 12, 30, 34), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1766, SysTime(DateTime(1999, 7, 6, 12, 30, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1767, SysTime(DateTime(1999, 7, 6, 12, 30, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1768, SysTime(DateTime(1999, 7, 6, 12, 30, 1), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 2007, SysTime(DateTime(1999, 7, 6, 12, 30, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 3599, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 3600, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 3601, SysTime(DateTime(1999, 7, 6, 12, 30, 34), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 7200, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -1, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -2, SysTime(DateTime(1999, 7, 6, 12, 30, 31), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -3, SysTime(DateTime(1999, 7, 6, 12, 30, 30), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -4, SysTime(DateTime(1999, 7, 6, 12, 30, 29), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -5, SysTime(DateTime(1999, 7, 6, 12, 30, 28), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -10, SysTime(DateTime(1999, 7, 6, 12, 30, 23), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -15, SysTime(DateTime(1999, 7, 6, 12, 30, 18), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -33, SysTime(DateTime(1999, 7, 6, 12, 30, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -34, SysTime(DateTime(1999, 7, 6, 12, 30, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -35, SysTime(DateTime(1999, 7, 6, 12, 30, 58), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -59, SysTime(DateTime(1999, 7, 6, 12, 30, 34), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -60, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -61, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 0), FracSec.from!"msecs"(274)), 1, SysTime(DateTime(1999, 7, 6, 12, 30, 1), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 0), FracSec.from!"msecs"(274)), 0, SysTime(DateTime(1999, 7, 6, 12, 30, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 0), FracSec.from!"msecs"(274)), -1, SysTime(DateTime(1999, 7, 6, 12, 30, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 0, 0), FracSec.from!"msecs"(274)), 1, SysTime(DateTime(1999, 7, 6, 12, 0, 1), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 0, 0), FracSec.from!"msecs"(274)), 0, SysTime(DateTime(1999, 7, 6, 12, 0, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 0, 0), FracSec.from!"msecs"(274)), -1, SysTime(DateTime(1999, 7, 6, 12, 0, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 0, 0, 0), FracSec.from!"msecs"(274)), 1, SysTime(DateTime(1999, 7, 6, 0, 0, 1), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 0, 0, 0), FracSec.from!"msecs"(274)), 0, SysTime(DateTime(1999, 7, 6, 0, 0, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 0, 0, 0), FracSec.from!"msecs"(274)), -1, SysTime(DateTime(1999, 7, 6, 0, 0, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 5, 23, 59, 59), FracSec.from!"msecs"(274)), 1, SysTime(DateTime(1999, 7, 5, 23, 59, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 5, 23, 59, 59), FracSec.from!"msecs"(274)), 0, SysTime(DateTime(1999, 7, 5, 23, 59, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 5, 23, 59, 59), FracSec.from!"msecs"(274)), -1, SysTime(DateTime(1999, 7, 5, 23, 59, 58), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1998, 12, 31, 23, 59, 59), FracSec.from!"msecs"(274)), 1, SysTime(DateTime(1998, 12, 31, 23, 59, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1998, 12, 31, 23, 59, 59), FracSec.from!"msecs"(274)), 0, SysTime(DateTime(1998, 12, 31, 23, 59, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1998, 12, 31, 23, 59, 59), FracSec.from!"msecs"(274)), -1, SysTime(DateTime(1998, 12, 31, 23, 59, 58), FracSec.from!"msecs"(274))); //Test B.C. TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 0, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1, SysTime(DateTime(-1999, 7, 6, 12, 30, 34), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 2, SysTime(DateTime(-1999, 7, 6, 12, 30, 35), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 3, SysTime(DateTime(-1999, 7, 6, 12, 30, 36), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 4, SysTime(DateTime(-1999, 7, 6, 12, 30, 37), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 5, SysTime(DateTime(-1999, 7, 6, 12, 30, 38), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 10, SysTime(DateTime(-1999, 7, 6, 12, 30, 43), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 15, SysTime(DateTime(-1999, 7, 6, 12, 30, 48), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 26, SysTime(DateTime(-1999, 7, 6, 12, 30, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 27, SysTime(DateTime(-1999, 7, 6, 12, 30, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 30, SysTime(DateTime(-1999, 7, 6, 12, 30, 3), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 59, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 60, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 61, SysTime(DateTime(-1999, 7, 6, 12, 30, 34), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1766, SysTime(DateTime(-1999, 7, 6, 12, 30, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1767, SysTime(DateTime(-1999, 7, 6, 12, 30, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1768, SysTime(DateTime(-1999, 7, 6, 12, 30, 1), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 2007, SysTime(DateTime(-1999, 7, 6, 12, 30, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 3599, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 3600, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 3601, SysTime(DateTime(-1999, 7, 6, 12, 30, 34), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 7200, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -1, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -2, SysTime(DateTime(-1999, 7, 6, 12, 30, 31), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -3, SysTime(DateTime(-1999, 7, 6, 12, 30, 30), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -4, SysTime(DateTime(-1999, 7, 6, 12, 30, 29), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -5, SysTime(DateTime(-1999, 7, 6, 12, 30, 28), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -10, SysTime(DateTime(-1999, 7, 6, 12, 30, 23), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -15, SysTime(DateTime(-1999, 7, 6, 12, 30, 18), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -33, SysTime(DateTime(-1999, 7, 6, 12, 30, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -34, SysTime(DateTime(-1999, 7, 6, 12, 30, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -35, SysTime(DateTime(-1999, 7, 6, 12, 30, 58), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -59, SysTime(DateTime(-1999, 7, 6, 12, 30, 34), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -60, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -61, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 0), FracSec.from!"msecs"(274)), 1, SysTime(DateTime(-1999, 7, 6, 12, 30, 1), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 0), FracSec.from!"msecs"(274)), 0, SysTime(DateTime(-1999, 7, 6, 12, 30, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 0), FracSec.from!"msecs"(274)), -1, SysTime(DateTime(-1999, 7, 6, 12, 30, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 0, 0), FracSec.from!"msecs"(274)), 1, SysTime(DateTime(-1999, 7, 6, 12, 0, 1), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 0, 0), FracSec.from!"msecs"(274)), 0, SysTime(DateTime(-1999, 7, 6, 12, 0, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 0, 0), FracSec.from!"msecs"(274)), -1, SysTime(DateTime(-1999, 7, 6, 12, 0, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 0, 0, 0), FracSec.from!"msecs"(274)), 1, SysTime(DateTime(-1999, 7, 6, 0, 0, 1), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 0, 0, 0), FracSec.from!"msecs"(274)), 0, SysTime(DateTime(-1999, 7, 6, 0, 0, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 0, 0, 0), FracSec.from!"msecs"(274)), -1, SysTime(DateTime(-1999, 7, 6, 0, 0, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 5, 23, 59, 59), FracSec.from!"msecs"(274)), 1, SysTime(DateTime(-1999, 7, 5, 23, 59, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 5, 23, 59, 59), FracSec.from!"msecs"(274)), 0, SysTime(DateTime(-1999, 7, 5, 23, 59, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 5, 23, 59, 59), FracSec.from!"msecs"(274)), -1, SysTime(DateTime(-1999, 7, 5, 23, 59, 58), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-2000, 12, 31, 23, 59, 59), FracSec.from!"msecs"(274)), 1, SysTime(DateTime(-2000, 12, 31, 23, 59, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-2000, 12, 31, 23, 59, 59), FracSec.from!"msecs"(274)), 0, SysTime(DateTime(-2000, 12, 31, 23, 59, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-2000, 12, 31, 23, 59, 59), FracSec.from!"msecs"(274)), -1, SysTime(DateTime(-2000, 12, 31, 23, 59, 58), FracSec.from!"msecs"(274))); //Test Both TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"msecs"(274)), -1, SysTime(DateTime(1, 1, 1, 0, 0, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"msecs"(274)), 1, SysTime(DateTime(0, 12, 31, 23, 59, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(0, 1, 1, 0, 0, 0), FracSec.from!"msecs"(274)), -1, SysTime(DateTime(0, 1, 1, 0, 0, 59), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1, 12, 31, 23, 59, 59), FracSec.from!"msecs"(274)), 1, SysTime(DateTime(-1, 12, 31, 23, 59, 0), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1, 1, 1, 11, 30, 33), FracSec.from!"msecs"(274)), 63_165_600L, SysTime(DateTime(-1, 1, 1, 11, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1, 1, 1, 13, 30, 33), FracSec.from!"msecs"(274)), -63_165_600L, SysTime(DateTime(1, 1, 1, 13, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1, 1, 1, 11, 30, 33), FracSec.from!"msecs"(274)), 63_165_617L, SysTime(DateTime(-1, 1, 1, 11, 30, 50), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1, 1, 1, 13, 30, 50), FracSec.from!"msecs"(274)), -63_165_617L, SysTime(DateTime(1, 1, 1, 13, 30, 33), FracSec.from!"msecs"(274))); { auto sysTime = SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)); sysTime.roll!"seconds"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 59), FracSec.from!"hnsecs"(0))); sysTime.roll!"seconds"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_999_999)); sysTime.roll!"seconds"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 59), FracSec.from!"hnsecs"(9_999_999))); sysTime.roll!"seconds"(1); _assertPred!"=="(sysTime, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_999_999))); } { auto sysTime = SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(0)); sysTime.roll!"seconds"(1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 31, 23, 59, 0), FracSec.from!"hnsecs"(0))); sysTime.roll!"seconds"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(0))); } { auto sysTime = SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)); sysTime.roll!"seconds"(1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 31, 23, 59, 0), FracSec.from!"hnsecs"(9_999_999))); sysTime.roll!"seconds"(-1); _assertPred!"=="(sysTime, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.roll!"seconds"(4))); //static assert(!__traits(compiles, ist.roll!"seconds"(4))); } } //Shares documentation with "days" version. /+ref SysTime+/ void roll(string units)(long value) nothrow if(units == "msecs" || units == "usecs" || units == "hnsecs") { auto hnsecs = adjTime; immutable days = splitUnitsFromHNSecs!"days"(hnsecs); immutable negative = hnsecs < 0; if(negative) hnsecs += convert!("hours", "hnsecs")(24); immutable seconds = splitUnitsFromHNSecs!"seconds"(hnsecs); hnsecs += convert!(units, "hnsecs")(value); hnsecs %= convert!("seconds", "hnsecs")(1); if(hnsecs < 0) hnsecs += convert!("seconds", "hnsecs")(1); hnsecs += convert!("seconds", "hnsecs")(seconds); if(negative) hnsecs -= convert!("hours", "hnsecs")(24); immutable newDaysHNSecs = convert!("days", "hnsecs")(days); adjTime = newDaysHNSecs + hnsecs; } //Test roll!"msecs"(). unittest { version(testStdDateTime) { static void TestST(SysTime orig, int milliseconds, in SysTime expected, size_t line = __LINE__) { orig.roll!"msecs"(milliseconds); _assertPred!"=="(orig, expected, "", __FILE__, line); } //Test A.D. TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 0, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(275))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 2, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(276))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 10, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(284))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 100, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(374))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 725, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 726, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(0))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1001, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(275))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 2000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 26_725, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 26_726, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(0))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 26_727, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(1))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1_766_725, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1_766_726, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(0))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -1, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(273))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -2, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(272))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -10, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(264))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -100, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(174))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -274, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(0))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -275, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -1000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -1001, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(273))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -2000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -33_274, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(0))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -33_275, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -1_833_274, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(0))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -1_833_275, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(999))); //Test B.C. TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 0, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(275))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 2, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(276))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 10, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(284))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 100, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(374))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 725, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 726, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(0))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1001, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(275))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 2000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 26_725, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 26_726, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(0))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 26_727, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(1))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1_766_725, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), 1_766_726, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(0))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -1, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(273))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -2, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(272))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -10, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(264))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -100, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(174))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -274, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(0))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -275, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -1000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -1001, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(273))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -2000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -33_274, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(0))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -33_275, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -1_833_274, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(0))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(274)), -1_833_275, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(999))); //Test Both TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"msecs"(0)), 1, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"msecs"(1))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"msecs"(0)), 0, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"msecs"(0))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"msecs"(0)), -1, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"msecs"(999))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"msecs"(0)), -2, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"msecs"(998))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"msecs"(0)), -1000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"msecs"(0))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"msecs"(0)), -2000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"msecs"(0))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"msecs"(0)), -2555, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"msecs"(445))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), -1, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_989_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 0, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 1, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(19_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 1000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2555, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(5_549_999))); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.addMSecs(4))); //static assert(!__traits(compiles, ist.addMSecs(4))); } } //Test roll!"usecs"(). unittest { version(testStdDateTime) { static void TestST(SysTime orig, long microseconds, in SysTime expected, size_t line = __LINE__) { orig.roll!"usecs"(microseconds); _assertPred!"=="(orig, expected, "", __FILE__, line); } //Test A.D. TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 0, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 1, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(275))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 2, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(276))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 10, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(284))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 100, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(374))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 725, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 726, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(1000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 1000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(1274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 1001, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(1275))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 2000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(2274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 26_725, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(26_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 26_726, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(27_000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 26_727, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(27_001))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 1_766_725, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(766_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 1_766_726, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(767_000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 1_000_000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 60_000_000L, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 3_600_000_000L, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -1, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(273))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -2, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(272))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -10, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(264))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -100, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(174))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -274, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(0))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -275, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(999_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -1000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(999_274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -1001, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(999_273))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -2000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(998_274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -33_274, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(967_000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -33_275, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(966_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -1_833_274, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(167_000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -1_833_275, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(166_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -1_000_000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -60_000_000L, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -3_600_000_000L, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274))); //Test B.C. TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 0, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 1, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(275))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 2, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(276))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 10, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(284))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 100, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(374))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 725, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 726, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(1000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 1000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(1274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 1001, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(1275))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 2000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(2274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 26_725, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(26_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 26_726, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(27_000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 26_727, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(27_001))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 1_766_725, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(766_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 1_766_726, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(767_000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 1_000_000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 60_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), 3_600_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -1, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(273))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -2, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(272))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -10, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(264))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -100, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(174))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -274, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(0))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -275, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(999_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -1000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(999_274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -1001, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(999_273))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -2000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(998_274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -33_274, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(967_000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -33_275, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(966_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -1_833_274, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(167_000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -1_833_275, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(166_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -1_000_000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -60_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274)), -3_600_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(274))); //Test Both TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(0)), 1, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(1))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(0)), 0, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(0))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(0)), -1, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(999_999))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(0)), -2, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(999_998))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(0)), -1000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(999_000))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(0)), -2000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(998_000))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(0)), -2555, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(997_445))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(0)), -1_000_000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(0))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(0)), -2_000_000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(0))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(0)), -2_333_333, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"usecs"(666_667))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), -1, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_989))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 0, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 1, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(19))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 1000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(19_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2555, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(25_549))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 1_000_000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2_000_000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2_333_333, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(3_333_329))); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.roll!"usecs"(4))); //static assert(!__traits(compiles, ist.roll!"usecs"(4))); } } //Test roll!"hnsecs"(). unittest { version(testStdDateTime) { static void TestST(SysTime orig, long hnsecs, in SysTime expected, size_t line = __LINE__) { orig.roll!"hnsecs"(hnsecs); _assertPred!"=="(orig, expected, "", __FILE__, line); } //Test A.D. TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 0, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(275))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 2, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(276))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 10, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(284))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 100, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(374))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 725, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 726, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1001, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1275))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 2000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_725, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(26_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_726, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(27_000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_727, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(27_001))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_766_725, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_766_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_766_726, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_767_000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_000_000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_000_274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 60_000_000L, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 3_600_000_000L, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 600_000_000L, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 36_000_000_000L, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(273))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -2, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(272))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -10, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(264))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -100, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(174))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -274, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -275, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(9_999_274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1001, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(9_999_273))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -2000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(9_998_274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -33_274, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(9_967_000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -33_275, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(9_966_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_833_274, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(8_167_000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_833_275, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(8_166_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_000_000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(9_000_274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -60_000_000L, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -3_600_000_000L, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -600_000_000L, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -36_000_000_000L, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); //Test B.C. TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 0, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(275))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 2, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(276))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 10, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(284))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 100, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(374))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 725, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 726, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1001, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1275))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 2000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_725, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(26_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_726, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(27_000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_727, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(27_001))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_766_725, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_766_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_766_726, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_767_000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_000_000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_000_274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 60_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 3_600_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 600_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 36_000_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(273))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -2, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(272))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -10, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(264))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -100, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(174))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -274, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -275, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(9_999_274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1001, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(9_999_273))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -2000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(9_998_274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -33_274, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(9_967_000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -33_275, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(9_966_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_833_274, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(8_167_000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_833_275, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(8_166_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_000_000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(9_000_274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -60_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -3_600_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -600_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -36_000_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); //Test Both TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), 1, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), 0, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -1, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -2, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_999_998))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -1000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_999_000))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -2000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_998_000))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -2555, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_997_445))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -1_000_000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_000_000))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -2_000_000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(8_000_000))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -2_333_333, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(7_666_667))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -10_000_000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -20_000_000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -20_888_888, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_111_112))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), -1, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_998))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 0, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 1, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(1))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 1000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(1999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2555, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(2554))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 1_000_000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2_000_000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(1_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2_333_333, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(2_333_332))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 10_000_000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 20_000_000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 20_888_888, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(888_887))); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.roll!"hnsecs"(4))); //static assert(!__traits(compiles, ist.roll!"hnsecs"(4))); } } /++ Gives the result of adding or subtracting a duration from this $(D SysTime). The legal types of arithmetic for $(D SysTime) using this operator are $(BOOKTABLE, $(TR $(TD SysTime) $(TD +) $(TD duration) $(TD -->) $(TD SysTime)) $(TR $(TD SysTime) $(TD -) $(TD duration) $(TD -->) $(TD SysTime)) ) Params: duration = The duration to add to or subtract from this $(D SysTime). +/ SysTime opBinary(string op, D)(in D duration) const pure nothrow if((op == "+" || op == "-") && (is(Unqual!D == Duration) || is(Unqual!D == TickDuration))) { SysTime retval = SysTime(this._stdTime, this._timezone); static if(is(Unqual!D == Duration)) immutable hnsecs = duration.total!"hnsecs"; else static if(is(Unqual!D == TickDuration)) immutable hnsecs = duration.hnsecs; //Ideally, this would just be //retval._stdTime += unaryFun!(op ~ "a")(hnsecs); //But there isn't currently a pure version of unaryFun!(). static if(op == "+") immutable signedHNSecs = hnsecs; else static if(op == "-") immutable signedHNSecs = -hnsecs; else static assert(0); retval._stdTime += signedHNSecs; return retval; } unittest { version(testStdDateTime) { auto st = SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2_345_678)); _assertPred!"=="(st + dur!"weeks"(7), SysTime(DateTime(1999, 8, 24, 12, 30, 33), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st + dur!"weeks"(-7), SysTime(DateTime(1999, 5, 18, 12, 30, 33), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st + dur!"days"(7), SysTime(DateTime(1999, 7, 13, 12, 30, 33), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st + dur!"days"(-7), SysTime(DateTime(1999, 6, 29, 12, 30, 33), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st + dur!"hours"(7), SysTime(DateTime(1999, 7, 6, 19, 30, 33), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st + dur!"hours"(-7), SysTime(DateTime(1999, 7, 6, 5, 30, 33), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st + dur!"minutes"(7), SysTime(DateTime(1999, 7, 6, 12, 37, 33), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st + dur!"minutes"(-7), SysTime(DateTime(1999, 7, 6, 12, 23, 33), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st + dur!"seconds"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 40), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st + dur!"seconds"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 26), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st + dur!"msecs"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2_415_678))); _assertPred!"=="(st + dur!"msecs"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2_275_678))); _assertPred!"=="(st + dur!"usecs"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2_345_748))); _assertPred!"=="(st + dur!"usecs"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2_345_608))); _assertPred!"=="(st + dur!"hnsecs"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2_345_685))); _assertPred!"=="(st + dur!"hnsecs"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2_345_671))); //This probably only runs in cases where gettimeofday() is used, but it's //hard to do this test correctly with variable ticksPerSec. if(TickDuration.ticksPerSec == 1_000_000) { _assertPred!"=="(st + TickDuration.from!"usecs"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2_345_748))); _assertPred!"=="(st + TickDuration.from!"usecs"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2_345_608))); } _assertPred!"=="(st - dur!"weeks"(-7), SysTime(DateTime(1999, 8, 24, 12, 30, 33), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st - dur!"weeks"(7), SysTime(DateTime(1999, 5, 18, 12, 30, 33), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st - dur!"days"(-7), SysTime(DateTime(1999, 7, 13, 12, 30, 33), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st - dur!"days"(7), SysTime(DateTime(1999, 6, 29, 12, 30, 33), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st - dur!"hours"(-7), SysTime(DateTime(1999, 7, 6, 19, 30, 33), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st - dur!"hours"(7), SysTime(DateTime(1999, 7, 6, 5, 30, 33), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st - dur!"minutes"(-7), SysTime(DateTime(1999, 7, 6, 12, 37, 33), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st - dur!"minutes"(7), SysTime(DateTime(1999, 7, 6, 12, 23, 33), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st - dur!"seconds"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 40), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st - dur!"seconds"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 26), FracSec.from!"hnsecs"(2_345_678))); _assertPred!"=="(st - dur!"msecs"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2_415_678))); _assertPred!"=="(st - dur!"msecs"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2_275_678))); _assertPred!"=="(st - dur!"usecs"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2_345_748))); _assertPred!"=="(st - dur!"usecs"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2_345_608))); _assertPred!"=="(st - dur!"hnsecs"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2_345_685))); _assertPred!"=="(st - dur!"hnsecs"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2_345_671))); //This probably only runs in cases where gettimeofday() is used, but it's //hard to do this test correctly with variable ticksPerSec. if(TickDuration.ticksPerSec == 1_000_000) { _assertPred!"=="(st - TickDuration.from!"usecs"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2_345_748))); _assertPred!"=="(st - TickDuration.from!"usecs"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2_345_608))); } static void TestST(in SysTime orig, long hnsecs, in SysTime expected, size_t line = __LINE__) { _assertPred!"=="(orig + dur!"hnsecs"(hnsecs), expected, "", __FILE__, line); } //Test A.D. TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 0, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(275))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 2, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(276))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 10, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(284))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 100, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(374))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 725, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 726, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1001, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1275))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 2000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_725, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(26_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_726, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(27_000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_727, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(27_001))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_766_725, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_766_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_766_726, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_767_000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_000_000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_000_274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 60_000_000L, SysTime(DateTime(1999, 7, 6, 12, 30, 39), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 3_600_000_000L, SysTime(DateTime(1999, 7, 6, 12, 36, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 600_000_000L, SysTime(DateTime(1999, 7, 6, 12, 31, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 36_000_000_000L, SysTime(DateTime(1999, 7, 6, 13, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(273))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -2, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(272))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -10, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(264))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -100, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(174))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -274, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -275, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1000, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_999_274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1001, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_999_273))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -2000, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_998_274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -33_274, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_967_000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -33_275, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_966_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_833_274, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(8_167_000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_833_275, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(8_166_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_000_000, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_000_274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -60_000_000L, SysTime(DateTime(1999, 7, 6, 12, 30, 27), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -3_600_000_000L, SysTime(DateTime(1999, 7, 6, 12, 24, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -600_000_000L, SysTime(DateTime(1999, 7, 6, 12, 29, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -36_000_000_000L, SysTime(DateTime(1999, 7, 6, 11, 30, 33), FracSec.from!"hnsecs"(274))); //Test B.C. TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 0, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(275))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 2, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(276))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 10, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(284))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 100, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(374))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 725, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 726, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1001, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1275))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 2000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_725, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(26_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_726, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(27_000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_727, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(27_001))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_766_725, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_766_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_766_726, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_767_000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_000_000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_000_274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 60_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 30, 39), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 3_600_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 36, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 600_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 31, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 36_000_000_000L, SysTime(DateTime(-1999, 7, 6, 13, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(273))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -2, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(272))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -10, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(264))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -100, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(174))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -274, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -275, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1000, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_999_274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1001, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_999_273))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -2000, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_998_274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -33_274, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_967_000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -33_275, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_966_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_833_274, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(8_167_000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_833_275, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(8_166_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_000_000, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_000_274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -60_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 30, 27), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -3_600_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 24, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -600_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 29, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -36_000_000_000L, SysTime(DateTime(-1999, 7, 6, 11, 30, 33), FracSec.from!"hnsecs"(274))); //Test Both TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), 1, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), 0, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -1, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -2, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_998))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -1000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_000))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -2000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_998_000))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -2555, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_997_445))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -1_000_000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_000_000))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -2_000_000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(8_000_000))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -2_333_333, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(7_666_667))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -10_000_000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -20_000_000, SysTime(DateTime(0, 12, 31, 23, 59, 58), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -20_888_888, SysTime(DateTime(0, 12, 31, 23, 59, 57), FracSec.from!"hnsecs"(9_111_112))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), -1, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_998))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 0, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 1, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 1000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2555, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(2554))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 1_000_000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2_000_000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2_333_333, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(2_333_332))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 10_000_000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 20_000_000, SysTime(DateTime(1, 1, 1, 0, 0, 1), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 20_888_888, SysTime(DateTime(1, 1, 1, 0, 0, 2), FracSec.from!"hnsecs"(888_887))); auto duration = dur!"seconds"(12); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cst + duration)); //static assert(__traits(compiles, ist + duration)); static assert(__traits(compiles, cst - duration)); //static assert(__traits(compiles, ist - duration)); } } /++ Gives the result of adding or subtracting a duration from this $(D SysTime), as well as assigning the result to this $(D SysTime). The legal types of arithmetic for $(D SysTime) using this operator are $(BOOKTABLE, $(TR $(TD SysTime) $(TD +) $(TD duration) $(TD -->) $(TD SysTime)) $(TR $(TD SysTime) $(TD -) $(TD duration) $(TD -->) $(TD SysTime)) ) Params: duration = The duration to add to or subtract from this $(D SysTime). +/ /+ref+/ SysTime opOpAssign(string op, D)(in D duration) pure nothrow if((op == "+" || op == "-") && (is(Unqual!D == Duration) || is(Unqual!D == TickDuration))) { static if(is(Unqual!D == Duration)) auto hnsecs = duration.total!"hnsecs"; else static if(is(Unqual!D == TickDuration)) auto hnsecs = duration.hnsecs; //Ideally, this would just be //_stdTime += unaryFun!(op ~ "a")(hnsecs); //But there isn't currently a pure version of unaryFun!(). static if(op == "+") immutable signedHNSecs = hnsecs; else static if(op == "-") immutable signedHNSecs = -hnsecs; else static assert(0); _stdTime += signedHNSecs; return this; } unittest { version(testStdDateTime) { _assertPred!"+="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"weeks"(7), SysTime(DateTime(1999, 8, 24, 12, 30, 33))); _assertPred!"+="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"weeks"(-7), SysTime(DateTime(1999, 5, 18, 12, 30, 33))); _assertPred!"+="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"days"(7), SysTime(DateTime(1999, 7, 13, 12, 30, 33))); _assertPred!"+="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"days"(-7), SysTime(DateTime(1999, 6, 29, 12, 30, 33))); _assertPred!"+="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"hours"(7), SysTime(DateTime(1999, 7, 6, 19, 30, 33))); _assertPred!"+="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"hours"(-7), SysTime(DateTime(1999, 7, 6, 5, 30, 33))); _assertPred!"+="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"minutes"(7), SysTime(DateTime(1999, 7, 6, 12, 37, 33))); _assertPred!"+="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"minutes"(-7), SysTime(DateTime(1999, 7, 6, 12, 23, 33))); _assertPred!"+="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"seconds"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 40))); _assertPred!"+="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"seconds"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 26))); _assertPred!"+="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"msecs"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(7))); _assertPred!"+="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"msecs"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"msecs"(993))); _assertPred!"+="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"usecs"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7))); _assertPred!"+="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"usecs"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"usecs"(999_993))); _assertPred!"+="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"hnsecs"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(7))); _assertPred!"+="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"hnsecs"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_999_993))); _assertPred!"-="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"weeks"(-7), SysTime(DateTime(1999, 8, 24, 12, 30, 33))); _assertPred!"-="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"weeks"(7), SysTime(DateTime(1999, 5, 18, 12, 30, 33))); _assertPred!"-="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"days"(-7), SysTime(DateTime(1999, 7, 13, 12, 30, 33))); _assertPred!"-="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"days"(7), SysTime(DateTime(1999, 6, 29, 12, 30, 33))); _assertPred!"-="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"hours"(-7), SysTime(DateTime(1999, 7, 6, 19, 30, 33))); _assertPred!"-="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"hours"(7), SysTime(DateTime(1999, 7, 6, 5, 30, 33))); _assertPred!"-="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"minutes"(-7), SysTime(DateTime(1999, 7, 6, 12, 37, 33))); _assertPred!"-="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"minutes"(7), SysTime(DateTime(1999, 7, 6, 12, 23, 33))); _assertPred!"-="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"seconds"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 40))); _assertPred!"-="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"seconds"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 26))); _assertPred!"-="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"msecs"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(7))); _assertPred!"-="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"msecs"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"msecs"(993))); _assertPred!"-="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"usecs"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(7))); _assertPred!"-="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"usecs"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"usecs"(999_993))); _assertPred!"-="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"hnsecs"(-7), SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(7))); _assertPred!"-="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"hnsecs"(7), SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_999_993))); static void TestST(SysTime orig, long hnsecs, in SysTime expected, size_t line = __LINE__) { orig += dur!"hnsecs"(hnsecs); _assertPred!"=="(orig, expected, "", __FILE__, line); } //Test A.D. TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 0, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(275))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 2, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(276))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 10, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(284))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 100, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(374))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 725, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 726, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1001, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1275))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 2000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_725, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(26_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_726, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(27_000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_727, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(27_001))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_766_725, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_766_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_766_726, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_767_000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_000_000, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_000_274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 60_000_000L, SysTime(DateTime(1999, 7, 6, 12, 30, 39), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 3_600_000_000L, SysTime(DateTime(1999, 7, 6, 12, 36, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 600_000_000L, SysTime(DateTime(1999, 7, 6, 12, 31, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 36_000_000_000L, SysTime(DateTime(1999, 7, 6, 13, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(273))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -2, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(272))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -10, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(264))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -100, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(174))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -274, SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -275, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1000, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_999_274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1001, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_999_273))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -2000, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_998_274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -33_274, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_967_000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -33_275, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_966_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_833_274, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(8_167_000))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_833_275, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(8_166_999))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_000_000, SysTime(DateTime(1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_000_274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -60_000_000L, SysTime(DateTime(1999, 7, 6, 12, 30, 27), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -3_600_000_000L, SysTime(DateTime(1999, 7, 6, 12, 24, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -600_000_000L, SysTime(DateTime(1999, 7, 6, 12, 29, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -36_000_000_000L, SysTime(DateTime(1999, 7, 6, 11, 30, 33), FracSec.from!"hnsecs"(274))); //Test B.C. TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 0, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(275))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 2, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(276))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 10, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(284))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 100, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(374))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 725, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 726, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1001, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1275))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 2000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(2274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_725, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(26_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_726, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(27_000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 26_727, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(27_001))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_766_725, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_766_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_766_726, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_767_000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 1_000_000, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_000_274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 60_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 30, 39), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 3_600_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 36, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 600_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 31, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), 36_000_000_000L, SysTime(DateTime(-1999, 7, 6, 13, 30, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(273))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -2, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(272))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -10, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(264))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -100, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(174))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -274, SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -275, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1000, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_999_274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1001, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_999_273))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -2000, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_998_274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -33_274, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_967_000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -33_275, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_966_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_833_274, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(8_167_000))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_833_275, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(8_166_999))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -1_000_000, SysTime(DateTime(-1999, 7, 6, 12, 30, 32), FracSec.from!"hnsecs"(9_000_274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -60_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 30, 27), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -3_600_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 24, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -600_000_000L, SysTime(DateTime(-1999, 7, 6, 12, 29, 33), FracSec.from!"hnsecs"(274))); TestST(SysTime(DateTime(-1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(274)), -36_000_000_000L, SysTime(DateTime(-1999, 7, 6, 11, 30, 33), FracSec.from!"hnsecs"(274))); //Test Both TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), 1, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), 0, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -1, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -2, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_998))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -1000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_000))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -2000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_998_000))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -2555, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_997_445))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -1_000_000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_000_000))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -2_000_000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(8_000_000))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -2_333_333, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(7_666_667))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -10_000_000, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -20_000_000, SysTime(DateTime(0, 12, 31, 23, 59, 58), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), -20_888_888, SysTime(DateTime(0, 12, 31, 23, 59, 57), FracSec.from!"hnsecs"(9_111_112))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), -1, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_998))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 0, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 1, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 1000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2555, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(2554))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 1_000_000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2_000_000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 2_333_333, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(2_333_332))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 10_000_000, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 20_000_000, SysTime(DateTime(1, 1, 1, 0, 0, 1), FracSec.from!"hnsecs"(9_999_999))); TestST(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 20_888_888, SysTime(DateTime(1, 1, 1, 0, 0, 2), FracSec.from!"hnsecs"(888_887))); auto duration = dur!"seconds"(12); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst += duration)); //static assert(!__traits(compiles, ist += duration)); static assert(!__traits(compiles, cst -= duration)); //static assert(!__traits(compiles, ist -= duration)); } } /++ Gives the difference between two $(D SysTime)s. The legal types of arithmetic for $(D SysTime) using this operator are $(BOOKTABLE, $(TR $(TD SysTime) $(TD -) $(TD SysTime) $(TD -->) $(TD duration)) ) +/ Duration opBinary(string op)(in SysTime rhs) const pure nothrow if(op == "-") { return dur!"hnsecs"(_stdTime - rhs._stdTime); } unittest { version(testStdDateTime) { _assertPred!"=="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)) - SysTime(DateTime(1998, 7, 6, 12, 30, 33)), dur!"seconds"(31_536_000)); _assertPred!"=="(SysTime(DateTime(1998, 7, 6, 12, 30, 33)) - SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"seconds"(-31_536_000)); _assertPred!"=="(SysTime(DateTime(1999, 8, 6, 12, 30, 33)) - SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"seconds"(26_78_400)); _assertPred!"=="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)) - SysTime(DateTime(1999, 8, 6, 12, 30, 33)), dur!"seconds"(-26_78_400)); _assertPred!"=="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)) - SysTime(DateTime(1999, 7, 5, 12, 30, 33)), dur!"seconds"(86_400)); _assertPred!"=="(SysTime(DateTime(1999, 7, 5, 12, 30, 33)) - SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"seconds"(-86_400)); _assertPred!"=="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)) - SysTime(DateTime(1999, 7, 6, 11, 30, 33)), dur!"seconds"(3600)); _assertPred!"=="(SysTime(DateTime(1999, 7, 6, 11, 30, 33)) - SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"seconds"(-3600)); _assertPred!"=="(SysTime(DateTime(1999, 7, 6, 12, 31, 33)) - SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"seconds"(60)); _assertPred!"=="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)) - SysTime(DateTime(1999, 7, 6, 12, 31, 33)), dur!"seconds"(-60)); _assertPred!"=="(SysTime(DateTime(1999, 7, 6, 12, 30, 34)) - SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"seconds"(1)); _assertPred!"=="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)) - SysTime(DateTime(1999, 7, 6, 12, 30, 34)), dur!"seconds"(-1)); _assertPred!"=="(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(532)) - SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"msecs"(532)); _assertPred!"=="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)) - SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"msecs"(532)), dur!"msecs"(-532)); _assertPred!"=="(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(333_347)) - SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"usecs"(333_347)); _assertPred!"=="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)) - SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"usecs"(333_347)), dur!"usecs"(-333_347)); _assertPred!"=="(SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_234_567)) - SysTime(DateTime(1999, 7, 6, 12, 30, 33)), dur!"hnsecs"(1_234_567)); _assertPred!"=="(SysTime(DateTime(1999, 7, 6, 12, 30, 33)) - SysTime(DateTime(1999, 7, 6, 12, 30, 33), FracSec.from!"hnsecs"(1_234_567)), dur!"hnsecs"(-1_234_567)); _assertPred!"=="(SysTime(DateTime(1, 1, 1, 12, 30, 33)) - SysTime(DateTime(1, 1, 1, 0, 0, 0)), dur!"seconds"(45033)); _assertPred!"=="(SysTime(DateTime(1, 1, 1, 0, 0, 0)) - SysTime(DateTime(1, 1, 1, 12, 30, 33)), dur!"seconds"(-45033)); _assertPred!"=="(SysTime(DateTime(0, 12, 31, 12, 30, 33)) - SysTime(DateTime(1, 1, 1, 0, 0, 0)), dur!"seconds"(-41367)); _assertPred!"=="(SysTime(DateTime(1, 1, 1, 0, 0, 0)) - SysTime(DateTime(0, 12, 31, 12, 30, 33)), dur!"seconds"(41367)); _assertPred!"=="(SysTime(DateTime(1, 1, 1, 0, 0, 0)) - SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), dur!"hnsecs"(1)); _assertPred!"=="(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)) - SysTime(DateTime(1, 1, 1, 0, 0, 0)), dur!"hnsecs"(-1)); auto tz = TimeZone.getTimeZone("America/Los_Angeles"); _assertPred!"=="(SysTime(DateTime(2011, 1, 13, 8, 17, 2), FracSec.from!"msecs"(296), tz) - SysTime(DateTime(2011, 1, 13, 8, 17, 2), FracSec.from!"msecs"(296), tz), dur!"hnsecs"(0)); _assertPred!"=="(SysTime(DateTime(2011, 1, 13, 8, 17, 2), FracSec.from!"msecs"(296), tz) - SysTime(DateTime(2011, 1, 13, 8, 17, 2), FracSec.from!"msecs"(296), UTC()), dur!"hours"(8)); _assertPred!"=="(SysTime(DateTime(2011, 1, 13, 8, 17, 2), FracSec.from!"msecs"(296), UTC()) - SysTime(DateTime(2011, 1, 13, 8, 17, 2), FracSec.from!"msecs"(296), tz), dur!"hours"(-8)); auto st = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, st - st)); static assert(__traits(compiles, cst - st)); //static assert(__traits(compiles, ist - st)); static assert(__traits(compiles, st - cst)); static assert(__traits(compiles, cst - cst)); //static assert(__traits(compiles, ist - cst)); //static assert(__traits(compiles, st - ist)); //static assert(__traits(compiles, cst - ist)); //static assert(__traits(compiles, ist - ist)); } } /++ Returns the difference between the two $(D SysTime)s in months. To get the difference in years, subtract the year property of two $(D SysTime)s. To get the difference in days or weeks, subtract the $(D SysTime)s themselves and use the $(D Duration) that results. Because converting between months and smaller units requires a specific date (which $(D Duration)s don't have), getting the difference in months requires some math using both the year and month properties, so this is a convenience function for getting the difference in months. Note that the number of days in the months or how far into the month either date is is irrelevant. It is the difference in the month property combined with the difference in years * 12. So, for instance, December 31st and January 1st are one month apart just as December 1st and January 31st are one month apart. Params: rhs = The $(D SysTime) to subtract from this one. Examples: -------------------- assert(SysTime(Date(1999, 2, 1)).diffMonths(SysTime(Date(1999, 1, 31))) == 1); assert(SysTime(Date(1999, 1, 31)).diffMonths(SysTime(Date(1999, 2, 1))) == -1); assert(SysTime(Date(1999, 3, 1)).diffMonths(SysTime(Date(1999, 1, 1))) == 2); assert(SysTime(Date(1999, 1, 1)).diffMonths(SysTime(Date(1999, 3, 31))) == -2); -------------------- +/ int diffMonths(in SysTime rhs) const nothrow { return (cast(Date)this).diffMonths(cast(Date)rhs); } unittest { version(testStdDateTime) { auto st = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, st.diffMonths(st))); static assert(__traits(compiles, cst.diffMonths(st))); //static assert(__traits(compiles, ist.diffMonths(st))); static assert(__traits(compiles, st.diffMonths(cst))); static assert(__traits(compiles, cst.diffMonths(cst))); //static assert(__traits(compiles, ist.diffMonths(cst))); //static assert(__traits(compiles, st.diffMonths(ist))); //static assert(__traits(compiles, cst.diffMonths(ist))); //static assert(__traits(compiles, ist.diffMonths(ist))); //Verify Examples. assert(SysTime(Date(1999, 2, 1)).diffMonths(SysTime(Date(1999, 1, 31))) == 1); assert(SysTime(Date(1999, 1, 31)).diffMonths(SysTime(Date(1999, 2, 1))) == -1); assert(SysTime(Date(1999, 3, 1)).diffMonths(SysTime(Date(1999, 1, 1))) == 2); assert(SysTime(Date(1999, 1, 1)).diffMonths(SysTime(Date(1999, 3, 31))) == -2); } } /++ Whether this $(D SysTime) is in a leap year. +/ @property bool isLeapYear() const nothrow { return (cast(Date)this).isLeapYear; } unittest { version(testStdDateTime) { auto st = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, st.isLeapYear)); static assert(__traits(compiles, cst.isLeapYear)); //static assert(__traits(compiles, ist.isLeapYear)); } } /++ Day of the week this $(D SysTime) is on. +/ @property DayOfWeek dayOfWeek() const nothrow { return getDayOfWeek(dayOfGregorianCal); } unittest { version(testStdDateTime) { auto st = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, st.dayOfWeek)); static assert(__traits(compiles, cst.dayOfWeek)); //static assert(__traits(compiles, ist.dayOfWeek)); } } /++ Day of the year this $(D SysTime) is on. Examples: -------------------- assert(SysTime(DateTime(1999, 1, 1, 12, 22, 7)).dayOfYear == 1); assert(SysTime(DateTime(1999, 12, 31, 7, 2, 59)).dayOfYear == 365); assert(SysTime(DateTime(2000, 12, 31, 21, 20, 0)).dayOfYear == 366); -------------------- +/ @property ushort dayOfYear() const nothrow { return (cast(Date)this).dayOfYear; } unittest { version(testStdDateTime) { auto st = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, st.dayOfYear)); static assert(__traits(compiles, cst.dayOfYear)); //static assert(__traits(compiles, ist.dayOfYear)); //Verify Examples. assert(SysTime(DateTime(1999, 1, 1, 12, 22, 7)).dayOfYear == 1); assert(SysTime(DateTime(1999, 12, 31, 7, 2, 59)).dayOfYear == 365); assert(SysTime(DateTime(2000, 12, 31, 21, 20, 0)).dayOfYear == 366); } } /++ Day of the year. Params: day = The day of the year to set which day of the year this $(D SysTime) is on. +/ @property void dayOfYear(int day) { immutable hnsecs = adjTime; immutable days = convert!("hnsecs", "days")(hnsecs); immutable theRest = hnsecs - convert!("days", "hnsecs")(days); auto date = Date(cast(int)days); date.dayOfYear = day; immutable newDaysHNSecs = convert!("days", "hnsecs")(date.dayOfGregorianCal - 1); adjTime = newDaysHNSecs + theRest; } unittest { version(testStdDateTime) { auto st = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, st.dayOfYear = 12)); static assert(!__traits(compiles, cst.dayOfYear = 12)); //static assert(!__traits(compiles, ist.dayOfYear = 12)); } } /++ The Xth day of the Gregorian Calendar that this $(D SysTime) is on. Examples: -------------------- assert(SysTime(DateTime(1, 1, 1, 0, 0, 0)).dayOfGregorianCal == 1); assert(SysTime(DateTime(1, 12, 31, 23, 59, 59)).dayOfGregorianCal == 365); assert(SysTime(DateTime(2, 1, 1, 2, 2, 2)).dayOfGregorianCal == 366); assert(SysTime(DateTime(0, 12, 31, 7, 7, 7)).dayOfGregorianCal == 0); assert(SysTime(DateTime(0, 1, 1, 19, 30, 0)).dayOfGregorianCal == -365); assert(SysTime(DateTime(-1, 12, 31, 4, 7, 0)).dayOfGregorianCal == -366); assert(SysTime(DateTime(2000, 1, 1, 9, 30, 20)).dayOfGregorianCal == 730_120); assert(SysTime(DateTime(2010, 12, 31, 15, 45, 50)).dayOfGregorianCal == 734_137); -------------------- +/ @property int dayOfGregorianCal() const nothrow { immutable adjustedTime = adjTime; //We have to add one because 0 would be midnight, January 1st, 1 A.D., //which would be the 1st day of the Gregorian Calendar, not the 0th. So, //simply casting to days is one day off. if(adjustedTime > 0) return cast(int)getUnitsFromHNSecs!"days"(adjustedTime) + 1; long hnsecs = adjustedTime; immutable days = cast(int)splitUnitsFromHNSecs!"days"(hnsecs); return hnsecs == 0 ? days + 1 : days; } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal, 1); _assertPred!"=="(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1)).dayOfGregorianCal, 1); _assertPred!"=="(SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal, 1); _assertPred!"=="(SysTime(DateTime(1, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 1); _assertPred!"=="(SysTime(DateTime(1, 1, 2, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 2); _assertPred!"=="(SysTime(DateTime(1, 2, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 32); _assertPred!"=="(SysTime(DateTime(2, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 366); _assertPred!"=="(SysTime(DateTime(3, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 731); _assertPred!"=="(SysTime(DateTime(4, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 1096); _assertPred!"=="(SysTime(DateTime(5, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 1462); _assertPred!"=="(SysTime(DateTime(50, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 17_898); _assertPred!"=="(SysTime(DateTime(97, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 35_065); _assertPred!"=="(SysTime(DateTime(100, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 36_160); _assertPred!"=="(SysTime(DateTime(101, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 36_525); _assertPred!"=="(SysTime(DateTime(105, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 37_986); _assertPred!"=="(SysTime(DateTime(200, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 72_684); _assertPred!"=="(SysTime(DateTime(201, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 73_049); _assertPred!"=="(SysTime(DateTime(300, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 109_208); _assertPred!"=="(SysTime(DateTime(301, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 109_573); _assertPred!"=="(SysTime(DateTime(400, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 145_732); _assertPred!"=="(SysTime(DateTime(401, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 146_098); _assertPred!"=="(SysTime(DateTime(500, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 182_257); _assertPred!"=="(SysTime(DateTime(501, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 182_622); _assertPred!"=="(SysTime(DateTime(1000, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 364_878); _assertPred!"=="(SysTime(DateTime(1001, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 365_243); _assertPred!"=="(SysTime(DateTime(1600, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 584_023); _assertPred!"=="(SysTime(DateTime(1601, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 584_389); _assertPred!"=="(SysTime(DateTime(1900, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 693_596); _assertPred!"=="(SysTime(DateTime(1901, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 693_961); _assertPred!"=="(SysTime(DateTime(1945, 11, 12, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 710_347); _assertPred!"=="(SysTime(DateTime(1999, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 729_755); _assertPred!"=="(SysTime(DateTime(2000, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 730_120); _assertPred!"=="(SysTime(DateTime(2001, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 730_486); _assertPred!"=="(SysTime(DateTime(2010, 1, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 733_773); _assertPred!"=="(SysTime(DateTime(2010, 1, 31, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 733_803); _assertPred!"=="(SysTime(DateTime(2010, 2, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 733_804); _assertPred!"=="(SysTime(DateTime(2010, 2, 28, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 733_831); _assertPred!"=="(SysTime(DateTime(2010, 3, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 733_832); _assertPred!"=="(SysTime(DateTime(2010, 3, 31, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 733_862); _assertPred!"=="(SysTime(DateTime(2010, 4, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 733_863); _assertPred!"=="(SysTime(DateTime(2010, 4, 30, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 733_892); _assertPred!"=="(SysTime(DateTime(2010, 5, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 733_893); _assertPred!"=="(SysTime(DateTime(2010, 5, 31, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 733_923); _assertPred!"=="(SysTime(DateTime(2010, 6, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 733_924); _assertPred!"=="(SysTime(DateTime(2010, 6, 30, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 733_953); _assertPred!"=="(SysTime(DateTime(2010, 7, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 733_954); _assertPred!"=="(SysTime(DateTime(2010, 7, 31, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 733_984); _assertPred!"=="(SysTime(DateTime(2010, 8, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 733_985); _assertPred!"=="(SysTime(DateTime(2010, 8, 31, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 734_015); _assertPred!"=="(SysTime(DateTime(2010, 9, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 734_016); _assertPred!"=="(SysTime(DateTime(2010, 9, 30, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 734_045); _assertPred!"=="(SysTime(DateTime(2010, 10, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 734_046); _assertPred!"=="(SysTime(DateTime(2010, 10, 31, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 734_076); _assertPred!"=="(SysTime(DateTime(2010, 11, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 734_077); _assertPred!"=="(SysTime(DateTime(2010, 11, 30, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 734_106); _assertPred!"=="(SysTime(DateTime(2010, 12, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 734_107); _assertPred!"=="(SysTime(DateTime(2010, 12, 31, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, 734_137); _assertPred!"=="(SysTime(DateTime(2012, 2, 1, 0, 0, 0), FracSec.from!"msecs"(0)).dayOfGregorianCal, 734_534); _assertPred!"=="(SysTime(DateTime(2012, 2, 28, 0, 0, 0), FracSec.from!"msecs"(0)).dayOfGregorianCal, 734_561); _assertPred!"=="(SysTime(DateTime(2012, 2, 29, 0, 0, 0), FracSec.from!"msecs"(0)).dayOfGregorianCal, 734_562); _assertPred!"=="(SysTime(DateTime(2012, 3, 1, 0, 0, 0), FracSec.from!"msecs"(0)).dayOfGregorianCal, 734_563); //Test B.C. _assertPred!"=="(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal, 0); _assertPred!"=="(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_998)).dayOfGregorianCal, 0); _assertPred!"=="(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(0)).dayOfGregorianCal, 0); _assertPred!"=="(SysTime(DateTime(0, 12, 31, 0, 0, 0), FracSec.from!"hnsecs"(1)).dayOfGregorianCal, 0); _assertPred!"=="(SysTime(DateTime(0, 12, 31, 0, 0, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal, 0); _assertPred!"=="(SysTime(DateTime(-1, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal, -366); _assertPred!"=="(SysTime(DateTime(-1, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_998)).dayOfGregorianCal, -366); _assertPred!"=="(SysTime(DateTime(-1, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(0)).dayOfGregorianCal, -366); _assertPred!"=="(SysTime(DateTime(-1, 12, 31, 0, 0, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal, -366); _assertPred!"=="(SysTime(DateTime(0, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, 0); _assertPred!"=="(SysTime(DateTime(0, 12, 30, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -1); _assertPred!"=="(SysTime(DateTime(0, 12, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -30); _assertPred!"=="(SysTime(DateTime(0, 11, 30, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -31); _assertPred!"=="(SysTime(DateTime(-1, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -366); _assertPred!"=="(SysTime(DateTime(-1, 12, 30, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -367); _assertPred!"=="(SysTime(DateTime(-1, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -730); _assertPred!"=="(SysTime(DateTime(-2, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -731); _assertPred!"=="(SysTime(DateTime(-2, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -1095); _assertPred!"=="(SysTime(DateTime(-3, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -1096); _assertPred!"=="(SysTime(DateTime(-3, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -1460); _assertPred!"=="(SysTime(DateTime(-4, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -1461); _assertPred!"=="(SysTime(DateTime(-4, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -1826); _assertPred!"=="(SysTime(DateTime(-5, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -1827); _assertPred!"=="(SysTime(DateTime(-5, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -2191); _assertPred!"=="(SysTime(DateTime(-9, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -3652); _assertPred!"=="(SysTime(DateTime(-49, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -18_262); _assertPred!"=="(SysTime(DateTime(-50, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -18_627); _assertPred!"=="(SysTime(DateTime(-97, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -35_794); _assertPred!"=="(SysTime(DateTime(-99, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -36_160); _assertPred!"=="(SysTime(DateTime(-99, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -36_524); _assertPred!"=="(SysTime(DateTime(-100, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -36_889); _assertPred!"=="(SysTime(DateTime(-101, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -37_254); _assertPred!"=="(SysTime(DateTime(-105, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -38_715); _assertPred!"=="(SysTime(DateTime(-200, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -73_413); _assertPred!"=="(SysTime(DateTime(-201, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -73_778); _assertPred!"=="(SysTime(DateTime(-300, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -109_937); _assertPred!"=="(SysTime(DateTime(-301, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -110_302); _assertPred!"=="(SysTime(DateTime(-400, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -146_097); _assertPred!"=="(SysTime(DateTime(-400, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -146_462); _assertPred!"=="(SysTime(DateTime(-401, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -146_827); _assertPred!"=="(SysTime(DateTime(-499, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -182_621); _assertPred!"=="(SysTime(DateTime(-500, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -182_986); _assertPred!"=="(SysTime(DateTime(-501, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -183_351); _assertPred!"=="(SysTime(DateTime(-1000, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -365_607); _assertPred!"=="(SysTime(DateTime(-1001, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -365_972); _assertPred!"=="(SysTime(DateTime(-1599, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -584_387); _assertPred!"=="(SysTime(DateTime(-1600, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -584_388); _assertPred!"=="(SysTime(DateTime(-1600, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -584_753); _assertPred!"=="(SysTime(DateTime(-1601, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -585_118); _assertPred!"=="(SysTime(DateTime(-1900, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -694_325); _assertPred!"=="(SysTime(DateTime(-1901, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -694_690); _assertPred!"=="(SysTime(DateTime(-1999, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -730_484); _assertPred!"=="(SysTime(DateTime(-2000, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -730_485); _assertPred!"=="(SysTime(DateTime(-2000, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -730_850); _assertPred!"=="(SysTime(DateTime(-2001, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)).dayOfGregorianCal, -731_215); _assertPred!"=="(SysTime(DateTime(-2010, 1, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_502); _assertPred!"=="(SysTime(DateTime(-2010, 1, 31, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_472); _assertPred!"=="(SysTime(DateTime(-2010, 2, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_471); _assertPred!"=="(SysTime(DateTime(-2010, 2, 28, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_444); _assertPred!"=="(SysTime(DateTime(-2010, 3, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_443); _assertPred!"=="(SysTime(DateTime(-2010, 3, 31, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_413); _assertPred!"=="(SysTime(DateTime(-2010, 4, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_412); _assertPred!"=="(SysTime(DateTime(-2010, 4, 30, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_383); _assertPred!"=="(SysTime(DateTime(-2010, 5, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_382); _assertPred!"=="(SysTime(DateTime(-2010, 5, 31, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_352); _assertPred!"=="(SysTime(DateTime(-2010, 6, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_351); _assertPred!"=="(SysTime(DateTime(-2010, 6, 30, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_322); _assertPred!"=="(SysTime(DateTime(-2010, 7, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_321); _assertPred!"=="(SysTime(DateTime(-2010, 7, 31, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_291); _assertPred!"=="(SysTime(DateTime(-2010, 8, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_290); _assertPred!"=="(SysTime(DateTime(-2010, 8, 31, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_260); _assertPred!"=="(SysTime(DateTime(-2010, 9, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_259); _assertPred!"=="(SysTime(DateTime(-2010, 9, 30, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_230); _assertPred!"=="(SysTime(DateTime(-2010, 10, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_229); _assertPred!"=="(SysTime(DateTime(-2010, 10, 31, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_199); _assertPred!"=="(SysTime(DateTime(-2010, 11, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_198); _assertPred!"=="(SysTime(DateTime(-2010, 11, 30, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_169); _assertPred!"=="(SysTime(DateTime(-2010, 12, 1, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_168); _assertPred!"=="(SysTime(DateTime(-2010, 12, 31, 23, 59, 59), FracSec.from!"msecs"(999)).dayOfGregorianCal, -734_138); _assertPred!"=="(SysTime(DateTime(-2012, 2, 1, 0, 0, 0), FracSec.from!"msecs"(0)).dayOfGregorianCal, -735_202); _assertPred!"=="(SysTime(DateTime(-2012, 2, 28, 0, 0, 0), FracSec.from!"msecs"(0)).dayOfGregorianCal, -735_175); _assertPred!"=="(SysTime(DateTime(-2012, 2, 29, 0, 0, 0), FracSec.from!"msecs"(0)).dayOfGregorianCal, -735_174); _assertPred!"=="(SysTime(DateTime(-2012, 3, 1, 0, 0, 0), FracSec.from!"msecs"(0)).dayOfGregorianCal, -735_173); _assertPred!"=="(SysTime(DateTime(-3760, 9, 7, 0, 0, 0), FracSec.from!"msecs"(0)).dayOfGregorianCal, -1_373_427); //Start of Hebrew Calendar const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cst.dayOfGregorianCal)); //static assert(__traits(compiles, ist.dayOfGregorianCal)); //Verify Examples. assert(SysTime(DateTime(1, 1, 1, 0, 0, 0)).dayOfGregorianCal == 1); assert(SysTime(DateTime(1, 12, 31, 23, 59, 59)).dayOfGregorianCal == 365); assert(SysTime(DateTime(2, 1, 1, 2, 2, 2)).dayOfGregorianCal == 366); assert(SysTime(DateTime(0, 12, 31, 7, 7, 7)).dayOfGregorianCal == 0); assert(SysTime(DateTime(0, 1, 1, 19, 30, 0)).dayOfGregorianCal == -365); assert(SysTime(DateTime(-1, 12, 31, 4, 7, 0)).dayOfGregorianCal == -366); assert(SysTime(DateTime(2000, 1, 1, 9, 30, 20)).dayOfGregorianCal == 730_120); assert(SysTime(DateTime(2010, 12, 31, 15, 45, 50)).dayOfGregorianCal == 734_137); } } //Test that the logic for the day of the Gregorian Calendar is consistent //between Date and SysTime. unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(Date(1, 1, 1).dayOfGregorianCal, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(1, 1, 2).dayOfGregorianCal, SysTime(DateTime(1, 1, 2, 0, 0, 0), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(1, 2, 1).dayOfGregorianCal, SysTime(DateTime(1, 2, 1, 0, 0, 0), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(2, 1, 1).dayOfGregorianCal, SysTime(DateTime(2, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(3, 1, 1).dayOfGregorianCal, SysTime(DateTime(3, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(4, 1, 1).dayOfGregorianCal, SysTime(DateTime(4, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(5, 1, 1).dayOfGregorianCal, SysTime(DateTime(5, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(50, 1, 1).dayOfGregorianCal, SysTime(DateTime(50, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(97, 1, 1).dayOfGregorianCal, SysTime(DateTime(97, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(100, 1, 1).dayOfGregorianCal, SysTime(DateTime(100, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(101, 1, 1).dayOfGregorianCal, SysTime(DateTime(101, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(105, 1, 1).dayOfGregorianCal, SysTime(DateTime(105, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(200, 1, 1).dayOfGregorianCal, SysTime(DateTime(200, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(201, 1, 1).dayOfGregorianCal, SysTime(DateTime(201, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(300, 1, 1).dayOfGregorianCal, SysTime(DateTime(300, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(301, 1, 1).dayOfGregorianCal, SysTime(DateTime(301, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(400, 1, 1).dayOfGregorianCal, SysTime(DateTime(400, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(401, 1, 1).dayOfGregorianCal, SysTime(DateTime(401, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(500, 1, 1).dayOfGregorianCal, SysTime(DateTime(500, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(501, 1, 1).dayOfGregorianCal, SysTime(DateTime(501, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(1000, 1, 1).dayOfGregorianCal, SysTime(DateTime(1000, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(1001, 1, 1).dayOfGregorianCal, SysTime(DateTime(1001, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(1600, 1, 1).dayOfGregorianCal, SysTime(DateTime(1600, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(1601, 1, 1).dayOfGregorianCal, SysTime(DateTime(1601, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(1900, 1, 1).dayOfGregorianCal, SysTime(DateTime(1900, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(1901, 1, 1).dayOfGregorianCal, SysTime(DateTime(1901, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(1945, 11, 12).dayOfGregorianCal, SysTime(DateTime(1945, 11, 12, 0, 0, 0), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(1999, 1, 1).dayOfGregorianCal, SysTime(DateTime(1999, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(1999, 7, 6).dayOfGregorianCal, SysTime(DateTime(1999, 7, 6, 12, 13, 14), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(2000, 1, 1).dayOfGregorianCal, SysTime(DateTime(2000, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(2001, 1, 1).dayOfGregorianCal, SysTime(DateTime(2001, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 1, 1).dayOfGregorianCal, SysTime(DateTime(2010, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 1, 31).dayOfGregorianCal, SysTime(DateTime(2010, 1, 31, 23, 0, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 2, 1).dayOfGregorianCal, SysTime(DateTime(2010, 2, 1, 23, 59, 59), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 2, 28).dayOfGregorianCal, SysTime(DateTime(2010, 2, 28, 23, 59, 59), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 3, 1).dayOfGregorianCal, SysTime(DateTime(2010, 3, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 3, 31).dayOfGregorianCal, SysTime(DateTime(2010, 3, 31, 0, 0, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 4, 1).dayOfGregorianCal, SysTime(DateTime(2010, 4, 1, 0, 0, 0), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 4, 30).dayOfGregorianCal, SysTime(DateTime(2010, 4, 30, 0, 0, 0), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 5, 1).dayOfGregorianCal, SysTime(DateTime(2010, 5, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 5, 31).dayOfGregorianCal, SysTime(DateTime(2010, 5, 31, 12, 13, 14), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 6, 1).dayOfGregorianCal, SysTime(DateTime(2010, 6, 1, 12, 13, 14), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 6, 30).dayOfGregorianCal, SysTime(DateTime(2010, 6, 30, 12, 13, 14), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 7, 1).dayOfGregorianCal, SysTime(DateTime(2010, 7, 1, 12, 13, 14), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 7, 31).dayOfGregorianCal, SysTime(DateTime(2010, 7, 31, 23, 59, 59), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 8, 1).dayOfGregorianCal, SysTime(DateTime(2010, 8, 1, 23, 59, 59), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 8, 31).dayOfGregorianCal, SysTime(DateTime(2010, 8, 31, 23, 59, 59), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 9, 1).dayOfGregorianCal, SysTime(DateTime(2010, 9, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 9, 30).dayOfGregorianCal, SysTime(DateTime(2010, 9, 30, 12, 0, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 10, 1).dayOfGregorianCal, SysTime(DateTime(2010, 10, 1, 0, 12, 0), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 10, 31).dayOfGregorianCal, SysTime(DateTime(2010, 10, 31, 0, 0, 12), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 11, 1).dayOfGregorianCal, SysTime(DateTime(2010, 11, 1, 23, 0, 0), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 11, 30).dayOfGregorianCal, SysTime(DateTime(2010, 11, 30, 0, 59, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 12, 1).dayOfGregorianCal, SysTime(DateTime(2010, 12, 1, 0, 0, 59), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(2010, 12, 31).dayOfGregorianCal, SysTime(DateTime(2010, 12, 31, 0, 59, 59), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(2012, 2, 1).dayOfGregorianCal, SysTime(DateTime(2012, 2, 1, 23, 0, 59), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(2012, 2, 28).dayOfGregorianCal, SysTime(DateTime(2012, 2, 28, 23, 59, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(2012, 2, 29).dayOfGregorianCal, SysTime(DateTime(2012, 2, 29, 7, 7, 7), FracSec.from!"hnsecs"(7)).dayOfGregorianCal); _assertPred!"=="(Date(2012, 3, 1).dayOfGregorianCal, SysTime(DateTime(2012, 3, 1, 7, 7, 7), FracSec.from!"hnsecs"(7)).dayOfGregorianCal); //Test B.C. _assertPred!"=="(Date(0, 12, 31).dayOfGregorianCal, SysTime(DateTime(0, 12, 31, 0, 0, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(0, 12, 30).dayOfGregorianCal, SysTime(DateTime(0, 12, 30, 0, 0, 0), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(0, 12, 1).dayOfGregorianCal, SysTime(DateTime(0, 12, 1, 0, 0, 0), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(0, 11, 30).dayOfGregorianCal, SysTime(DateTime(0, 11, 30, 0, 0, 0), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-1, 12, 31).dayOfGregorianCal, SysTime(DateTime(-1, 12, 31, 12, 13, 14), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-1, 12, 30).dayOfGregorianCal, SysTime(DateTime(-1, 12, 30, 12, 13, 14), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(-1, 1, 1).dayOfGregorianCal, SysTime(DateTime(-1, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(-2, 12, 31).dayOfGregorianCal, SysTime(DateTime(-2, 12, 31, 12, 13, 14), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-2, 1, 1).dayOfGregorianCal, SysTime(DateTime(-2, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-3, 12, 31).dayOfGregorianCal, SysTime(DateTime(-3, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(-3, 1, 1).dayOfGregorianCal, SysTime(DateTime(-3, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(-4, 12, 31).dayOfGregorianCal, SysTime(DateTime(-4, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-4, 1, 1).dayOfGregorianCal, SysTime(DateTime(-4, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-5, 12, 31).dayOfGregorianCal, SysTime(DateTime(-5, 12, 31, 0, 0, 0), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(-5, 1, 1).dayOfGregorianCal, SysTime(DateTime(-5, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(-9, 1, 1).dayOfGregorianCal, SysTime(DateTime(-9, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-49, 1, 1).dayOfGregorianCal, SysTime(DateTime(-49, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-50, 1, 1).dayOfGregorianCal, SysTime(DateTime(-50, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(-97, 1, 1).dayOfGregorianCal, SysTime(DateTime(-97, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(-99, 12, 31).dayOfGregorianCal, SysTime(DateTime(-99, 12, 31, 12, 13, 14), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-99, 1, 1).dayOfGregorianCal, SysTime(DateTime(-99, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-100, 1, 1).dayOfGregorianCal, SysTime(DateTime(-100, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(-101, 1, 1).dayOfGregorianCal, SysTime(DateTime(-101, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(-105, 1, 1).dayOfGregorianCal, SysTime(DateTime(-105, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-200, 1, 1).dayOfGregorianCal, SysTime(DateTime(-200, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-201, 1, 1).dayOfGregorianCal, SysTime(DateTime(-201, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(-300, 1, 1).dayOfGregorianCal, SysTime(DateTime(-300, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(-301, 1, 1).dayOfGregorianCal, SysTime(DateTime(-301, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-400, 12, 31).dayOfGregorianCal, SysTime(DateTime(-400, 12, 31, 12, 13, 14), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-400, 1, 1).dayOfGregorianCal, SysTime(DateTime(-400, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(-401, 1, 1).dayOfGregorianCal, SysTime(DateTime(-401, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(-499, 1, 1).dayOfGregorianCal, SysTime(DateTime(-499, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-500, 1, 1).dayOfGregorianCal, SysTime(DateTime(-500, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-501, 1, 1).dayOfGregorianCal, SysTime(DateTime(-501, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(-1000, 1, 1).dayOfGregorianCal, SysTime(DateTime(-1000, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(-1001, 1, 1).dayOfGregorianCal, SysTime(DateTime(-1001, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-1599, 1, 1).dayOfGregorianCal, SysTime(DateTime(-1599, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-1600, 12, 31).dayOfGregorianCal, SysTime(DateTime(-1600, 12, 31, 0, 0, 0), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(-1600, 1, 1).dayOfGregorianCal, SysTime(DateTime(-1600, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(-1601, 1, 1).dayOfGregorianCal, SysTime(DateTime(-1601, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-1900, 1, 1).dayOfGregorianCal, SysTime(DateTime(-1900, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-1901, 1, 1).dayOfGregorianCal, SysTime(DateTime(-1901, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(-1999, 1, 1).dayOfGregorianCal, SysTime(DateTime(-1999, 1, 1, 12, 13, 14), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(-1999, 7, 6).dayOfGregorianCal, SysTime(DateTime(-1999, 7, 6, 12, 13, 14), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-2000, 12, 31).dayOfGregorianCal, SysTime(DateTime(-2000, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-2000, 1, 1).dayOfGregorianCal, SysTime(DateTime(-2000, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(-2001, 1, 1).dayOfGregorianCal, SysTime(DateTime(-2001, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 1, 1).dayOfGregorianCal, SysTime(DateTime(-2010, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 1, 31).dayOfGregorianCal, SysTime(DateTime(-2010, 1, 31, 0, 0, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 2, 1).dayOfGregorianCal, SysTime(DateTime(-2010, 2, 1, 0, 0, 0), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 2, 28).dayOfGregorianCal, SysTime(DateTime(-2010, 2, 28, 0, 0, 0), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 3, 1).dayOfGregorianCal, SysTime(DateTime(-2010, 3, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 3, 31).dayOfGregorianCal, SysTime(DateTime(-2010, 3, 31, 12, 13, 14), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 4, 1).dayOfGregorianCal, SysTime(DateTime(-2010, 4, 1, 12, 13, 14), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 4, 30).dayOfGregorianCal, SysTime(DateTime(-2010, 4, 30, 12, 13, 14), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 5, 1).dayOfGregorianCal, SysTime(DateTime(-2010, 5, 1, 12, 13, 14), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 5, 31).dayOfGregorianCal, SysTime(DateTime(-2010, 5, 31, 23, 59, 59), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 6, 1).dayOfGregorianCal, SysTime(DateTime(-2010, 6, 1, 23, 59, 59), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 6, 30).dayOfGregorianCal, SysTime(DateTime(-2010, 6, 30, 23, 59, 59), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 7, 1).dayOfGregorianCal, SysTime(DateTime(-2010, 7, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 7, 31).dayOfGregorianCal, SysTime(DateTime(-2010, 7, 31, 0, 0, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 8, 1).dayOfGregorianCal, SysTime(DateTime(-2010, 8, 1, 0, 0, 0), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 8, 31).dayOfGregorianCal, SysTime(DateTime(-2010, 8, 31, 0, 0, 0), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 9, 1).dayOfGregorianCal, SysTime(DateTime(-2010, 9, 1, 0, 0, 0), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 9, 30).dayOfGregorianCal, SysTime(DateTime(-2010, 9, 30, 12, 0, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 10, 1).dayOfGregorianCal, SysTime(DateTime(-2010, 10, 1, 0, 12, 0), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 10, 31).dayOfGregorianCal, SysTime(DateTime(-2010, 10, 31, 0, 0, 12), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 11, 1).dayOfGregorianCal, SysTime(DateTime(-2010, 11, 1, 23, 0, 0), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 11, 30).dayOfGregorianCal, SysTime(DateTime(-2010, 11, 30, 0, 59, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 12, 1).dayOfGregorianCal, SysTime(DateTime(-2010, 12, 1, 0, 0, 59), FracSec.from!"hnsecs"(500)).dayOfGregorianCal); _assertPred!"=="(Date(-2010, 12, 31).dayOfGregorianCal, SysTime(DateTime(-2010, 12, 31, 0, 59, 59), FracSec.from!"hnsecs"(50_000)).dayOfGregorianCal); _assertPred!"=="(Date(-2012, 2, 1).dayOfGregorianCal, SysTime(DateTime(-2012, 2, 1, 23, 0, 59), FracSec.from!"hnsecs"(9_999_999)).dayOfGregorianCal); _assertPred!"=="(Date(-2012, 2, 28).dayOfGregorianCal, SysTime(DateTime(-2012, 2, 28, 23, 59, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); _assertPred!"=="(Date(-2012, 2, 29).dayOfGregorianCal, SysTime(DateTime(-2012, 2, 29, 7, 7, 7), FracSec.from!"hnsecs"(7)).dayOfGregorianCal); _assertPred!"=="(Date(-2012, 3, 1).dayOfGregorianCal, SysTime(DateTime(-2012, 3, 1, 7, 7, 7), FracSec.from!"hnsecs"(7)).dayOfGregorianCal); _assertPred!"=="(Date(-3760, 9, 7).dayOfGregorianCal, SysTime(DateTime(-3760, 9, 7, 0, 0, 0), FracSec.from!"hnsecs"(0)).dayOfGregorianCal); } } /++ The Xth day of the Gregorian Calendar that this $(D SysTime) is on. Setting this property does not affect the time portion of $(D SysTime). Params: days = The day of the Gregorian Calendar to set this $(D SysTime) to. Examples: -------------------- auto st = SysTime(DateTime(0, 0, 0, 12, 0, 0)); st.dayOfGregorianCal = 1; assert(st == SysTime(DateTime(1, 1, 1, 12, 0, 0))); st.dayOfGregorianCal = 365; assert(st == SysTime(DateTime(1, 12, 31, 12, 0, 0))); st.dayOfGregorianCal = 366; assert(st == SysTime(DateTime(2, 1, 1, 12, 0, 0))); st.dayOfGregorianCal = 0; assert(st == SysTime(DateTime(0, 12, 31, 12, 0, 0))); st.dayOfGregorianCal = -365; assert(st == SysTime(DateTime(-0, 1, 1, 12, 0, 0))); st.dayOfGregorianCal = -366; assert(st == SysTime(DateTime(-1, 12, 31, 12, 0, 0))); st.dayOfGregorianCal = 730_120; assert(st == SysTime(DateTime(2000, 1, 1, 12, 0, 0))); st.dayOfGregorianCal = 734_137; assert(st == SysTime(DateTime(2010, 12, 31, 12, 0, 0))); -------------------- +/ @property void dayOfGregorianCal(int days) nothrow { auto hnsecs = adjTime; hnsecs = removeUnitsFromHNSecs!"days"(hnsecs); if(hnsecs < 0) hnsecs += convert!("hours", "hnsecs")(24); if(--days < 0) { hnsecs -= convert!("hours", "hnsecs")(24); ++days; } immutable newDaysHNSecs = convert!("days", "hnsecs")(days); adjTime = newDaysHNSecs + hnsecs; } unittest { version(testStdDateTime) { void testST(SysTime orig, int day, in SysTime expected, size_t line = __LINE__) { orig.dayOfGregorianCal = day; _assertPred!"=="(orig, expected, "", __FILE__, line); } //Test A.D. testST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), 1, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); testST(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1)), 1, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1))); testST(SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 1, SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); //Test B.C. testST(SysTime(DateTime(0, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0)), 0, SysTime(DateTime(0, 12, 31, 0, 0, 0), FracSec.from!"hnsecs"(0))); testST(SysTime(DateTime(0, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 0, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); testST(SysTime(DateTime(0, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(1)), 0, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(1))); testST(SysTime(DateTime(0, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(0)), 0, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(0))); //Test Both. testST(SysTime(DateTime(-512, 7, 20, 0, 0, 0), FracSec.from!"hnsecs"(0)), 1, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(0))); testST(SysTime(DateTime(-513, 6, 6, 0, 0, 0), FracSec.from!"hnsecs"(1)), 1, SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1))); testST(SysTime(DateTime(-511, 5, 7, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 1, SysTime(DateTime(1, 1, 1, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); testST(SysTime(DateTime(1607, 4, 8, 0, 0, 0), FracSec.from!"hnsecs"(0)), 0, SysTime(DateTime(0, 12, 31, 0, 0, 0), FracSec.from!"hnsecs"(0))); testST(SysTime(DateTime(1500, 3, 9, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999)), 0, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); testST(SysTime(DateTime(999, 2, 10, 23, 59, 59), FracSec.from!"hnsecs"(1)), 0, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(1))); testST(SysTime(DateTime(2007, 12, 11, 23, 59, 59), FracSec.from!"hnsecs"(0)), 0, SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(0))); auto sysTime = SysTime(DateTime(1, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212)); void testST2(int day, in SysTime expected, size_t line = __LINE__) { sysTime.dayOfGregorianCal = day; _assertPred!"=="(sysTime, expected, "", __FILE__, line); } //Test A.D. testST2(1, SysTime(DateTime(1, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(2, SysTime(DateTime(1, 1, 2, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(32, SysTime(DateTime(1, 2, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(366, SysTime(DateTime(2, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(731, SysTime(DateTime(3, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(1096, SysTime(DateTime(4, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(1462, SysTime(DateTime(5, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(17_898, SysTime(DateTime(50, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(35_065, SysTime(DateTime(97, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(36_160, SysTime(DateTime(100, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(36_525, SysTime(DateTime(101, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(37_986, SysTime(DateTime(105, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(72_684, SysTime(DateTime(200, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(73_049, SysTime(DateTime(201, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(109_208, SysTime(DateTime(300, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(109_573, SysTime(DateTime(301, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(145_732, SysTime(DateTime(400, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(146_098, SysTime(DateTime(401, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(182_257, SysTime(DateTime(500, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(182_622, SysTime(DateTime(501, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(364_878, SysTime(DateTime(1000, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(365_243, SysTime(DateTime(1001, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(584_023, SysTime(DateTime(1600, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(584_389, SysTime(DateTime(1601, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(693_596, SysTime(DateTime(1900, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(693_961, SysTime(DateTime(1901, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(729_755, SysTime(DateTime(1999, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(730_120, SysTime(DateTime(2000, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(730_486, SysTime(DateTime(2001, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(733_773, SysTime(DateTime(2010, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(733_803, SysTime(DateTime(2010, 1, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(733_804, SysTime(DateTime(2010, 2, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(733_831, SysTime(DateTime(2010, 2, 28, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(733_832, SysTime(DateTime(2010, 3, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(733_862, SysTime(DateTime(2010, 3, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(733_863, SysTime(DateTime(2010, 4, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(733_892, SysTime(DateTime(2010, 4, 30, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(733_893, SysTime(DateTime(2010, 5, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(733_923, SysTime(DateTime(2010, 5, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(733_924, SysTime(DateTime(2010, 6, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(733_953, SysTime(DateTime(2010, 6, 30, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(733_954, SysTime(DateTime(2010, 7, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(733_984, SysTime(DateTime(2010, 7, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(733_985, SysTime(DateTime(2010, 8, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(734_015, SysTime(DateTime(2010, 8, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(734_016, SysTime(DateTime(2010, 9, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(734_045, SysTime(DateTime(2010, 9, 30, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(734_046, SysTime(DateTime(2010, 10, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(734_076, SysTime(DateTime(2010, 10, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(734_077, SysTime(DateTime(2010, 11, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(734_106, SysTime(DateTime(2010, 11, 30, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(734_107, SysTime(DateTime(2010, 12, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(734_137, SysTime(DateTime(2010, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(734_534, SysTime(DateTime(2012, 2, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(734_561, SysTime(DateTime(2012, 2, 28, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(734_562, SysTime(DateTime(2012, 2, 29, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(734_563, SysTime(DateTime(2012, 3, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(734_534, SysTime(DateTime(2012, 2, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(734_561, SysTime(DateTime(2012, 2, 28, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(734_562, SysTime(DateTime(2012, 2, 29, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(734_563, SysTime(DateTime(2012, 3, 1, 12, 2, 9), FracSec.from!"msecs"(212))); //Test B.C. testST2(0, SysTime(DateTime(0, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-1, SysTime(DateTime(0, 12, 30, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-30, SysTime(DateTime(0, 12, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-31, SysTime(DateTime(0, 11, 30, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-366, SysTime(DateTime(-1, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-367, SysTime(DateTime(-1, 12, 30, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-730, SysTime(DateTime(-1, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-731, SysTime(DateTime(-2, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-1095, SysTime(DateTime(-2, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-1096, SysTime(DateTime(-3, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-1460, SysTime(DateTime(-3, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-1461, SysTime(DateTime(-4, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-1826, SysTime(DateTime(-4, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-1827, SysTime(DateTime(-5, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-2191, SysTime(DateTime(-5, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-3652, SysTime(DateTime(-9, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-18_262, SysTime(DateTime(-49, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-18_627, SysTime(DateTime(-50, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-35_794, SysTime(DateTime(-97, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-36_160, SysTime(DateTime(-99, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-36_524, SysTime(DateTime(-99, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-36_889, SysTime(DateTime(-100, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-37_254, SysTime(DateTime(-101, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-38_715, SysTime(DateTime(-105, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-73_413, SysTime(DateTime(-200, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-73_778, SysTime(DateTime(-201, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-109_937, SysTime(DateTime(-300, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-110_302, SysTime(DateTime(-301, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-146_097, SysTime(DateTime(-400, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-146_462, SysTime(DateTime(-400, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-146_827, SysTime(DateTime(-401, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-182_621, SysTime(DateTime(-499, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-182_986, SysTime(DateTime(-500, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-183_351, SysTime(DateTime(-501, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-365_607, SysTime(DateTime(-1000, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-365_972, SysTime(DateTime(-1001, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-584_387, SysTime(DateTime(-1599, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-584_388, SysTime(DateTime(-1600, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-584_753, SysTime(DateTime(-1600, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-585_118, SysTime(DateTime(-1601, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-694_325, SysTime(DateTime(-1900, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-694_690, SysTime(DateTime(-1901, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-730_484, SysTime(DateTime(-1999, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-730_485, SysTime(DateTime(-2000, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-730_850, SysTime(DateTime(-2000, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-731_215, SysTime(DateTime(-2001, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_502, SysTime(DateTime(-2010, 1, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_472, SysTime(DateTime(-2010, 1, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_471, SysTime(DateTime(-2010, 2, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_444, SysTime(DateTime(-2010, 2, 28, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_443, SysTime(DateTime(-2010, 3, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_413, SysTime(DateTime(-2010, 3, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_412, SysTime(DateTime(-2010, 4, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_383, SysTime(DateTime(-2010, 4, 30, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_382, SysTime(DateTime(-2010, 5, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_352, SysTime(DateTime(-2010, 5, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_351, SysTime(DateTime(-2010, 6, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_322, SysTime(DateTime(-2010, 6, 30, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_321, SysTime(DateTime(-2010, 7, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_291, SysTime(DateTime(-2010, 7, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_290, SysTime(DateTime(-2010, 8, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_260, SysTime(DateTime(-2010, 8, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_259, SysTime(DateTime(-2010, 9, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_230, SysTime(DateTime(-2010, 9, 30, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_229, SysTime(DateTime(-2010, 10, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_199, SysTime(DateTime(-2010, 10, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_198, SysTime(DateTime(-2010, 11, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_169, SysTime(DateTime(-2010, 11, 30, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_168, SysTime(DateTime(-2010, 12, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-734_138, SysTime(DateTime(-2010, 12, 31, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-735_202, SysTime(DateTime(-2012, 2, 1, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-735_175, SysTime(DateTime(-2012, 2, 28, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-735_174, SysTime(DateTime(-2012, 2, 29, 12, 2, 9), FracSec.from!"msecs"(212))); testST2(-735_173, SysTime(DateTime(-2012, 3, 1, 12, 2, 9), FracSec.from!"msecs"(212))); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(!__traits(compiles, cst.dayOfGregorianCal = 7)); //static assert(!__traits(compiles, ist.dayOfGregorianCal = 7)); //Verify Examples. auto st = SysTime(DateTime(0, 1, 1, 12, 0, 0)); st.dayOfGregorianCal = 1; assert(st == SysTime(DateTime(1, 1, 1, 12, 0, 0))); st.dayOfGregorianCal = 365; assert(st == SysTime(DateTime(1, 12, 31, 12, 0, 0))); st.dayOfGregorianCal = 366; assert(st == SysTime(DateTime(2, 1, 1, 12, 0, 0))); st.dayOfGregorianCal = 0; assert(st == SysTime(DateTime(0, 12, 31, 12, 0, 0))); st.dayOfGregorianCal = -365; assert(st == SysTime(DateTime(-0, 1, 1, 12, 0, 0))); st.dayOfGregorianCal = -366; assert(st == SysTime(DateTime(-1, 12, 31, 12, 0, 0))); st.dayOfGregorianCal = 730_120; assert(st == SysTime(DateTime(2000, 1, 1, 12, 0, 0))); st.dayOfGregorianCal = 734_137; assert(st == SysTime(DateTime(2010, 12, 31, 12, 0, 0))); } } /++ The ISO 8601 week of the year that this $(D SysTime) is in. See_Also: $(WEB en.wikipedia.org/wiki/ISO_week_date, ISO Week Date). +/ @property ubyte isoWeek() const nothrow { return (cast(Date)this).isoWeek; } unittest { version(testStdDateTime) { auto st = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, st.isoWeek)); static assert(__traits(compiles, cst.isoWeek)); //static assert(__traits(compiles, ist.isoWeek)); } } /++ $(D SysTime) for the last day in the month that this Date is in. The time portion of endOfMonth is always 23:59:59.9999999. Examples: -------------------- assert(SysTime(DateTime(1999, 1, 6, 0, 0, 0)).endOfMonth == SysTime(DateTime(1999, 1, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); assert(SysTime(DateTime(1999, 2, 7, 19, 30, 0), FracSec.from!"msecs"(24)).endOfMonth == SysTime(DateTime(1999, 2, 28, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); assert(SysTime(DateTime(2000, 2, 7, 5, 12, 27), FracSec.from!"usecs"(5203)).endOfMonth == SysTime(DateTime(2000, 2, 29, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); assert(SysTime(DateTime(2000, 6, 4, 12, 22, 9), FracSec.from!"hnsecs"(12345)).endOfMonth == SysTime(DateTime(2000, 6, 30, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); -------------------- +/ @property SysTime endOfMonth() const nothrow { immutable hnsecs = adjTime; immutable days = getUnitsFromHNSecs!"days"(hnsecs); auto date = Date(cast(int)days + 1).endOfMonth; auto newDays = date.dayOfGregorianCal - 1; long theTimeHNSecs; if(newDays < 0) { theTimeHNSecs = -1; ++newDays; } else theTimeHNSecs = convert!("days", "hnsecs")(1) - 1; immutable newDaysHNSecs = convert!("days", "hnsecs")(newDays); auto retval = SysTime(this._stdTime, this._timezone); retval.adjTime = newDaysHNSecs + theTimeHNSecs; return retval; } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(SysTime(Date(1999, 1, 1)).endOfMonth, SysTime(DateTime(1999, 1, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(1999, 2, 1)).endOfMonth, SysTime(DateTime(1999, 2, 28, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(2000, 2, 1)).endOfMonth, SysTime(DateTime(2000, 2, 29, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(1999, 3, 1)).endOfMonth, SysTime(DateTime(1999, 3, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(1999, 4, 1)).endOfMonth, SysTime(DateTime(1999, 4, 30, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(1999, 5, 1)).endOfMonth, SysTime(DateTime(1999, 5, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(1999, 6, 1)).endOfMonth, SysTime(DateTime(1999, 6, 30, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(1999, 7, 1)).endOfMonth, SysTime(DateTime(1999, 7, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(1999, 8, 1)).endOfMonth, SysTime(DateTime(1999, 8, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(1999, 9, 1)).endOfMonth, SysTime(DateTime(1999, 9, 30, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(1999, 10, 1)).endOfMonth, SysTime(DateTime(1999, 10, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(1999, 11, 1)).endOfMonth, SysTime(DateTime(1999, 11, 30, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(1999, 12, 1)).endOfMonth, SysTime(DateTime(1999, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); //Test B.C. _assertPred!"=="(SysTime(Date(-1999, 1, 1)).endOfMonth, SysTime(DateTime(-1999, 1, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(-1999, 2, 1)).endOfMonth, SysTime(DateTime(-1999, 2, 28, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(-2000, 2, 1)).endOfMonth, SysTime(DateTime(-2000, 2, 29, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(-1999, 3, 1)).endOfMonth, SysTime(DateTime(-1999, 3, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(-1999, 4, 1)).endOfMonth, SysTime(DateTime(-1999, 4, 30, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(-1999, 5, 1)).endOfMonth, SysTime(DateTime(-1999, 5, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(-1999, 6, 1)).endOfMonth, SysTime(DateTime(-1999, 6, 30, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(-1999, 7, 1)).endOfMonth, SysTime(DateTime(-1999, 7, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(-1999, 8, 1)).endOfMonth, SysTime(DateTime(-1999, 8, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(-1999, 9, 1)).endOfMonth, SysTime(DateTime(-1999, 9, 30, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(-1999, 10, 1)).endOfMonth, SysTime(DateTime(-1999, 10, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(-1999, 11, 1)).endOfMonth, SysTime(DateTime(-1999, 11, 30, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); _assertPred!"=="(SysTime(Date(-1999, 12, 1)).endOfMonth, SysTime(DateTime(-1999, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cst.endOfMonth)); //static assert(__traits(compiles, ist.endOfMonth)); //Verify Examples. assert(SysTime(DateTime(1999, 1, 6, 0, 0, 0)).endOfMonth == SysTime(DateTime(1999, 1, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); assert(SysTime(DateTime(1999, 2, 7, 19, 30, 0), FracSec.from!"msecs"(24)).endOfMonth == SysTime(DateTime(1999, 2, 28, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); assert(SysTime(DateTime(2000, 2, 7, 5, 12, 27), FracSec.from!"usecs"(5203)).endOfMonth == SysTime(DateTime(2000, 2, 29, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); assert(SysTime(DateTime(2000, 6, 4, 12, 22, 9), FracSec.from!"hnsecs"(12345)).endOfMonth == SysTime(DateTime(2000, 6, 30, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999))); } } /++ The last day in the month that this $(D SysTime) is in. Examples: -------------------- assert(SysTime(DateTime(1999, 1, 6, 0, 0, 0)).daysInMonth == 31); assert(SysTime(DateTime(1999, 2, 7, 19, 30, 0)).daysInMonth == 28); assert(SysTime(DateTime(2000, 2, 7, 5, 12, 27)).daysInMonth == 29); assert(SysTime(DateTime(2000, 6, 4, 12, 22, 9)).daysInMonth == 30); -------------------- +/ @property ubyte daysInMonth() const nothrow { return Date(dayOfGregorianCal).daysInMonth; } //Explicitly undocumented. Do not use. To be removed in March 2013. deprecated("Please use daysInMonth instead.") @property ubyte endOfMonthDay() const nothrow { return Date(dayOfGregorianCal).daysInMonth; } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(SysTime(DateTime(1999, 1, 1, 12, 1, 13)).daysInMonth, 31); _assertPred!"=="(SysTime(DateTime(1999, 2, 1, 17, 13, 12)).daysInMonth, 28); _assertPred!"=="(SysTime(DateTime(2000, 2, 1, 13, 2, 12)).daysInMonth, 29); _assertPred!"=="(SysTime(DateTime(1999, 3, 1, 12, 13, 12)).daysInMonth, 31); _assertPred!"=="(SysTime(DateTime(1999, 4, 1, 12, 6, 13)).daysInMonth, 30); _assertPred!"=="(SysTime(DateTime(1999, 5, 1, 15, 13, 12)).daysInMonth, 31); _assertPred!"=="(SysTime(DateTime(1999, 6, 1, 13, 7, 12)).daysInMonth, 30); _assertPred!"=="(SysTime(DateTime(1999, 7, 1, 12, 13, 17)).daysInMonth, 31); _assertPred!"=="(SysTime(DateTime(1999, 8, 1, 12, 3, 13)).daysInMonth, 31); _assertPred!"=="(SysTime(DateTime(1999, 9, 1, 12, 13, 12)).daysInMonth, 30); _assertPred!"=="(SysTime(DateTime(1999, 10, 1, 13, 19, 12)).daysInMonth, 31); _assertPred!"=="(SysTime(DateTime(1999, 11, 1, 12, 13, 17)).daysInMonth, 30); _assertPred!"=="(SysTime(DateTime(1999, 12, 1, 12, 52, 13)).daysInMonth, 31); //Test B.C. _assertPred!"=="(SysTime(DateTime(-1999, 1, 1, 12, 1, 13)).daysInMonth, 31); _assertPred!"=="(SysTime(DateTime(-1999, 2, 1, 7, 13, 12)).daysInMonth, 28); _assertPred!"=="(SysTime(DateTime(-2000, 2, 1, 13, 2, 12)).daysInMonth, 29); _assertPred!"=="(SysTime(DateTime(-1999, 3, 1, 12, 13, 12)).daysInMonth, 31); _assertPred!"=="(SysTime(DateTime(-1999, 4, 1, 12, 6, 13)).daysInMonth, 30); _assertPred!"=="(SysTime(DateTime(-1999, 5, 1, 5, 13, 12)).daysInMonth, 31); _assertPred!"=="(SysTime(DateTime(-1999, 6, 1, 13, 7, 12)).daysInMonth, 30); _assertPred!"=="(SysTime(DateTime(-1999, 7, 1, 12, 13, 17)).daysInMonth, 31); _assertPred!"=="(SysTime(DateTime(-1999, 8, 1, 12, 3, 13)).daysInMonth, 31); _assertPred!"=="(SysTime(DateTime(-1999, 9, 1, 12, 13, 12)).daysInMonth, 30); _assertPred!"=="(SysTime(DateTime(-1999, 10, 1, 13, 19, 12)).daysInMonth, 31); _assertPred!"=="(SysTime(DateTime(-1999, 11, 1, 12, 13, 17)).daysInMonth, 30); _assertPred!"=="(SysTime(DateTime(-1999, 12, 1, 12, 52, 13)).daysInMonth, 31); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cst.daysInMonth)); //static assert(__traits(compiles, ist.daysInMonth)); //Verify Examples. assert(SysTime(DateTime(1999, 1, 6, 0, 0, 0)).daysInMonth == 31); assert(SysTime(DateTime(1999, 2, 7, 19, 30, 0)).daysInMonth == 28); assert(SysTime(DateTime(2000, 2, 7, 5, 12, 27)).daysInMonth == 29); assert(SysTime(DateTime(2000, 6, 4, 12, 22, 9)).daysInMonth == 30); } } /++ Whether the current year is a date in A.D. Examples: -------------------- assert(SysTime(DateTime(1, 1, 1, 12, 7, 0)).isAD); assert(SysTime(DateTime(2010, 12, 31, 0, 0, 0)).isAD); assert(!SysTime(DateTime(0, 12, 31, 23, 59, 59)).isAD); assert(!SysTime(DateTime(-2010, 1, 1, 2, 2, 2)).isAD); -------------------- +/ @property bool isAD() const nothrow { return adjTime >= 0; } unittest { version(testStdDateTime) { assert(SysTime(DateTime(2010, 7, 4, 12, 0, 9)).isAD); assert(SysTime(DateTime(1, 1, 1, 0, 0, 0)).isAD); assert(!SysTime(DateTime(0, 12, 31, 23, 59, 59)).isAD); assert(!SysTime(DateTime(0, 1, 1, 23, 59, 59)).isAD); assert(!SysTime(DateTime(-1, 1, 1, 23 ,59 ,59)).isAD); assert(!SysTime(DateTime(-2010, 7, 4, 12, 2, 2)).isAD); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cst.isAD)); //static assert(__traits(compiles, ist.isAD)); //Verify Examples. assert(SysTime(DateTime(1, 1, 1, 12, 7, 0)).isAD); assert(SysTime(DateTime(2010, 12, 31, 0, 0, 0)).isAD); assert(!SysTime(DateTime(0, 12, 31, 23, 59, 59)).isAD); assert(!SysTime(DateTime(-2010, 1, 1, 2, 2, 2)).isAD); } } /++ The julian day for this $(D SysTime) at the given time. For example, prior to noon, 1996-03-31 would be the julian day number 2_450_173, so this function returns 2_450_173, while from noon onward, the julian day number would be 2_450_174, so this function returns 2_450_174. +/ @property long julianDay() const nothrow { immutable jd = dayOfGregorianCal + 1_721_425; return hour < 12 ? jd - 1 : jd; } unittest { version(testStdDateTime) { _assertPred!"=="(SysTime(DateTime(-4713, 11, 24, 0, 0, 0)).julianDay, -1); _assertPred!"=="(SysTime(DateTime(-4713, 11, 24, 12, 0, 0)).julianDay, 0); _assertPred!"=="(SysTime(DateTime(0, 12, 31, 0, 0, 0)).julianDay, 1_721_424); _assertPred!"=="(SysTime(DateTime(0, 12, 31, 12, 0, 0)).julianDay, 1_721_425); _assertPred!"=="(SysTime(DateTime(1, 1, 1, 0, 0, 0)).julianDay, 1_721_425); _assertPred!"=="(SysTime(DateTime(1, 1, 1, 12, 0, 0)).julianDay, 1_721_426); _assertPred!"=="(SysTime(DateTime(1582, 10, 15, 0, 0, 0)).julianDay, 2_299_160); _assertPred!"=="(SysTime(DateTime(1582, 10, 15, 12, 0, 0)).julianDay, 2_299_161); _assertPred!"=="(SysTime(DateTime(1858, 11, 17, 0, 0, 0)).julianDay, 2_400_000); _assertPred!"=="(SysTime(DateTime(1858, 11, 17, 12, 0, 0)).julianDay, 2_400_001); _assertPred!"=="(SysTime(DateTime(1982, 1, 4, 0, 0, 0)).julianDay, 2_444_973); _assertPred!"=="(SysTime(DateTime(1982, 1, 4, 12, 0, 0)).julianDay, 2_444_974); _assertPred!"=="(SysTime(DateTime(1996, 3, 31, 0, 0, 0)).julianDay, 2_450_173); _assertPred!"=="(SysTime(DateTime(1996, 3, 31, 12, 0, 0)).julianDay, 2_450_174); _assertPred!"=="(SysTime(DateTime(2010, 8, 24, 0, 0, 0)).julianDay, 2_455_432); _assertPred!"=="(SysTime(DateTime(2010, 8, 24, 12, 0, 0)).julianDay, 2_455_433); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cst.julianDay)); //static assert(__traits(compiles, ist.julianDay)); } } /++ The modified julian day for any time on this date (since, the modified julian day changes at midnight). +/ @property long modJulianDay() const nothrow { return (dayOfGregorianCal + 1_721_425) - 2_400_001; } unittest { version(testStdDateTime) { _assertPred!"=="(SysTime(DateTime(1858, 11, 17, 0, 0, 0)).modJulianDay, 0); _assertPred!"=="(SysTime(DateTime(1858, 11, 17, 12, 0, 0)).modJulianDay, 0); _assertPred!"=="(SysTime(DateTime(2010, 8, 24, 0, 0, 0)).modJulianDay, 55_432); _assertPred!"=="(SysTime(DateTime(2010, 8, 24, 12, 0, 0)).modJulianDay, 55_432); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cst.modJulianDay)); //static assert(__traits(compiles, ist.modJulianDay)); } } /++ Returns a $(D Date) equivalent to this $(D SysTime). +/ Date opCast(T)() const nothrow if(is(Unqual!T == Date)) { return Date(dayOfGregorianCal); } unittest { version(testStdDateTime) { _assertPred!"=="(cast(Date)SysTime(Date(1999, 7, 6)), Date(1999, 7, 6)); _assertPred!"=="(cast(Date)SysTime(Date(2000, 12, 31)), Date(2000, 12, 31)); _assertPred!"=="(cast(Date)SysTime(Date(2001, 1, 1)), Date(2001, 1, 1)); _assertPred!"=="(cast(Date)SysTime(DateTime(1999, 7, 6, 12, 10, 9)), Date(1999, 7, 6)); _assertPred!"=="(cast(Date)SysTime(DateTime(2000, 12, 31, 13, 11, 10)), Date(2000, 12, 31)); _assertPred!"=="(cast(Date)SysTime(DateTime(2001, 1, 1, 14, 12, 11)), Date(2001, 1, 1)); _assertPred!"=="(cast(Date)SysTime(Date(-1999, 7, 6)), Date(-1999, 7, 6)); _assertPred!"=="(cast(Date)SysTime(Date(-2000, 12, 31)), Date(-2000, 12, 31)); _assertPred!"=="(cast(Date)SysTime(Date(-2001, 1, 1)), Date(-2001, 1, 1)); _assertPred!"=="(cast(Date)SysTime(DateTime(-1999, 7, 6, 12, 10, 9)), Date(-1999, 7, 6)); _assertPred!"=="(cast(Date)SysTime(DateTime(-2000, 12, 31, 13, 11, 10)), Date(-2000, 12, 31)); _assertPred!"=="(cast(Date)SysTime(DateTime(-2001, 1, 1, 14, 12, 11)), Date(-2001, 1, 1)); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cast(Date)cst)); //static assert(__traits(compiles, cast(Date)ist)); } } /++ Returns a $(D DateTime) equivalent to this $(D SysTime). +/ DateTime opCast(T)() const nothrow if(is(Unqual!T == DateTime)) { try { auto hnsecs = adjTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs) + 1; if(hnsecs < 0) { hnsecs += convert!("hours", "hnsecs")(24); --days; } immutable hour = splitUnitsFromHNSecs!"hours"(hnsecs); immutable minute = splitUnitsFromHNSecs!"minutes"(hnsecs); immutable second = getUnitsFromHNSecs!"seconds"(hnsecs); return DateTime(Date(cast(int)days), TimeOfDay(cast(int)hour, cast(int)minute, cast(int)second)); } catch(Exception e) assert(0, "Either DateTime's constructor or TimeOfDay's constructor threw."); } unittest { version(testStdDateTime) { _assertPred!"=="(cast(DateTime)SysTime(DateTime(1, 1, 6, 7, 12, 22)), DateTime(1, 1, 6, 7, 12, 22)); _assertPred!"=="(cast(DateTime)SysTime(DateTime(1, 1, 6, 7, 12, 22), FracSec.from!"msecs"(22)), DateTime(1, 1, 6, 7, 12, 22)); _assertPred!"=="(cast(DateTime)SysTime(Date(1999, 7, 6)), DateTime(1999, 7, 6, 0, 0, 0)); _assertPred!"=="(cast(DateTime)SysTime(Date(2000, 12, 31)), DateTime(2000, 12, 31, 0, 0, 0)); _assertPred!"=="(cast(DateTime)SysTime(Date(2001, 1, 1)), DateTime(2001, 1, 1, 0, 0, 0)); _assertPred!"=="(cast(DateTime)SysTime(DateTime(1999, 7, 6, 12, 10, 9)), DateTime(1999, 7, 6, 12, 10, 9)); _assertPred!"=="(cast(DateTime)SysTime(DateTime(2000, 12, 31, 13, 11, 10)), DateTime(2000, 12, 31, 13, 11, 10)); _assertPred!"=="(cast(DateTime)SysTime(DateTime(2001, 1, 1, 14, 12, 11)), DateTime(2001, 1, 1, 14, 12, 11)); _assertPred!"=="(cast(DateTime)SysTime(DateTime(-1, 1, 6, 7, 12, 22)), DateTime(-1, 1, 6, 7, 12, 22)); _assertPred!"=="(cast(DateTime)SysTime(DateTime(-1, 1, 6, 7, 12, 22), FracSec.from!"msecs"(22)), DateTime(-1, 1, 6, 7, 12, 22)); _assertPred!"=="(cast(DateTime)SysTime(Date(-1999, 7, 6)), DateTime(-1999, 7, 6, 0, 0, 0)); _assertPred!"=="(cast(DateTime)SysTime(Date(-2000, 12, 31)), DateTime(-2000, 12, 31, 0, 0, 0)); _assertPred!"=="(cast(DateTime)SysTime(Date(-2001, 1, 1)), DateTime(-2001, 1, 1, 0, 0, 0)); _assertPred!"=="(cast(DateTime)SysTime(DateTime(-1999, 7, 6, 12, 10, 9)), DateTime(-1999, 7, 6, 12, 10, 9)); _assertPred!"=="(cast(DateTime)SysTime(DateTime(-2000, 12, 31, 13, 11, 10)), DateTime(-2000, 12, 31, 13, 11, 10)); _assertPred!"=="(cast(DateTime)SysTime(DateTime(-2001, 1, 1, 14, 12, 11)), DateTime(-2001, 1, 1, 14, 12, 11)); _assertPred!"=="(cast(DateTime)SysTime(DateTime(2011, 1, 13, 8, 17, 2), FracSec.from!"msecs"(296), LocalTime()), DateTime(2011, 1, 13, 8, 17, 2)); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cast(DateTime)cst)); //static assert(__traits(compiles, cast(DateTime)ist)); } } /++ Returns a $(D TimeOfDay) equivalent to this $(D SysTime). +/ TimeOfDay opCast(T)() const nothrow if(is(Unqual!T == TimeOfDay)) { try { auto hnsecs = adjTime; hnsecs = removeUnitsFromHNSecs!"days"(hnsecs); if(hnsecs < 0) hnsecs += convert!("hours", "hnsecs")(24); immutable hour = splitUnitsFromHNSecs!"hours"(hnsecs); immutable minute = splitUnitsFromHNSecs!"minutes"(hnsecs); immutable second = getUnitsFromHNSecs!"seconds"(hnsecs); return TimeOfDay(cast(int)hour, cast(int)minute, cast(int)second); } catch(Exception e) assert(0, "TimeOfDay's constructor threw."); } unittest { version(testStdDateTime) { _assertPred!"=="(cast(TimeOfDay)SysTime(Date(1999, 7, 6)), TimeOfDay(0, 0, 0)); _assertPred!"=="(cast(TimeOfDay)SysTime(Date(2000, 12, 31)), TimeOfDay(0, 0, 0)); _assertPred!"=="(cast(TimeOfDay)SysTime(Date(2001, 1, 1)), TimeOfDay(0, 0, 0)); _assertPred!"=="(cast(TimeOfDay)SysTime(DateTime(1999, 7, 6, 12, 10, 9)), TimeOfDay(12, 10, 9)); _assertPred!"=="(cast(TimeOfDay)SysTime(DateTime(2000, 12, 31, 13, 11, 10)), TimeOfDay(13, 11, 10)); _assertPred!"=="(cast(TimeOfDay)SysTime(DateTime(2001, 1, 1, 14, 12, 11)), TimeOfDay(14, 12, 11)); _assertPred!"=="(cast(TimeOfDay)SysTime(Date(-1999, 7, 6)), TimeOfDay(0, 0, 0)); _assertPred!"=="(cast(TimeOfDay)SysTime(Date(-2000, 12, 31)), TimeOfDay(0, 0, 0)); _assertPred!"=="(cast(TimeOfDay)SysTime(Date(-2001, 1, 1)), TimeOfDay(0, 0, 0)); _assertPred!"=="(cast(TimeOfDay)SysTime(DateTime(-1999, 7, 6, 12, 10, 9)), TimeOfDay(12, 10, 9)); _assertPred!"=="(cast(TimeOfDay)SysTime(DateTime(-2000, 12, 31, 13, 11, 10)), TimeOfDay(13, 11, 10)); _assertPred!"=="(cast(TimeOfDay)SysTime(DateTime(-2001, 1, 1, 14, 12, 11)), TimeOfDay(14, 12, 11)); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cast(TimeOfDay)cst)); //static assert(__traits(compiles, cast(TimeOfDay)ist)); } } //Temporary hack until bug http://d.puremagic.com/issues/show_bug.cgi?id=4867 is fixed. //This allows assignment from const(SysTime) to SysTime. //It may be a good idea to keep it though, since casting from a type to itself //should be allowed, and it doesn't work without this opCast() since opCast() //has already been defined for other types. SysTime opCast(T)() const pure nothrow if(is(Unqual!T == SysTime)) { return SysTime(_stdTime, _timezone); } /++ Converts this $(D SysTime) to a string with the format YYYYMMDDTHHMMSS.FFFFFFFTZ (where F is fractional seconds and TZ is time zone). Note that the number of digits in the fractional seconds varies with the number of fractional seconds. It's a maximum of 7 (which would be hnsecs), but only has as many as are necessary to hold the correct value (so no trailing zeroes), and if there are no fractional seconds, then there is no decimal point. If this $(D SysTime)'s time zone is $(D LocalTime), then TZ is empty. If its time zone is $(D UTC), then it is "Z". Otherwise, it is the offset from UTC (e.g. +1:00 or -7:00). Note that the offset from UTC is $(I not) enough to uniquely identify the time zone. Time zone offsets will be in the form +HH:MM or -HH:MM. Examples: -------------------- assert(SysTime(DateTime(2010, 7, 4, 7, 6, 12)).toISOString() == "20100704T070612"); assert(SysTime(DateTime(1998, 12, 25, 2, 15, 0), FracSec.from!"msecs"(24)).toISOString() == "19981225T021500.024"); assert(SysTime(DateTime(0, 1, 5, 23, 9, 59)).toISOString() == "00000105T230959"); assert(SysTime(DateTime(-4, 1, 5, 0, 0, 2), FracSec.from!"hnsecs"(520_920)).toISOString() == "-00040105T000002.052092"); -------------------- +/ string toISOString() const nothrow { try { immutable adjustedTime = adjTime; long hnsecs = adjustedTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs) + 1; if(hnsecs < 0) { hnsecs += convert!("hours", "hnsecs")(24); --days; } auto hour = splitUnitsFromHNSecs!"hours"(hnsecs); auto minute = splitUnitsFromHNSecs!"minutes"(hnsecs); auto second = splitUnitsFromHNSecs!"seconds"(hnsecs); auto dateTime = DateTime(Date(cast(int)days), TimeOfDay(cast(int)hour, cast(int)minute, cast(int)second)); auto fracSecStr = fracSecToISOString(cast(int)hnsecs); if(_timezone is LocalTime()) return dateTime.toISOString() ~ fracSecToISOString(cast(int)hnsecs); if(_timezone is UTC()) return dateTime.toISOString() ~ fracSecToISOString(cast(int)hnsecs) ~ "Z"; immutable utcOffset = dur!"hnsecs"(adjustedTime - stdTime); return format("%s%s%s", dateTime.toISOString(), fracSecToISOString(cast(int)hnsecs), SimpleTimeZone.toISOString(utcOffset)); } catch(Exception e) assert(0, "format() threw."); } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(SysTime(DateTime.init, UTC()).toISOString(), "00010101T000000Z"); _assertPred!"=="(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1), UTC()).toISOString(), "00010101T000000.0000001Z"); _assertPred!"=="(SysTime(DateTime(9, 12, 4, 0, 0, 0)).toISOString(), "00091204T000000"); _assertPred!"=="(SysTime(DateTime(99, 12, 4, 5, 6, 12)).toISOString(), "00991204T050612"); _assertPred!"=="(SysTime(DateTime(999, 12, 4, 13, 44, 59)).toISOString(), "09991204T134459"); _assertPred!"=="(SysTime(DateTime(9999, 7, 4, 23, 59, 59)).toISOString(), "99990704T235959"); _assertPred!"=="(SysTime(DateTime(10000, 10, 20, 1, 1, 1)).toISOString(), "+100001020T010101"); _assertPred!"=="(SysTime(DateTime(9, 12, 4, 0, 0, 0), FracSec.from!"msecs"(42)).toISOString(), "00091204T000000.042"); _assertPred!"=="(SysTime(DateTime(99, 12, 4, 5, 6, 12), FracSec.from!"msecs"(100)).toISOString(), "00991204T050612.1"); _assertPred!"=="(SysTime(DateTime(999, 12, 4, 13, 44, 59), FracSec.from!"usecs"(45020)).toISOString(), "09991204T134459.04502"); _assertPred!"=="(SysTime(DateTime(9999, 7, 4, 23, 59, 59), FracSec.from!"hnsecs"(12)).toISOString(), "99990704T235959.0000012"); _assertPred!"=="(SysTime(DateTime(10000, 10, 20, 1, 1, 1), FracSec.from!"hnsecs"(507890)).toISOString(), "+100001020T010101.050789"); _assertPred!"=="(SysTime(DateTime(2012, 12, 21, 12, 12, 12), new SimpleTimeZone(dur!"minutes"(-360))).toISOString(), "20121221T121212-06:00"); _assertPred!"=="(SysTime(DateTime(2012, 12, 21, 12, 12, 12), new SimpleTimeZone(dur!"minutes"(420))).toISOString(), "20121221T121212+07:00"); //Test B.C. _assertPred!"=="(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999), UTC()).toISOString(), "00001231T235959.9999999Z"); _assertPred!"=="(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(1), UTC()).toISOString(), "00001231T235959.0000001Z"); _assertPred!"=="(SysTime(DateTime(0, 12, 31, 23, 59, 59), UTC()).toISOString(), "00001231T235959Z"); _assertPred!"=="(SysTime(DateTime(0, 12, 4, 0, 12, 4)).toISOString(), "00001204T001204"); _assertPred!"=="(SysTime(DateTime(-9, 12, 4, 0, 0, 0)).toISOString(), "-00091204T000000"); _assertPred!"=="(SysTime(DateTime(-99, 12, 4, 5, 6, 12)).toISOString(), "-00991204T050612"); _assertPred!"=="(SysTime(DateTime(-999, 12, 4, 13, 44, 59)).toISOString(), "-09991204T134459"); _assertPred!"=="(SysTime(DateTime(-9999, 7, 4, 23, 59, 59)).toISOString(), "-99990704T235959"); _assertPred!"=="(SysTime(DateTime(-10000, 10, 20, 1, 1, 1)).toISOString(), "-100001020T010101"); _assertPred!"=="(SysTime(DateTime(0, 12, 4, 0, 0, 0), FracSec.from!"msecs"(7)).toISOString(), "00001204T000000.007"); _assertPred!"=="(SysTime(DateTime(-9, 12, 4, 0, 0, 0), FracSec.from!"msecs"(42)).toISOString(), "-00091204T000000.042"); _assertPred!"=="(SysTime(DateTime(-99, 12, 4, 5, 6, 12), FracSec.from!"msecs"(100)).toISOString(), "-00991204T050612.1"); _assertPred!"=="(SysTime(DateTime(-999, 12, 4, 13, 44, 59), FracSec.from!"usecs"(45020)).toISOString(), "-09991204T134459.04502"); _assertPred!"=="(SysTime(DateTime(-9999, 7, 4, 23, 59, 59), FracSec.from!"hnsecs"(12)).toISOString(), "-99990704T235959.0000012"); _assertPred!"=="(SysTime(DateTime(-10000, 10, 20, 1, 1, 1), FracSec.from!"hnsecs"(507890)).toISOString(), "-100001020T010101.050789"); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cast(TimeOfDay)cst)); //static assert(__traits(compiles, cast(TimeOfDay)ist)); //Verify Examples. assert(SysTime(DateTime(2010, 7, 4, 7, 6, 12)).toISOString() == "20100704T070612"); assert(SysTime(DateTime(1998, 12, 25, 2, 15, 0), FracSec.from!"msecs"(24)).toISOString() == "19981225T021500.024"); assert(SysTime(DateTime(0, 1, 5, 23, 9, 59)).toISOString() == "00000105T230959"); assert(SysTime(DateTime(-4, 1, 5, 0, 0, 2), FracSec.from!"hnsecs"(520_920)).toISOString() == "-00040105T000002.052092"); } } /++ Converts this $(D SysTime) to a string with the format YYYY-MM-DDTHH:MM:SS.FFFFFFFTZ (where F is fractional seconds and TZ is the time zone). Note that the number of digits in the fractional seconds varies with the number of fractional seconds. It's a maximum of 7 (which would be hnsecs), but only has as many as are necessary to hold the correct value (so no trailing zeroes), and if there are no fractional seconds, then there is no decimal point. If this $(D SysTime)'s time zone is $(D LocalTime), then TZ is empty. If its time zone is $(D UTC), then it is "Z". Otherwise, it is the offset from UTC (e.g. +1:00 or -7:00). Note that the offset from UTC is $(I not) enough to uniquely identify the time zone. Time zone offsets will be in the form +HH:MM or -HH:MM. Examples: -------------------- assert(SysTime(DateTime(2010, 7, 4, 7, 6, 12)).toISOExtString() == "2010-07-04T07:06:12"); assert(SysTime(DateTime(1998, 12, 25, 2, 15, 0), FracSec.from!"msecs"(24)).toISOExtString() == "1998-12-25T02:15:00.024"); assert(SysTime(DateTime(0, 1, 5, 23, 9, 59)).toISOExtString() == "0000-01-05T23:09:59"); assert(SysTime(DateTime(-4, 1, 5, 0, 0, 2), FracSec.from!"hnsecs"(520_920)).toISOExtString() == "-0004-01-05T00:00:02.052092"); -------------------- +/ string toISOExtString() const nothrow { try { immutable adjustedTime = adjTime; long hnsecs = adjustedTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs) + 1; if(hnsecs < 0) { hnsecs += convert!("hours", "hnsecs")(24); --days; } auto hour = splitUnitsFromHNSecs!"hours"(hnsecs); auto minute = splitUnitsFromHNSecs!"minutes"(hnsecs); auto second = splitUnitsFromHNSecs!"seconds"(hnsecs); auto dateTime = DateTime(Date(cast(int)days), TimeOfDay(cast(int)hour, cast(int)minute, cast(int)second)); auto fracSecStr = fracSecToISOString(cast(int)hnsecs); if(_timezone is LocalTime()) return dateTime.toISOExtString() ~ fracSecToISOString(cast(int)hnsecs); if(_timezone is UTC()) return dateTime.toISOExtString() ~ fracSecToISOString(cast(int)hnsecs) ~ "Z"; immutable utcOffset = dur!"hnsecs"(adjustedTime - stdTime); return format("%s%s%s", dateTime.toISOExtString(), fracSecToISOString(cast(int)hnsecs), SimpleTimeZone.toISOString(utcOffset)); } catch(Exception e) assert(0, "format() threw."); } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(SysTime(DateTime.init, UTC()).toISOExtString(), "0001-01-01T00:00:00Z"); _assertPred!"=="(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1), UTC()).toISOExtString(), "0001-01-01T00:00:00.0000001Z"); _assertPred!"=="(SysTime(DateTime(9, 12, 4, 0, 0, 0)).toISOExtString(), "0009-12-04T00:00:00"); _assertPred!"=="(SysTime(DateTime(99, 12, 4, 5, 6, 12)).toISOExtString(), "0099-12-04T05:06:12"); _assertPred!"=="(SysTime(DateTime(999, 12, 4, 13, 44, 59)).toISOExtString(), "0999-12-04T13:44:59"); _assertPred!"=="(SysTime(DateTime(9999, 7, 4, 23, 59, 59)).toISOExtString(), "9999-07-04T23:59:59"); _assertPred!"=="(SysTime(DateTime(10000, 10, 20, 1, 1, 1)).toISOExtString(), "+10000-10-20T01:01:01"); _assertPred!"=="(SysTime(DateTime(9, 12, 4, 0, 0, 0), FracSec.from!"msecs"(42)).toISOExtString(), "0009-12-04T00:00:00.042"); _assertPred!"=="(SysTime(DateTime(99, 12, 4, 5, 6, 12), FracSec.from!"msecs"(100)).toISOExtString(), "0099-12-04T05:06:12.1"); _assertPred!"=="(SysTime(DateTime(999, 12, 4, 13, 44, 59), FracSec.from!"usecs"(45020)).toISOExtString(), "0999-12-04T13:44:59.04502"); _assertPred!"=="(SysTime(DateTime(9999, 7, 4, 23, 59, 59), FracSec.from!"hnsecs"(12)).toISOExtString(), "9999-07-04T23:59:59.0000012"); _assertPred!"=="(SysTime(DateTime(10000, 10, 20, 1, 1, 1), FracSec.from!"hnsecs"(507890)).toISOExtString(), "+10000-10-20T01:01:01.050789"); _assertPred!"=="(SysTime(DateTime(2012, 12, 21, 12, 12, 12), new SimpleTimeZone(dur!"minutes"(-360))).toISOExtString(), "2012-12-21T12:12:12-06:00"); _assertPred!"=="(SysTime(DateTime(2012, 12, 21, 12, 12, 12), new SimpleTimeZone(dur!"minutes"(420))).toISOExtString(), "2012-12-21T12:12:12+07:00"); //Test B.C. _assertPred!"=="(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999), UTC()).toISOExtString(), "0000-12-31T23:59:59.9999999Z"); _assertPred!"=="(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(1), UTC()).toISOExtString(), "0000-12-31T23:59:59.0000001Z"); _assertPred!"=="(SysTime(DateTime(0, 12, 31, 23, 59, 59), UTC()).toISOExtString(), "0000-12-31T23:59:59Z"); _assertPred!"=="(SysTime(DateTime(0, 12, 4, 0, 12, 4)).toISOExtString(), "0000-12-04T00:12:04"); _assertPred!"=="(SysTime(DateTime(-9, 12, 4, 0, 0, 0)).toISOExtString(), "-0009-12-04T00:00:00"); _assertPred!"=="(SysTime(DateTime(-99, 12, 4, 5, 6, 12)).toISOExtString(), "-0099-12-04T05:06:12"); _assertPred!"=="(SysTime(DateTime(-999, 12, 4, 13, 44, 59)).toISOExtString(), "-0999-12-04T13:44:59"); _assertPred!"=="(SysTime(DateTime(-9999, 7, 4, 23, 59, 59)).toISOExtString(), "-9999-07-04T23:59:59"); _assertPred!"=="(SysTime(DateTime(-10000, 10, 20, 1, 1, 1)).toISOExtString(), "-10000-10-20T01:01:01"); _assertPred!"=="(SysTime(DateTime(0, 12, 4, 0, 0, 0), FracSec.from!"msecs"(7)).toISOExtString(), "0000-12-04T00:00:00.007"); _assertPred!"=="(SysTime(DateTime(-9, 12, 4, 0, 0, 0), FracSec.from!"msecs"(42)).toISOExtString(), "-0009-12-04T00:00:00.042"); _assertPred!"=="(SysTime(DateTime(-99, 12, 4, 5, 6, 12), FracSec.from!"msecs"(100)).toISOExtString(), "-0099-12-04T05:06:12.1"); _assertPred!"=="(SysTime(DateTime(-999, 12, 4, 13, 44, 59), FracSec.from!"usecs"(45020)).toISOExtString(), "-0999-12-04T13:44:59.04502"); _assertPred!"=="(SysTime(DateTime(-9999, 7, 4, 23, 59, 59), FracSec.from!"hnsecs"(12)).toISOExtString(), "-9999-07-04T23:59:59.0000012"); _assertPred!"=="(SysTime(DateTime(-10000, 10, 20, 1, 1, 1), FracSec.from!"hnsecs"(507890)).toISOExtString(), "-10000-10-20T01:01:01.050789"); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cast(TimeOfDay)cst)); //static assert(__traits(compiles, cast(TimeOfDay)ist)); //Verify Examples. assert(SysTime(DateTime(2010, 7, 4, 7, 6, 12)).toISOExtString() == "2010-07-04T07:06:12"); assert(SysTime(DateTime(1998, 12, 25, 2, 15, 0), FracSec.from!"msecs"(24)).toISOExtString() == "1998-12-25T02:15:00.024"); assert(SysTime(DateTime(0, 1, 5, 23, 9, 59)).toISOExtString() == "0000-01-05T23:09:59"); assert(SysTime(DateTime(-4, 1, 5, 0, 0, 2), FracSec.from!"hnsecs"(520_920)).toISOExtString() == "-0004-01-05T00:00:02.052092"); } } /++ Converts this $(D SysTime) to a string with the format YYYY-Mon-DD HH:MM:SS.FFFFFFFTZ (where F is fractional seconds and TZ is the time zone). Note that the number of digits in the fractional seconds varies with the number of fractional seconds. It's a maximum of 7 (which would be hnsecs), but only has as many as are necessary to hold the correct value (so no trailing zeroes), and if there are no fractional seconds, then there is no decimal point. If this $(D SysTime)'s time zone is $(D LocalTime), then TZ is empty. If its time zone is $(D UTC), then it is "Z". Otherwise, it is the offset from UTC (e.g. +1:00 or -7:00). Note that the offset from UTC is $(I not) enough to uniquely identify the time zone. Time zone offsets will be in the form +HH:MM or -HH:MM. Examples: -------------------- assert(SysTime(DateTime(2010, 7, 4, 7, 6, 12)).toSimpleString() == "2010-Jul-04 07:06:12"); assert(SysTime(DateTime(1998, 12, 25, 2, 15, 0), FracSec.from!"msecs"(24)).toSimpleString() == "1998-Dec-25 02:15:00.024"); assert(SysTime(DateTime(0, 1, 5, 23, 9, 59)).toSimpleString() == "0000-Jan-05 23:09:59"); assert(SysTime(DateTime(-4, 1, 5, 0, 0, 2), FracSec.from!"hnsecs"(520_920)).toSimpleString() == "-0004-Jan-05 00:00:02.052092"); -------------------- +/ string toSimpleString() const nothrow { try { immutable adjustedTime = adjTime; long hnsecs = adjustedTime; auto days = splitUnitsFromHNSecs!"days"(hnsecs) + 1; if(hnsecs < 0) { hnsecs += convert!("hours", "hnsecs")(24); --days; } auto hour = splitUnitsFromHNSecs!"hours"(hnsecs); auto minute = splitUnitsFromHNSecs!"minutes"(hnsecs); auto second = splitUnitsFromHNSecs!"seconds"(hnsecs); auto dateTime = DateTime(Date(cast(int)days), TimeOfDay(cast(int)hour, cast(int)minute, cast(int)second)); auto fracSecStr = fracSecToISOString(cast(int)hnsecs); if(_timezone is LocalTime()) return dateTime.toSimpleString() ~ fracSecToISOString(cast(int)hnsecs); if(_timezone is UTC()) return dateTime.toSimpleString() ~ fracSecToISOString(cast(int)hnsecs) ~ "Z"; immutable utcOffset = dur!"hnsecs"(adjustedTime - stdTime); return format("%s%s%s", dateTime.toSimpleString(), fracSecToISOString(cast(int)hnsecs), SimpleTimeZone.toISOString(utcOffset)); } catch(Exception e) assert(0, "format() threw."); } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(SysTime(DateTime.init, UTC()).toString(), "0001-Jan-01 00:00:00Z"); _assertPred!"=="(SysTime(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"hnsecs"(1), UTC()).toString(), "0001-Jan-01 00:00:00.0000001Z"); _assertPred!"=="(SysTime(DateTime(9, 12, 4, 0, 0, 0)).toSimpleString(), "0009-Dec-04 00:00:00"); _assertPred!"=="(SysTime(DateTime(99, 12, 4, 5, 6, 12)).toSimpleString(), "0099-Dec-04 05:06:12"); _assertPred!"=="(SysTime(DateTime(999, 12, 4, 13, 44, 59)).toSimpleString(), "0999-Dec-04 13:44:59"); _assertPred!"=="(SysTime(DateTime(9999, 7, 4, 23, 59, 59)).toSimpleString(), "9999-Jul-04 23:59:59"); _assertPred!"=="(SysTime(DateTime(10000, 10, 20, 1, 1, 1)).toSimpleString(), "+10000-Oct-20 01:01:01"); _assertPred!"=="(SysTime(DateTime(9, 12, 4, 0, 0, 0), FracSec.from!"msecs"(42)).toSimpleString(), "0009-Dec-04 00:00:00.042"); _assertPred!"=="(SysTime(DateTime(99, 12, 4, 5, 6, 12), FracSec.from!"msecs"(100)).toSimpleString(), "0099-Dec-04 05:06:12.1"); _assertPred!"=="(SysTime(DateTime(999, 12, 4, 13, 44, 59), FracSec.from!"usecs"(45020)).toSimpleString(), "0999-Dec-04 13:44:59.04502"); _assertPred!"=="(SysTime(DateTime(9999, 7, 4, 23, 59, 59), FracSec.from!"hnsecs"(12)).toSimpleString(), "9999-Jul-04 23:59:59.0000012"); _assertPred!"=="(SysTime(DateTime(10000, 10, 20, 1, 1, 1), FracSec.from!"hnsecs"(507890)).toSimpleString(), "+10000-Oct-20 01:01:01.050789"); _assertPred!"=="(SysTime(DateTime(2012, 12, 21, 12, 12, 12), new SimpleTimeZone(dur!"minutes"(-360))).toSimpleString(), "2012-Dec-21 12:12:12-06:00"); _assertPred!"=="(SysTime(DateTime(2012, 12, 21, 12, 12, 12), new SimpleTimeZone(dur!"minutes"(420))).toSimpleString(), "2012-Dec-21 12:12:12+07:00"); //Test B.C. _assertPred!"=="(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999), UTC()).toSimpleString(), "0000-Dec-31 23:59:59.9999999Z"); _assertPred!"=="(SysTime(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(1), UTC()).toSimpleString(), "0000-Dec-31 23:59:59.0000001Z"); _assertPred!"=="(SysTime(DateTime(0, 12, 31, 23, 59, 59), UTC()).toSimpleString(), "0000-Dec-31 23:59:59Z"); _assertPred!"=="(SysTime(DateTime(0, 12, 4, 0, 12, 4)).toSimpleString(), "0000-Dec-04 00:12:04"); _assertPred!"=="(SysTime(DateTime(-9, 12, 4, 0, 0, 0)).toSimpleString(), "-0009-Dec-04 00:00:00"); _assertPred!"=="(SysTime(DateTime(-99, 12, 4, 5, 6, 12)).toSimpleString(), "-0099-Dec-04 05:06:12"); _assertPred!"=="(SysTime(DateTime(-999, 12, 4, 13, 44, 59)).toSimpleString(), "-0999-Dec-04 13:44:59"); _assertPred!"=="(SysTime(DateTime(-9999, 7, 4, 23, 59, 59)).toSimpleString(), "-9999-Jul-04 23:59:59"); _assertPred!"=="(SysTime(DateTime(-10000, 10, 20, 1, 1, 1)).toSimpleString(), "-10000-Oct-20 01:01:01"); _assertPred!"=="(SysTime(DateTime(0, 12, 4, 0, 0, 0), FracSec.from!"msecs"(7)).toSimpleString(), "0000-Dec-04 00:00:00.007"); _assertPred!"=="(SysTime(DateTime(-9, 12, 4, 0, 0, 0), FracSec.from!"msecs"(42)).toSimpleString(), "-0009-Dec-04 00:00:00.042"); _assertPred!"=="(SysTime(DateTime(-99, 12, 4, 5, 6, 12), FracSec.from!"msecs"(100)).toSimpleString(), "-0099-Dec-04 05:06:12.1"); _assertPred!"=="(SysTime(DateTime(-999, 12, 4, 13, 44, 59), FracSec.from!"usecs"(45020)).toSimpleString(), "-0999-Dec-04 13:44:59.04502"); _assertPred!"=="(SysTime(DateTime(-9999, 7, 4, 23, 59, 59), FracSec.from!"hnsecs"(12)).toSimpleString(), "-9999-Jul-04 23:59:59.0000012"); _assertPred!"=="(SysTime(DateTime(-10000, 10, 20, 1, 1, 1), FracSec.from!"hnsecs"(507890)).toSimpleString(), "-10000-Oct-20 01:01:01.050789"); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, cast(TimeOfDay)cst)); //static assert(__traits(compiles, cast(TimeOfDay)ist)); //Verify Examples. assert(SysTime(DateTime(2010, 7, 4, 7, 6, 12)).toSimpleString() == "2010-Jul-04 07:06:12"); assert(SysTime(DateTime(1998, 12, 25, 2, 15, 0), FracSec.from!"msecs"(24)).toSimpleString() == "1998-Dec-25 02:15:00.024"); assert(SysTime(DateTime(0, 1, 5, 23, 9, 59)).toSimpleString() == "0000-Jan-05 23:09:59"); assert(SysTime(DateTime(-4, 1, 5, 0, 0, 2), FracSec.from!"hnsecs"(520_920)).toSimpleString() == "-0004-Jan-05 00:00:02.052092"); } } /+ Converts this $(D SysTime) to a string. +/ //Due to bug http://d.puremagic.com/issues/show_bug.cgi?id=3715 , we can't //have versions of toString() with extra modifiers, so we define one version //with modifiers and one without. string toString() { return toSimpleString(); } /++ Converts this $(D SysTime) to a string. +/ //Due to bug http://d.puremagic.com/issues/show_bug.cgi?id=3715 , we can't //have versions of toString() with extra modifiers, so we define one version //with modifiers and one without. string toString() const nothrow { return toSimpleString(); } unittest { version(testStdDateTime) { auto st = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); static assert(__traits(compiles, st.toString())); static assert(__traits(compiles, cst.toString())); //static assert(__traits(compiles, ist.toString())); } } /++ Creates a $(D SysTime) from a string with the format YYYYMMDDTHHMMSS.FFFFFFFTZ (where F is fractional seconds is the time zone). Whitespace is stripped from the given string. The exact format is exactly as described in $(D toISOString) except that trailing zeroes are permitted - including having fractional seconds with all zeroes. However, a decimal point with nothing following it is invalid. If there is no time zone in the string, then $(D LocalTime) is used. If the time zone is "Z", then $(D UTC) is used. Otherwise, a $(LREF SimpleTimeZone) which corresponds to the given offset from UTC is used. To get the returned $(D SysTime) to be a particular time zone, pass in that time zone and the $(D SysTime) to be returned will be converted to that time zone (though it will still be read in as whatever time zone is in its string). The accepted formats for time zone offsets are +H, -H, +HH, -HH, +H:MM, -H:MM, +HH:MM, and -HH:MM. Params: isoString = A string formatted in the ISO format for dates and times. tz = The time zone to convert the given time to (no conversion occurs if null). Throws: $(D DateTimeException) if the given string is not in the ISO format or if the resulting $(D SysTime) would not be valid. Examples: -------------------- assert(SysTime.fromISOString("20100704T070612") == SysTime(DateTime(2010, 7, 4, 7, 6, 12))); assert(SysTime.fromISOString("19981225T021500.007") == SysTime(DateTime(1998, 12, 25, 2, 15, 0), FracSec.from!"msecs"(7))); assert(SysTime.fromISOString("00000105T230959.00002") == SysTime(DateTime(0, 1, 5, 23, 9, 59), FracSec.from!"usecs"(20))); assert(SysTime.fromISOString("-00040105T000002") == SysTime(DateTime(-4, 1, 5, 0, 0, 2))); assert(SysTime.fromISOString(" 20100704T070612 ") == SysTime(DateTime(2010, 7, 4, 7, 6, 12))); assert(SysTime.fromISOString("20100704T070612Z") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), UTC())); assert(SysTime.fromISOString("20100704T070612-8:00") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(-8)))); assert(SysTime.fromISOString("20100704T070612+8:00") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(8)))); -------------------- +/ static SysTime fromISOString(S)(in S isoString, immutable TimeZone tz = null) if(isSomeString!S) { auto dstr = to!dstring(strip(isoString)); immutable skipFirst = dstr.startsWith("+", "-") != 0; auto found = (skipFirst ? dstr[1..$] : dstr).find(".", "Z", "+", "-"); auto dateTimeStr = dstr[0 .. $ - found[0].length]; dstring fracSecStr; dstring zoneStr; if(found[1] != 0) { if(found[1] == 1) { auto foundTZ = found[0].find("Z", "+", "-"); if(foundTZ[1] != 0) { fracSecStr = found[0][0 .. $ - foundTZ[0].length]; zoneStr = foundTZ[0]; } else fracSecStr = found[0]; } else zoneStr = found[0]; } try { auto dateTime = DateTime.fromISOString(dateTimeStr); auto fracSec = fracSecFromISOString(fracSecStr); Rebindable!(immutable TimeZone) parsedZone; if(zoneStr.empty) parsedZone = LocalTime(); else if(zoneStr == "Z") parsedZone = UTC(); else parsedZone = SimpleTimeZone.fromISOString(zoneStr); auto retval = SysTime(dateTime, fracSec, parsedZone); if(tz !is null) retval.timezone = tz; return retval; } catch(DateTimeException dte) throw new DateTimeException(format("Invalid ISO String: %s", isoString)); } unittest { version(testStdDateTime) { assertThrown!DateTimeException(SysTime.fromISOString("")); assertThrown!DateTimeException(SysTime.fromISOString("20100704000000")); assertThrown!DateTimeException(SysTime.fromISOString("20100704 000000")); assertThrown!DateTimeException(SysTime.fromISOString("20100704t000000")); assertThrown!DateTimeException(SysTime.fromISOString("20100704T000000.")); assertThrown!DateTimeException(SysTime.fromISOString("20100704T000000.A")); assertThrown!DateTimeException(SysTime.fromISOString("20100704T000000.Z")); assertThrown!DateTimeException(SysTime.fromISOString("20100704T000000.00000000")); assertThrown!DateTimeException(SysTime.fromISOString("20100704T000000.00000000")); assertThrown!DateTimeException(SysTime.fromISOString("20100704T000000+")); assertThrown!DateTimeException(SysTime.fromISOString("20100704T000000-")); assertThrown!DateTimeException(SysTime.fromISOString("20100704T000000:")); assertThrown!DateTimeException(SysTime.fromISOString("20100704T000000-:")); assertThrown!DateTimeException(SysTime.fromISOString("20100704T000000+:")); assertThrown!DateTimeException(SysTime.fromISOString("20100704T000000-1:")); assertThrown!DateTimeException(SysTime.fromISOString("20100704T000000+1:")); assertThrown!DateTimeException(SysTime.fromISOString("20100704T000000+1:0")); assertThrown!DateTimeException(SysTime.fromISOString("20100704T000000-24.00")); assertThrown!DateTimeException(SysTime.fromISOString("20100704T000000+24.00")); assertThrown!DateTimeException(SysTime.fromISOString("2010-07-0400:00:00")); assertThrown!DateTimeException(SysTime.fromISOString("2010-07-04 00:00:00")); assertThrown!DateTimeException(SysTime.fromISOString("2010-07-04t00:00:00")); assertThrown!DateTimeException(SysTime.fromISOString("2010-07-04T00:00:00.")); assertThrown!DateTimeException(SysTime.fromISOString("2010-Jul-0400:00:00")); assertThrown!DateTimeException(SysTime.fromISOString("2010-Jul-04 00:00:00")); assertThrown!DateTimeException(SysTime.fromISOString("2010-Jul-04t00:00:00")); assertThrown!DateTimeException(SysTime.fromISOString("2010-Jul-04T00:00:00")); assertThrown!DateTimeException(SysTime.fromISOString("2010-Jul-04 00:00:00.")); assertThrown!DateTimeException(SysTime.fromISOString("2010-12-22T172201")); assertThrown!DateTimeException(SysTime.fromISOString("2010-Dec-22 17:22:01")); _assertPred!"=="(SysTime.fromISOString("20101222T172201"), SysTime(DateTime(2010, 12, 22, 17, 22, 01))); _assertPred!"=="(SysTime.fromISOString("19990706T123033"), SysTime(DateTime(1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromISOString("-19990706T123033"), SysTime(DateTime(-1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromISOString("+019990706T123033"), SysTime(DateTime(1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromISOString("19990706T123033 "), SysTime(DateTime(1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromISOString(" 19990706T123033"), SysTime(DateTime(1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromISOString(" 19990706T123033 "), SysTime(DateTime(1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromISOString("19070707T121212.0"), SysTime(DateTime(1907, 07, 07, 12, 12, 12))); _assertPred!"=="(SysTime.fromISOString("19070707T121212.0000000"), SysTime(DateTime(1907, 07, 07, 12, 12, 12))); _assertPred!"=="(SysTime.fromISOString("19070707T121212.0000001"), SysTime(DateTime(1907, 07, 07, 12, 12, 12), FracSec.from!"hnsecs"(1))); _assertPred!"=="(SysTime.fromISOString("19070707T121212.000001"), SysTime(DateTime(1907, 07, 07, 12, 12, 12), FracSec.from!"usecs"(1))); _assertPred!"=="(SysTime.fromISOString("19070707T121212.0000010"), SysTime(DateTime(1907, 07, 07, 12, 12, 12), FracSec.from!"usecs"(1))); _assertPred!"=="(SysTime.fromISOString("19070707T121212.001"), SysTime(DateTime(1907, 07, 07, 12, 12, 12), FracSec.from!"msecs"(1))); _assertPred!"=="(SysTime.fromISOString("19070707T121212.0010000"), SysTime(DateTime(1907, 07, 07, 12, 12, 12), FracSec.from!"msecs"(1))); _assertPred!"=="(SysTime.fromISOString("20101222T172201Z"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), UTC())); _assertPred!"=="(SysTime.fromISOString("20101222T172201-1:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-60)))); _assertPred!"=="(SysTime.fromISOString("20101222T172201-1"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-60)))); _assertPred!"=="(SysTime.fromISOString("20101222T172201-1:30"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-90)))); _assertPred!"=="(SysTime.fromISOString("20101222T172201-8:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-480)))); _assertPred!"=="(SysTime.fromISOString("20101222T172201+1:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(60)))); _assertPred!"=="(SysTime.fromISOString("20101222T172201+1"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(60)))); _assertPred!"=="(SysTime.fromISOString("20101222T172201+1:30"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(90)))); _assertPred!"=="(SysTime.fromISOString("20101222T172201+8:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(480)))); _assertPred!"=="(SysTime.fromISOString("20101103T065106.57159Z"), SysTime(DateTime(2010, 11, 3, 6, 51, 6), FracSec.from!"hnsecs"(5715900), UTC())); _assertPred!"=="(SysTime.fromISOString("20101222T172201.23412Z"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(2_341_200), UTC())); _assertPred!"=="(SysTime.fromISOString("20101222T172201.23112-1:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(2_311_200), new SimpleTimeZone(dur!"minutes"(-60)))); _assertPred!"=="(SysTime.fromISOString("20101222T172201.45-1"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(4_500_000), new SimpleTimeZone(dur!"minutes"(-60)))); _assertPred!"=="(SysTime.fromISOString("20101222T172201.1-1:30"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(1_000_000), new SimpleTimeZone(dur!"minutes"(-90)))); _assertPred!"=="(SysTime.fromISOString("20101222T172201.55-8:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(5_500_000), new SimpleTimeZone(dur!"minutes"(-480)))); _assertPred!"=="(SysTime.fromISOString("20101222T172201.1234567+1:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(1_234_567), new SimpleTimeZone(dur!"minutes"(60)))); _assertPred!"=="(SysTime.fromISOString("20101222T172201.0+1"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(0), new SimpleTimeZone(dur!"minutes"(60)))); _assertPred!"=="(SysTime.fromISOString("20101222T172201.0000000+1:30"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(0), new SimpleTimeZone(dur!"minutes"(90)))); _assertPred!"=="(SysTime.fromISOString("20101222T172201.45+8:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(4_500_000), new SimpleTimeZone(dur!"minutes"(480)))); //Verify Examples. assert(SysTime.fromISOString("20100704T070612") == SysTime(DateTime(2010, 7, 4, 7, 6, 12))); assert(SysTime.fromISOString("19981225T021500.007") == SysTime(DateTime(1998, 12, 25, 2, 15, 0), FracSec.from!"msecs"(7))); assert(SysTime.fromISOString("00000105T230959.00002") == SysTime(DateTime(0, 1, 5, 23, 9, 59), FracSec.from!"usecs"(20))); assert(SysTime.fromISOString("-00040105T000002") == SysTime(DateTime(-4, 1, 5, 0, 0, 2))); assert(SysTime.fromISOString(" 20100704T070612 ") == SysTime(DateTime(2010, 7, 4, 7, 6, 12))); assert(SysTime.fromISOString("20100704T070612Z") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), UTC())); assert(SysTime.fromISOString("20100704T070612-8:00") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(-8)))); assert(SysTime.fromISOString("20100704T070612+8:00") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(8)))); } } /++ Creates a $(D SysTime) from a string with the format YYYY-MM-DDTHH:MM:SS.FFFFFFFTZ (where F is fractional seconds is the time zone). Whitespace is stripped from the given string. The exact format is exactly as described in $(D toISOExtString) except that trailing zeroes are permitted - including having fractional seconds with all zeroes. However, a decimal point with nothing following it is invalid. If there is no time zone in the string, then $(D LocalTime) is used. If the time zone is "Z", then $(D UTC) is used. Otherwise, a $(LREF SimpleTimeZone) which corresponds to the given offset from UTC is used. To get the returned $(D SysTime) to be a particular time zone, pass in that time zone and the $(D SysTime) to be returned will be converted to that time zone (though it will still be read in as whatever time zone is in its string). The accepted formats for time zone offsets are +H, -H, +HH, -HH, +H:MM, -H:MM, +HH:MM, and -HH:MM. Params: isoString = A string formatted in the ISO Extended format for dates and times. tz = The time zone to convert the given time to (no conversion occurs if null). Throws: $(D DateTimeException) if the given string is not in the ISO format or if the resulting $(D SysTime) would not be valid. Examples: -------------------- assert(SysTime.fromISOExtString("2010-07-04T07:06:12") == SysTime(DateTime(2010, 7, 4, 7, 6, 12))); assert(SysTime.fromISOExtString("1998-12-25T02:15:00.007") == SysTime(DateTime(1998, 12, 25, 2, 15, 0), FracSec.from!"msecs"(7))); assert(SysTime.fromISOExtString("0000-01-05T23:09:59.00002") == SysTime(DateTime(0, 1, 5, 23, 9, 59), FracSec.from!"usecs"(20))); assert(SysTime.fromISOExtString("-0004-01-05T00:00:02") == SysTime(DateTime(-4, 1, 5, 0, 0, 2))); assert(SysTime.fromISOExtString(" 2010-07-04T07:06:12 ") == SysTime(DateTime(2010, 7, 4, 7, 6, 12))); assert(SysTime.fromISOExtString("2010-07-04T07:06:12Z") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), UTC())); assert(SysTime.fromISOExtString("2010-07-04T07:06:12-8:00") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(-8)))); assert(SysTime.fromISOExtString("2010-07-04T07:06:12+8:00") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(8)))); -------------------- +/ static SysTime fromISOExtString(S)(in S isoExtString, immutable TimeZone tz = null) if(isSomeString!(S)) { auto dstr = to!dstring(strip(isoExtString)); auto tIndex = dstr.stds_indexOf("T"); enforce(tIndex != -1, new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); auto found = dstr[tIndex + 1 .. $].find(".", "Z", "+", "-"); auto dateTimeStr = dstr[0 .. $ - found[0].length]; dstring fracSecStr; dstring zoneStr; if(found[1] != 0) { if(found[1] == 1) { auto foundTZ = found[0].find("Z", "+", "-"); if(foundTZ[1] != 0) { fracSecStr = found[0][0 .. $ - foundTZ[0].length]; zoneStr = foundTZ[0]; } else fracSecStr = found[0]; } else zoneStr = found[0]; } try { auto dateTime = DateTime.fromISOExtString(dateTimeStr); auto fracSec = fracSecFromISOString(fracSecStr); Rebindable!(immutable TimeZone) parsedZone; if(zoneStr.empty) parsedZone = LocalTime(); else if(zoneStr == "Z") parsedZone = UTC(); else parsedZone = SimpleTimeZone.fromISOString(zoneStr); auto retval = SysTime(dateTime, fracSec, parsedZone); if(tz !is null) retval.timezone = tz; return retval; } catch(DateTimeException dte) throw new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString)); } unittest { version(testStdDateTime) { assertThrown!DateTimeException(SysTime.fromISOExtString("")); assertThrown!DateTimeException(SysTime.fromISOExtString("20100704000000")); assertThrown!DateTimeException(SysTime.fromISOExtString("20100704 000000")); assertThrown!DateTimeException(SysTime.fromISOExtString("20100704t000000")); assertThrown!DateTimeException(SysTime.fromISOExtString("20100704T000000.")); assertThrown!DateTimeException(SysTime.fromISOExtString("20100704T000000.0")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07:0400:00:00")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04 00:00:00")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04 00:00:00")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04t00:00:00")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04T00:00:00.")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04T00:00:00.A")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04T00:00:00.Z")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04T00:00:00.00000000")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04T00:00:00.00000000")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04T00:00:00+")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04T00:00:00-")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04T00:00:00:")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04T00:00:00-:")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04T00:00:00+:")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04T00:00:00-1:")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04T00:00:00+1:")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04T00:00:00+1:0")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04T00:00:00-24.00")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-07-04T00:00:00+24.00")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-Jul-0400:00:00")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-Jul-04t00:00:00")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-Jul-04 00:00:00.")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-Jul-04 00:00:00.0")); assertThrown!DateTimeException(SysTime.fromISOExtString("20101222T172201")); assertThrown!DateTimeException(SysTime.fromISOExtString("2010-Dec-22 17:22:01")); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01"), SysTime(DateTime(2010, 12, 22, 17, 22, 01))); _assertPred!"=="(SysTime.fromISOExtString("1999-07-06T12:30:33"), SysTime(DateTime(1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromISOExtString("-1999-07-06T12:30:33"), SysTime(DateTime(-1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromISOExtString("+01999-07-06T12:30:33"), SysTime(DateTime(1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromISOExtString("1999-07-06T12:30:33 "), SysTime(DateTime(1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromISOExtString(" 1999-07-06T12:30:33"), SysTime(DateTime(1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromISOExtString(" 1999-07-06T12:30:33 "), SysTime(DateTime(1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromISOExtString("1907-07-07T12:12:12.0"), SysTime(DateTime(1907, 07, 07, 12, 12, 12))); _assertPred!"=="(SysTime.fromISOExtString("1907-07-07T12:12:12.0000000"), SysTime(DateTime(1907, 07, 07, 12, 12, 12))); _assertPred!"=="(SysTime.fromISOExtString("1907-07-07T12:12:12.0000001"), SysTime(DateTime(1907, 07, 07, 12, 12, 12), FracSec.from!"hnsecs"(1))); _assertPred!"=="(SysTime.fromISOExtString("1907-07-07T12:12:12.000001"), SysTime(DateTime(1907, 07, 07, 12, 12, 12), FracSec.from!"usecs"(1))); _assertPred!"=="(SysTime.fromISOExtString("1907-07-07T12:12:12.0000010"), SysTime(DateTime(1907, 07, 07, 12, 12, 12), FracSec.from!"usecs"(1))); _assertPred!"=="(SysTime.fromISOExtString("1907-07-07T12:12:12.001"), SysTime(DateTime(1907, 07, 07, 12, 12, 12), FracSec.from!"msecs"(1))); _assertPred!"=="(SysTime.fromISOExtString("1907-07-07T12:12:12.0010000"), SysTime(DateTime(1907, 07, 07, 12, 12, 12), FracSec.from!"msecs"(1))); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01Z"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), UTC())); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01-1:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-60)))); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01-1"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-60)))); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01-1:30"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-90)))); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01-8:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-480)))); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01+1:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(60)))); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01+1"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(60)))); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01+1:30"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(90)))); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01+8:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(480)))); _assertPred!"=="(SysTime.fromISOExtString("2010-11-03T06:51:06.57159Z"), SysTime(DateTime(2010, 11, 3, 6, 51, 6), FracSec.from!"hnsecs"(5715900), UTC())); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01.23412Z"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(2_341_200), UTC())); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01.23112-1:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(2_311_200), new SimpleTimeZone(dur!"minutes"(-60)))); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01.45-1"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(4_500_000), new SimpleTimeZone(dur!"minutes"(-60)))); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01.1-1:30"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(1_000_000), new SimpleTimeZone(dur!"minutes"(-90)))); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01.55-8:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(5_500_000), new SimpleTimeZone(dur!"minutes"(-480)))); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01.1234567+1:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(1_234_567), new SimpleTimeZone(dur!"minutes"(60)))); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01.0+1"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(0), new SimpleTimeZone(dur!"minutes"(60)))); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01.0000000+1:30"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(0), new SimpleTimeZone(dur!"minutes"(90)))); _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01.45+8:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(4_500_000), new SimpleTimeZone(dur!"minutes"(480)))); //Verify Examples. assert(SysTime.fromISOExtString("2010-07-04T07:06:12") == SysTime(DateTime(2010, 7, 4, 7, 6, 12))); assert(SysTime.fromISOExtString("1998-12-25T02:15:00.007") == SysTime(DateTime(1998, 12, 25, 2, 15, 0), FracSec.from!"msecs"(7))); assert(SysTime.fromISOExtString("0000-01-05T23:09:59.00002") == SysTime(DateTime(0, 1, 5, 23, 9, 59), FracSec.from!"usecs"(20))); assert(SysTime.fromISOExtString("-0004-01-05T00:00:02") == SysTime(DateTime(-4, 1, 5, 0, 0, 2))); assert(SysTime.fromISOExtString(" 2010-07-04T07:06:12 ") == SysTime(DateTime(2010, 7, 4, 7, 6, 12))); assert(SysTime.fromISOExtString("2010-07-04T07:06:12Z") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), UTC())); assert(SysTime.fromISOExtString("2010-07-04T07:06:12-8:00") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(-8)))); assert(SysTime.fromISOExtString("2010-07-04T07:06:12+8:00") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(8)))); } } /++ Creates a $(D SysTime) from a string with the format YYYY-MM-DD HH:MM:SS.FFFFFFFTZ (where F is fractional seconds is the time zone). Whitespace is stripped from the given string. The exact format is exactly as described in $(D toSimpleString) except that trailing zeroes are permitted - including having fractional seconds with all zeroes. However, a decimal point with nothing following it is invalid. If there is no time zone in the string, then $(D LocalTime) is used. If the time zone is "Z", then $(D UTC) is used. Otherwise, a $(LREF SimpleTimeZone) which corresponds to the given offset from UTC is used. To get the returned $(D SysTime) to be a particular time zone, pass in that time zone and the $(D SysTime) to be returned will be converted to that time zone (though it will still be read in as whatever time zone is in its string). The accepted formats for time zone offsets are +H, -H, +HH, -HH, +H:MM, -H:MM, +HH:MM, and -HH:MM. Params: simpleString = A string formatted in the way that $(D toSimpleString) formats dates and times. tz = The time zone to convert the given time to (no conversion occurs if null). Throws: $(D DateTimeException) if the given string is not in the ISO format or if the resulting $(D SysTime) would not be valid. Examples: -------------------- assert(SysTime.fromSimpleString("2010-Jul-04 07:06:12") == SysTime(DateTime(2010, 7, 4, 7, 6, 12))); assert(SysTime.fromSimpleString("1998-Dec-25 02:15:00.007") == SysTime(DateTime(1998, 12, 25, 2, 15, 0), FracSec.from!"msecs"(7))); assert(SysTime.fromSimpleString("0000-Jan-05 23:09:59.00002") == SysTime(DateTime(0, 1, 5, 23, 9, 59), FracSec.from!"usecs"(20))); assert(SysTime.fromSimpleString("-0004-Jan-05 00:00:02") == SysTime(DateTime(-4, 1, 5, 0, 0, 2))); assert(SysTime.fromSimpleString(" 2010-Jul-04 07:06:12 ") == SysTime(DateTime(2010, 7, 4, 7, 6, 12))); assert(SysTime.fromSimpleString("2010-Jul-04 07:06:12Z") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), UTC())); assert(SysTime.fromSimpleString("2010-Jul-04 07:06:12-8:00") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(-8)))); assert(SysTime.fromSimpleString("2010-Jul-04 07:06:12+8:00") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(8)))); -------------------- +/ static SysTime fromSimpleString(S)(in S simpleString, immutable TimeZone tz = null) if(isSomeString!(S)) { auto dstr = to!dstring(strip(simpleString)); auto spaceIndex = dstr.stds_indexOf(" "); enforce(spaceIndex != -1, new DateTimeException(format("Invalid Simple String: %s", simpleString))); auto found = dstr[spaceIndex + 1 .. $].find(".", "Z", "+", "-"); auto dateTimeStr = dstr[0 .. $ - found[0].length]; dstring fracSecStr; dstring zoneStr; if(found[1] != 0) { if(found[1] == 1) { auto foundTZ = found[0].find("Z", "+", "-"); if(foundTZ[1] != 0) { fracSecStr = found[0][0 .. $ - foundTZ[0].length]; zoneStr = foundTZ[0]; } else fracSecStr = found[0]; } else zoneStr = found[0]; } try { auto dateTime = DateTime.fromSimpleString(dateTimeStr); auto fracSec = fracSecFromISOString(fracSecStr); Rebindable!(immutable TimeZone) parsedZone; if(zoneStr.empty) parsedZone = LocalTime(); else if(zoneStr == "Z") parsedZone = UTC(); else parsedZone = SimpleTimeZone.fromISOString(zoneStr); auto retval = SysTime(dateTime, fracSec, parsedZone); if(tz !is null) retval.timezone = tz; return retval; } catch(DateTimeException dte) throw new DateTimeException(format("Invalid Simple String: %s", simpleString)); } unittest { version(testStdDateTime) { assertThrown!DateTimeException(SysTime.fromSimpleString("")); assertThrown!DateTimeException(SysTime.fromSimpleString("20100704000000")); assertThrown!DateTimeException(SysTime.fromSimpleString("20100704 000000")); assertThrown!DateTimeException(SysTime.fromSimpleString("20100704t000000")); assertThrown!DateTimeException(SysTime.fromSimpleString("20100704T000000.")); assertThrown!DateTimeException(SysTime.fromSimpleString("20100704T000000.0")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-07-0400:00:00")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-07-04 00:00:00")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-07-04t00:00:00")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-07-04T00:00:00.")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-07-04T00:00:00.0")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-0400:00:00")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-04t00:00:00")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-04T00:00:00")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-04 00:00:00.")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-04 00:00:00.A")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-04 00:00:00.Z")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-04 00:00:00.00000000")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-04 00:00:00.00000000")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-04 00:00:00+")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-04 00:00:00-")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-04 00:00:00:")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-04 00:00:00-:")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-04 00:00:00+:")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-04 00:00:00-1:")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-04 00:00:00+1:")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-04 00:00:00+1:0")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-04 00:00:00-24.00")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-Jul-04 00:00:00+24.00")); assertThrown!DateTimeException(SysTime.fromSimpleString("20101222T172201")); assertThrown!DateTimeException(SysTime.fromSimpleString("2010-12-22T172201")); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01"), SysTime(DateTime(2010, 12, 22, 17, 22, 01))); _assertPred!"=="(SysTime.fromSimpleString("1999-Jul-06 12:30:33"), SysTime(DateTime(1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromSimpleString("-1999-Jul-06 12:30:33"), SysTime(DateTime(-1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromSimpleString("+01999-Jul-06 12:30:33"), SysTime(DateTime(1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromSimpleString("1999-Jul-06 12:30:33 "), SysTime(DateTime(1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromSimpleString(" 1999-Jul-06 12:30:33"), SysTime(DateTime(1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromSimpleString(" 1999-Jul-06 12:30:33 "), SysTime(DateTime(1999, 7, 6, 12, 30, 33))); _assertPred!"=="(SysTime.fromSimpleString("1907-Jul-07 12:12:12.0"), SysTime(DateTime(1907, 07, 07, 12, 12, 12))); _assertPred!"=="(SysTime.fromSimpleString("1907-Jul-07 12:12:12.0000000"), SysTime(DateTime(1907, 07, 07, 12, 12, 12))); _assertPred!"=="(SysTime.fromSimpleString("1907-Jul-07 12:12:12.0000001"), SysTime(DateTime(1907, 07, 07, 12, 12, 12), FracSec.from!"hnsecs"(1))); _assertPred!"=="(SysTime.fromSimpleString("1907-Jul-07 12:12:12.000001"), SysTime(DateTime(1907, 07, 07, 12, 12, 12), FracSec.from!"usecs"(1))); _assertPred!"=="(SysTime.fromSimpleString("1907-Jul-07 12:12:12.0000010"), SysTime(DateTime(1907, 07, 07, 12, 12, 12), FracSec.from!"usecs"(1))); _assertPred!"=="(SysTime.fromSimpleString("1907-Jul-07 12:12:12.001"), SysTime(DateTime(1907, 07, 07, 12, 12, 12), FracSec.from!"msecs"(1))); _assertPred!"=="(SysTime.fromSimpleString("1907-Jul-07 12:12:12.0010000"), SysTime(DateTime(1907, 07, 07, 12, 12, 12), FracSec.from!"msecs"(1))); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01Z"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), UTC())); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01-1:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-60)))); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01-1"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-60)))); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01-1:30"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-90)))); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01-8:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-480)))); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01+1:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(60)))); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01+1"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(60)))); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01+1:30"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(90)))); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01+8:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(480)))); _assertPred!"=="(SysTime.fromSimpleString("2010-Nov-03 06:51:06.57159Z"), SysTime(DateTime(2010, 11, 3, 6, 51, 6), FracSec.from!"hnsecs"(5715900), UTC())); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01.23412Z"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(2_341_200), UTC())); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01.23112-1:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(2_311_200), new SimpleTimeZone(dur!"minutes"(-60)))); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01.45-1"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(4_500_000), new SimpleTimeZone(dur!"minutes"(-60)))); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01.1-1:30"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(1_000_000), new SimpleTimeZone(dur!"minutes"(-90)))); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01.55-8:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(5_500_000), new SimpleTimeZone(dur!"minutes"(-480)))); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01.1234567+1:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(1_234_567), new SimpleTimeZone(dur!"minutes"(60)))); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01.0+1"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(0), new SimpleTimeZone(dur!"minutes"(60)))); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01.0000000+1:30"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(0), new SimpleTimeZone(dur!"minutes"(90)))); _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01.45+8:00"), SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(4_500_000), new SimpleTimeZone(dur!"minutes"(480)))); //Verify Examples. assert(SysTime.fromSimpleString("2010-Jul-04 07:06:12") == SysTime(DateTime(2010, 7, 4, 7, 6, 12))); assert(SysTime.fromSimpleString("1998-Dec-25 02:15:00.007") == SysTime(DateTime(1998, 12, 25, 2, 15, 0), FracSec.from!"msecs"(7))); assert(SysTime.fromSimpleString("0000-Jan-05 23:09:59.00002") == SysTime(DateTime(0, 1, 5, 23, 9, 59), FracSec.from!"usecs"(20))); assert(SysTime.fromSimpleString("-0004-Jan-05 00:00:02") == SysTime(DateTime(-4, 1, 5, 0, 0, 2))); assert(SysTime.fromSimpleString(" 2010-Jul-04 07:06:12 ") == SysTime(DateTime(2010, 7, 4, 7, 6, 12))); assert(SysTime.fromSimpleString("2010-Jul-04 07:06:12Z") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), UTC())); assert(SysTime.fromSimpleString("2010-Jul-04 07:06:12-8:00") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(-8)))); assert(SysTime.fromSimpleString("2010-Jul-04 07:06:12+8:00") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(8)))); } } //TODO Add function which takes a user-specified time format and produces a SysTime //TODO Add function which takes pretty much any time-string and produces a SysTime. // Obviously, it will be less efficient, and it probably won't manage _every_ // possible date format, but a smart conversion function would be nice. /++ Returns the $(D SysTime) farthest in the past which is representable by $(D SysTime). The $(D SysTime) which is returned is in UTC. +/ @property static SysTime min() pure nothrow { return SysTime(long.min, UTC()); } unittest { version(testStdDateTime) { assert(SysTime.min.year < 0); assert(SysTime.min < SysTime.max); } } /++ Returns the $(D SysTime) farthest in the future which is representable by $(D SysTime). The $(D SysTime) which is returned is in UTC. +/ @property static SysTime max() pure nothrow { return SysTime(long.max, UTC()); } unittest { version(testStdDateTime) { assert(SysTime.max.year > 0); assert(SysTime.max > SysTime.min); } } private: /+ Returns $(D stdTime) converted to $(D SysTime)'s time zone. +/ @property long adjTime() const nothrow { return _timezone.utcToTZ(_stdTime); } /+ Converts the given hnsecs from $(D SysTime)'s time zone to std time. +/ @property void adjTime(long adjTime) nothrow { _stdTime = _timezone.tzToUTC(adjTime); } //Commented out due to bug http://d.puremagic.com/issues/show_bug.cgi?id=5058 /+ invariant() { assert(_timezone !is null, "Invariant Failure: timezone is null. Were you foolish enough to use SysTime.init? (since timezone for SysTime.init can't be set at compile time)."); } +/ long _stdTime; Rebindable!(immutable TimeZone) _timezone; } /++ Represents a date in the Proleptic Gregorian Calendar ranging from 32,768 B.C. to 32,767 A.D. Positive years are A.D. Non-positive years are B.C. Year, month, and day are kept separately internally so that $(D Date) is optimized for calendar-based operations. $(D Date) uses the Proleptic Gregorian Calendar, so it assumes the Gregorian leap year calculations for its entire length. And, as per $(WEB en.wikipedia.org/wiki/ISO_8601, ISO 8601), it also treats 1 B.C. as year 0. So, 1 B.C. is 0, 2 B.C. is -1, etc. Use $(D yearBC) if want B.C. as a positive integer with 1 B.C. being the year prior to 1 A.D. Year 0 is a leap year. +/ struct Date { public: /++ Throws: $(D DateTimeException) if the resulting $(D Date) would not be valid. Params: year = Year of the Gregorian Calendar. Positive values are A.D. Non-positive values are B.C. with year 0 being the year prior to 1 A.D. month = Month of the year. day = Day of the month. +/ this(int year, int month, int day) pure { enforceValid!"months"(cast(Month)month); enforceValid!"days"(year, cast(Month)month, day); _year = cast(short)year; _month = cast(Month)month; _day = cast(ubyte)day; } unittest { version(testStdDateTime) { _assertPred!"=="(Date(1, 1, 1), Date.init); static void testDate(in Date date, int year, int month, int day, size_t line = __LINE__) { _assertPred!"=="(date._year, year, "", __FILE__, line); _assertPred!"=="(date._month, month, "", __FILE__, line); _assertPred!"=="(date._day, day, "", __FILE__, line); } testDate(Date(1999, 1 , 1), 1999, Month.jan, 1); testDate(Date(1999, 7 , 1), 1999, Month.jul, 1); testDate(Date(1999, 7 , 6), 1999, Month.jul, 6); //Test A.D. assertThrown!DateTimeException(Date(1, 0, 1)); assertThrown!DateTimeException(Date(1, 1, 0)); assertThrown!DateTimeException(Date(1999, 13, 1)); assertThrown!DateTimeException(Date(1999, 1, 32)); assertThrown!DateTimeException(Date(1999, 2, 29)); assertThrown!DateTimeException(Date(2000, 2, 30)); assertThrown!DateTimeException(Date(1999, 3, 32)); assertThrown!DateTimeException(Date(1999, 4, 31)); assertThrown!DateTimeException(Date(1999, 5, 32)); assertThrown!DateTimeException(Date(1999, 6, 31)); assertThrown!DateTimeException(Date(1999, 7, 32)); assertThrown!DateTimeException(Date(1999, 8, 32)); assertThrown!DateTimeException(Date(1999, 9, 31)); assertThrown!DateTimeException(Date(1999, 10, 32)); assertThrown!DateTimeException(Date(1999, 11, 31)); assertThrown!DateTimeException(Date(1999, 12, 32)); assertNotThrown!DateTimeException(Date(1999, 1, 31)); assertNotThrown!DateTimeException(Date(1999, 2, 28)); assertNotThrown!DateTimeException(Date(2000, 2, 29)); assertNotThrown!DateTimeException(Date(1999, 3, 31)); assertNotThrown!DateTimeException(Date(1999, 4, 30)); assertNotThrown!DateTimeException(Date(1999, 5, 31)); assertNotThrown!DateTimeException(Date(1999, 6, 30)); assertNotThrown!DateTimeException(Date(1999, 7, 31)); assertNotThrown!DateTimeException(Date(1999, 8, 31)); assertNotThrown!DateTimeException(Date(1999, 9, 30)); assertNotThrown!DateTimeException(Date(1999, 10, 31)); assertNotThrown!DateTimeException(Date(1999, 11, 30)); assertNotThrown!DateTimeException(Date(1999, 12, 31)); //Test B.C. assertNotThrown!DateTimeException(Date(0, 1, 1)); assertNotThrown!DateTimeException(Date(-1, 1, 1)); assertNotThrown!DateTimeException(Date(-1, 12, 31)); assertNotThrown!DateTimeException(Date(-1, 2, 28)); assertNotThrown!DateTimeException(Date(-4, 2, 29)); assertThrown!DateTimeException(Date(-1, 2, 29)); assertThrown!DateTimeException(Date(-2, 2, 29)); assertThrown!DateTimeException(Date(-3, 2, 29)); } } /++ Params: day = The Xth day of the Gregorian Calendar that the constructed $(D Date) will be for. +/ this(int day) pure nothrow { if(day > 0) { int years = (day / daysIn400Years) * 400 + 1; day %= daysIn400Years; { immutable tempYears = day / daysIn100Years; if(tempYears == 4) { years += 300; day -= daysIn100Years * 3; } else { years += tempYears * 100; day %= daysIn100Years; } } years += (day / daysIn4Years) * 4; day %= daysIn4Years; { immutable tempYears = day / daysInYear; if(tempYears == 4) { years += 3; day -= daysInYear * 3; } else { years += tempYears; day %= daysInYear; } } if(day == 0) { _year = cast(short)(years - 1); _month = Month.dec; _day = 31; } else { _year = cast(short)years; try dayOfYear = day; catch(Exception e) assert(0, "dayOfYear assignment threw."); } } else if(day <= 0 && -day < daysInLeapYear) { _year = 0; try dayOfYear = (daysInLeapYear + day); catch(Exception e) assert(0, "dayOfYear assignment threw."); } else { day += daysInLeapYear - 1; int years = (day / daysIn400Years) * 400 - 1; day %= daysIn400Years; { immutable tempYears = day / daysIn100Years; if(tempYears == -4) { years -= 300; day += daysIn100Years * 3; } else { years += tempYears * 100; day %= daysIn100Years; } } years += (day / daysIn4Years) * 4; day %= daysIn4Years; { immutable tempYears = day / daysInYear; if(tempYears == -4) { years -= 3; day += daysInYear * 3; } else { years += tempYears; day %= daysInYear; } } if(day == 0) { _year = cast(short)(years + 1); _month = Month.jan; _day = 1; } else { _year = cast(short)years; immutable newDoY = (yearIsLeapYear(_year) ? daysInLeapYear : daysInYear) + day + 1; try dayOfYear = newDoY; catch(Exception e) assert(0, "dayOfYear assignment threw."); } } } version(testStdDateTime) unittest { //Test A.D. foreach(gd; chain(testGregDaysBC, testGregDaysAD)) _assertPred!"=="(Date(gd.day), gd.date); } /++ Compares this $(D Date) with the given $(D Date). Returns: $(BOOKTABLE, $(TR $(TD this &lt; rhs) $(TD &lt; 0)) $(TR $(TD this == rhs) $(TD 0)) $(TR $(TD this &gt; rhs) $(TD &gt; 0)) ) +/ int opCmp(in Date rhs) const pure nothrow { if(_year < rhs._year) return -1; if(_year > rhs._year) return 1; if(_month < rhs._month) return -1; if(_month > rhs._month) return 1; if(_day < rhs._day) return -1; if(_day > rhs._day) return 1; return 0; } unittest { version(testStdDateTime) { //Test A.D. _assertPred!("opCmp", "==")(Date(1, 1, 1), Date.init); _assertPred!("opCmp", "==")(Date(1999, 1, 1), Date(1999, 1, 1)); _assertPred!("opCmp", "==")(Date(1, 7, 1), Date(1, 7, 1)); _assertPred!("opCmp", "==")(Date(1, 1, 6), Date(1, 1, 6)); _assertPred!("opCmp", "==")(Date(1999, 7, 1), Date(1999, 7, 1)); _assertPred!("opCmp", "==")(Date(1999, 7, 6), Date(1999, 7, 6)); _assertPred!("opCmp", "==")(Date(1, 7, 6), Date(1, 7, 6)); _assertPred!("opCmp", "<")(Date(1999, 7, 6), Date(2000, 7, 6)); _assertPred!("opCmp", ">")(Date(2000, 7, 6), Date(1999, 7, 6)); _assertPred!("opCmp", "<")(Date(1999, 7, 6), Date(1999, 8, 6)); _assertPred!("opCmp", ">")(Date(1999, 8, 6), Date(1999, 7, 6)); _assertPred!("opCmp", "<")(Date(1999, 7, 6), Date(1999, 7, 7)); _assertPred!("opCmp", ">")(Date(1999, 7, 7), Date(1999, 7, 6)); _assertPred!("opCmp", "<")(Date(1999, 8, 7), Date(2000, 7, 6)); _assertPred!("opCmp", ">")(Date(2000, 8, 6), Date(1999, 7, 7)); _assertPred!("opCmp", "<")(Date(1999, 7, 7), Date(2000, 7, 6)); _assertPred!("opCmp", ">")(Date(2000, 7, 6), Date(1999, 7, 7)); _assertPred!("opCmp", "<")(Date(1999, 7, 7), Date(1999, 8, 6)); _assertPred!("opCmp", ">")(Date(1999, 8, 6), Date(1999, 7, 7)); //Test B.C. _assertPred!("opCmp", "==")(Date(0, 1, 1), Date(0, 1, 1)); _assertPred!("opCmp", "==")(Date(-1, 1, 1), Date(-1, 1, 1)); _assertPred!("opCmp", "==")(Date(-1, 7, 1), Date(-1, 7, 1)); _assertPred!("opCmp", "==")(Date(-1, 1, 6), Date(-1, 1, 6)); _assertPred!("opCmp", "==")(Date(-1999, 7, 1), Date(-1999, 7, 1)); _assertPred!("opCmp", "==")(Date(-1999, 7, 6), Date(-1999, 7, 6)); _assertPred!("opCmp", "==")(Date(-1, 7, 6), Date(-1, 7, 6)); _assertPred!("opCmp", "<")(Date(-2000, 7, 6), Date(-1999, 7, 6)); _assertPred!("opCmp", ">")(Date(-1999, 7, 6), Date(-2000, 7, 6)); _assertPred!("opCmp", "<")(Date(-1999, 7, 6), Date(-1999, 8, 6)); _assertPred!("opCmp", ">")(Date(-1999, 8, 6), Date(-1999, 7, 6)); _assertPred!("opCmp", "<")(Date(-1999, 7, 6), Date(-1999, 7, 7)); _assertPred!("opCmp", ">")(Date(-1999, 7, 7), Date(-1999, 7, 6)); _assertPred!("opCmp", "<")(Date(-2000, 8, 6), Date(-1999, 7, 7)); _assertPred!("opCmp", ">")(Date(-1999, 8, 7), Date(-2000, 7, 6)); _assertPred!("opCmp", "<")(Date(-2000, 7, 6), Date(-1999, 7, 7)); _assertPred!("opCmp", ">")(Date(-1999, 7, 7), Date(-2000, 7, 6)); _assertPred!("opCmp", "<")(Date(-1999, 7, 7), Date(-1999, 8, 6)); _assertPred!("opCmp", ">")(Date(-1999, 8, 6), Date(-1999, 7, 7)); //Test Both _assertPred!("opCmp", "<")(Date(-1999, 7, 6), Date(1999, 7, 6)); _assertPred!("opCmp", ">")(Date(1999, 7, 6), Date(-1999, 7, 6)); _assertPred!("opCmp", "<")(Date(-1999, 8, 6), Date(1999, 7, 6)); _assertPred!("opCmp", ">")(Date(1999, 7, 6), Date(-1999, 8, 6)); _assertPred!("opCmp", "<")(Date(-1999, 7, 7), Date(1999, 7, 6)); _assertPred!("opCmp", ">")(Date(1999, 7, 6), Date(-1999, 7, 7)); _assertPred!("opCmp", "<")(Date(-1999, 8, 7), Date(1999, 7, 6)); _assertPred!("opCmp", ">")(Date(1999, 7, 6), Date(-1999, 8, 7)); _assertPred!("opCmp", "<")(Date(-1999, 8, 6), Date(1999, 6, 6)); _assertPred!("opCmp", ">")(Date(1999, 6, 8), Date(-1999, 7, 6)); auto date = Date(1999, 7, 6); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, date.opCmp(date))); static assert(__traits(compiles, date.opCmp(cdate))); static assert(__traits(compiles, date.opCmp(idate))); static assert(__traits(compiles, cdate.opCmp(date))); static assert(__traits(compiles, cdate.opCmp(cdate))); static assert(__traits(compiles, cdate.opCmp(idate))); static assert(__traits(compiles, idate.opCmp(date))); static assert(__traits(compiles, idate.opCmp(cdate))); static assert(__traits(compiles, idate.opCmp(idate))); } } /++ Year of the Gregorian Calendar. Positive numbers are A.D. Non-positive are B.C. Examples: -------------------- assert(Date(1999, 7, 6).year == 1999); assert(Date(2010, 10, 4).year == 2010); assert(Date(-7, 4, 5).year == -7); -------------------- +/ @property short year() const pure nothrow { return _year; } unittest { version(testStdDateTime) { _assertPred!"=="(Date.init.year, 1); _assertPred!"=="(Date(1999, 7, 6).year, 1999); _assertPred!"=="(Date(-1999, 7, 6).year, -1999); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, cdate.year == 1999)); static assert(__traits(compiles, idate.year == 1999)); //Verify Examples. assert(Date(1999, 7, 6).year == 1999); assert(Date(2010, 10, 4).year == 2010); assert(Date(-7, 4, 5).year == -7); } } /++ Year of the Gregorian Calendar. Positive numbers are A.D. Non-positive are B.C. Params: year = The year to set this Date's year to. Throws: $(D DateTimeException) if the new year is not a leap year and the resulting date would be on February 29th. +/ @property void year(int year) pure { enforceValid!"days"(year, _month, _day); _year = cast(short)year; } unittest { version(testStdDateTime) { static void testDateInvalid(Date date, int year) { date.year = year; } static void testDate(Date date, int year, in Date expected, size_t line = __LINE__) { date.year = year; _assertPred!"=="(date, expected, "", __FILE__, line); } assertThrown!DateTimeException(testDateInvalid(Date(4, 2, 29), 1)); testDate(Date(1, 1, 1), 1999, Date(1999, 1, 1)); testDate(Date(1, 1, 1), 0, Date(0, 1, 1)); testDate(Date(1, 1, 1), -1999, Date(-1999, 1, 1)); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(!__traits(compiles, cdate.year = 1999)); static assert(!__traits(compiles, idate.year = 1999)); //Verify Examples. assert(Date(1999, 7, 6).year == 1999); assert(Date(2010, 10, 4).year == 2010); assert(Date(-7, 4, 5).year == -7); } } /++ Year B.C. of the Gregorian Calendar counting year 0 as 1 B.C. Throws: $(D DateTimeException) if $(D isAD) is true. Examples: -------------------- assert(Date(0, 1, 1).yearBC == 1); assert(Date(-1, 1, 1).yearBC == 2); assert(Date(-100, 1, 1).yearBC == 101); -------------------- +/ @property ushort yearBC() const pure { if(isAD) throw new DateTimeException("Year " ~ numToString(_year) ~ " is A.D."); //Once format is pure, this would be a better error message. //throw new DateTimeException(format("%s is A.D.", this)); return cast(ushort)((_year * -1) + 1); } unittest { version(testStdDateTime) { assertThrown!DateTimeException((in Date date){date.yearBC;}(Date(1, 1, 1))); auto date = Date(0, 7, 6); const cdate = Date(0, 7, 6); immutable idate = Date(0, 7, 6); static assert(__traits(compiles, date.yearBC)); static assert(__traits(compiles, cdate.yearBC)); static assert(__traits(compiles, idate.yearBC)); //Verify Examples. assert(Date(0, 1, 1).yearBC == 1); assert(Date(-1, 1, 1).yearBC == 2); assert(Date(-100, 1, 1).yearBC == 101); } } /++ Year B.C. of the Gregorian Calendar counting year 0 as 1 B.C. Params: year = The year B.C. to set this $(D Date)'s year to. Throws: $(D DateTimeException) if a non-positive value is given. Examples: -------------------- auto date = Date(2010, 1, 1); date.yearBC = 1; assert(date == Date(0, 1, 1)); date.yearBC = 10; assert(date == Date(-9, 1, 1)); -------------------- +/ @property void yearBC(int year) pure { if(year <= 0) throw new DateTimeException("The given year is not a year B.C."); _year = cast(short)((year - 1) * -1); } unittest { version(testStdDateTime) { assertThrown!DateTimeException((Date date){date.yearBC = -1;}(Date(1, 1, 1))); { auto date = Date(0, 7, 6); const cdate = Date(0, 7, 6); immutable idate = Date(0, 7, 6); static assert(__traits(compiles, date.yearBC = 7)); static assert(!__traits(compiles, cdate.yearBC = 7)); static assert(!__traits(compiles, idate.yearBC = 7)); } //Verify Examples. { auto date = Date(2010, 1, 1); date.yearBC = 1; assert(date == Date(0, 1, 1)); date.yearBC = 10; assert(date == Date(-9, 1, 1)); } } } /++ Month of a Gregorian Year. Examples: -------------------- assert(Date(1999, 7, 6).month == 7); assert(Date(2010, 10, 4).month == 10); assert(Date(-7, 4, 5).month == 4); -------------------- +/ @property Month month() const pure nothrow { return _month; } unittest { version(testStdDateTime) { _assertPred!"=="(Date.init.month, 1); _assertPred!"=="(Date(1999, 7, 6).month, 7); _assertPred!"=="(Date(-1999, 7, 6).month, 7); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, cdate.month == 7)); static assert(__traits(compiles, idate.month == 7)); //Verify Examples. assert(Date(1999, 7, 6).month == 7); assert(Date(2010, 10, 4).month == 10); assert(Date(-7, 4, 5).month == 4); } } /++ Month of a Gregorian Year. Params: month = The month to set this $(D Date)'s month to. Throws: $(D DateTimeException) if the given month is not a valid month or if the current day would not be valid in the given month. +/ @property void month(Month month) pure { enforceValid!"months"(month); enforceValid!"days"(_year, month, _day); _month = cast(Month)month; } unittest { version(testStdDateTime) { static void testDate(Date date, Month month, in Date expected = Date.init, size_t line = __LINE__) { date.month = month; assert(expected != Date.init); _assertPred!"=="(date, expected, "", __FILE__, line); } assertThrown!DateTimeException(testDate(Date(1, 1, 1), cast(Month)0)); assertThrown!DateTimeException(testDate(Date(1, 1, 1), cast(Month)13)); assertThrown!DateTimeException(testDate(Date(1, 1, 29), cast(Month)2)); assertThrown!DateTimeException(testDate(Date(0, 1, 30), cast(Month)2)); testDate(Date(1, 1, 1), cast(Month)7, Date(1, 7, 1)); testDate(Date(-1, 1, 1), cast(Month)7, Date(-1, 7, 1)); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(!__traits(compiles, cdate.month = 7)); static assert(!__traits(compiles, idate.month = 7)); } } /++ Day of a Gregorian Month. Examples: -------------------- assert(Date(1999, 7, 6).day == 6); assert(Date(2010, 10, 4).day == 4); assert(Date(-7, 4, 5).day == 5); -------------------- +/ @property ubyte day() const pure nothrow { return _day; } //Verify Examples. version(testStdDateTime) unittest { assert(Date(1999, 7, 6).day == 6); assert(Date(2010, 10, 4).day == 4); assert(Date(-7, 4, 5).day == 5); } version(testStdDateTime) unittest { static void test(Date date, int expected, size_t line = __LINE__) { _assertPred!"=="(date.day, expected, format("Value given: %s", date), __FILE__, line); } foreach(year; chain(testYearsBC, testYearsAD)) { foreach(md; testMonthDays) test(Date(year, md.month, md.day), md.day); } const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, cdate.day == 6)); static assert(__traits(compiles, idate.day == 6)); } /++ Day of a Gregorian Month. Params: day = The day of the month to set this $(D Date)'s day to. Throws: $(D DateTimeException) if the given day is not a valid day of the current month. +/ @property void day(int day) pure { enforceValid!"days"(_year, _month, day); _day = cast(ubyte)day; } unittest { version(testStdDateTime) { static void testDate(Date date, int day) { date.day = day; } //Test A.D. assertThrown!DateTimeException(testDate(Date(1, 1, 1), 0)); assertThrown!DateTimeException(testDate(Date(1, 1, 1), 32)); assertThrown!DateTimeException(testDate(Date(1, 2, 1), 29)); assertThrown!DateTimeException(testDate(Date(4, 2, 1), 30)); assertThrown!DateTimeException(testDate(Date(1, 3, 1), 32)); assertThrown!DateTimeException(testDate(Date(1, 4, 1), 31)); assertThrown!DateTimeException(testDate(Date(1, 5, 1), 32)); assertThrown!DateTimeException(testDate(Date(1, 6, 1), 31)); assertThrown!DateTimeException(testDate(Date(1, 7, 1), 32)); assertThrown!DateTimeException(testDate(Date(1, 8, 1), 32)); assertThrown!DateTimeException(testDate(Date(1, 9, 1), 31)); assertThrown!DateTimeException(testDate(Date(1, 10, 1), 32)); assertThrown!DateTimeException(testDate(Date(1, 11, 1), 31)); assertThrown!DateTimeException(testDate(Date(1, 12, 1), 32)); assertNotThrown!DateTimeException(testDate(Date(1, 1, 1), 31)); assertNotThrown!DateTimeException(testDate(Date(1, 2, 1), 28)); assertNotThrown!DateTimeException(testDate(Date(4, 2, 1), 29)); assertNotThrown!DateTimeException(testDate(Date(1, 3, 1), 31)); assertNotThrown!DateTimeException(testDate(Date(1, 4, 1), 30)); assertNotThrown!DateTimeException(testDate(Date(1, 5, 1), 31)); assertNotThrown!DateTimeException(testDate(Date(1, 6, 1), 30)); assertNotThrown!DateTimeException(testDate(Date(1, 7, 1), 31)); assertNotThrown!DateTimeException(testDate(Date(1, 8, 1), 31)); assertNotThrown!DateTimeException(testDate(Date(1, 9, 1), 30)); assertNotThrown!DateTimeException(testDate(Date(1, 10, 1), 31)); assertNotThrown!DateTimeException(testDate(Date(1, 11, 1), 30)); assertNotThrown!DateTimeException(testDate(Date(1, 12, 1), 31)); { auto date = Date(1, 1, 1); date.day = 6; _assertPred!"=="(date, Date(1, 1, 6)); } //Test B.C. assertThrown!DateTimeException(testDate(Date(-1, 1, 1), 0)); assertThrown!DateTimeException(testDate(Date(-1, 1, 1), 32)); assertThrown!DateTimeException(testDate(Date(-1, 2, 1), 29)); assertThrown!DateTimeException(testDate(Date(0, 2, 1), 30)); assertThrown!DateTimeException(testDate(Date(-1, 3, 1), 32)); assertThrown!DateTimeException(testDate(Date(-1, 4, 1), 31)); assertThrown!DateTimeException(testDate(Date(-1, 5, 1), 32)); assertThrown!DateTimeException(testDate(Date(-1, 6, 1), 31)); assertThrown!DateTimeException(testDate(Date(-1, 7, 1), 32)); assertThrown!DateTimeException(testDate(Date(-1, 8, 1), 32)); assertThrown!DateTimeException(testDate(Date(-1, 9, 1), 31)); assertThrown!DateTimeException(testDate(Date(-1, 10, 1), 32)); assertThrown!DateTimeException(testDate(Date(-1, 11, 1), 31)); assertThrown!DateTimeException(testDate(Date(-1, 12, 1), 32)); assertNotThrown!DateTimeException(testDate(Date(-1, 1, 1), 31)); assertNotThrown!DateTimeException(testDate(Date(-1, 2, 1), 28)); assertNotThrown!DateTimeException(testDate(Date(0, 2, 1), 29)); assertNotThrown!DateTimeException(testDate(Date(-1, 3, 1), 31)); assertNotThrown!DateTimeException(testDate(Date(-1, 4, 1), 30)); assertNotThrown!DateTimeException(testDate(Date(-1, 5, 1), 31)); assertNotThrown!DateTimeException(testDate(Date(-1, 6, 1), 30)); assertNotThrown!DateTimeException(testDate(Date(-1, 7, 1), 31)); assertNotThrown!DateTimeException(testDate(Date(-1, 8, 1), 31)); assertNotThrown!DateTimeException(testDate(Date(-1, 9, 1), 30)); assertNotThrown!DateTimeException(testDate(Date(-1, 10, 1), 31)); assertNotThrown!DateTimeException(testDate(Date(-1, 11, 1), 30)); assertNotThrown!DateTimeException(testDate(Date(-1, 12, 1), 31)); { auto date = Date(-1, 1, 1); date.day = 6; _assertPred!"=="(date, Date(-1, 1, 6)); } const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(!__traits(compiles, cdate.day = 6)); static assert(!__traits(compiles, idate.day = 6)); } } /++ Adds the given number of years or months to this $(D Date). A negative number will subtract. Note that if day overflow is allowed, and the date with the adjusted year/month overflows the number of days in the new month, then the month will be incremented by one, and the day set to the number of days overflowed. (e.g. if the day were 31 and the new month were June, then the month would be incremented to July, and the new day would be 1). If day overflow is not allowed, then the day will be set to the last valid day in the month (e.g. June 31st would become June 30th). Params: units = The type of units to add ("years" or "months"). value = The number of months or years to add to this $(D Date). allowOverflow = Whether the day should be allowed to overflow, causing the month to increment. Examples: -------------------- auto d1 = Date(2010, 1, 1); d1.add!"months"(11); assert(d1 == Date(2010, 12, 1)); auto d2 = Date(2010, 1, 1); d2.add!"months"(-11); assert(d2 == Date(2009, 2, 1)); auto d3 = Date(2000, 2, 29); d3.add!"years"(1); assert(d3 == Date(2001, 3, 1)); auto d4 = Date(2000, 2, 29); d4.add!"years"(1, AllowDayOverflow.no); assert(d4 == Date(2001, 2, 28)); -------------------- +/ /+ref Date+/ void add(string units)(long value, AllowDayOverflow allowOverflow = AllowDayOverflow.yes) pure nothrow if(units == "years") { immutable newYear = _year + value; _year += value; if(_month == Month.feb && _day == 29 && !yearIsLeapYear(_year)) { if(allowOverflow == AllowDayOverflow.yes) { _month = Month.mar; _day = 1; } else _day = 28; } } //Verify Examples. unittest { version(stdStdDateTime) { auto d1 = Date(2010, 1, 1); d1.add!"months"(11); assert(d1 == Date(2010, 12, 1)); auto d2 = Date(2010, 1, 1); d2.add!"months"(-11); assert(d2 == Date(2009, 2, 1)); auto d3 = Date(2000, 2, 29); d3.add!"years"(1); assert(d3 == Date(2001, 3, 1)); auto d4 = Date(2000, 2, 29); d4.add!"years"(1, AllowDayOverflow.no); assert(d4 == Date(2001, 2, 28)); } } //Test add!"years"() with AllowDayOverlow.yes unittest { version(testStdDateTime) { //Test A.D. { auto date = Date(1999, 7, 6); date.add!"years"(7); _assertPred!"=="(date, Date(2006, 7, 6)); date.add!"years"(-9); _assertPred!"=="(date, Date(1997, 7, 6)); } { auto date = Date(1999, 2, 28); date.add!"years"(1); _assertPred!"=="(date, Date(2000, 2, 28)); } { auto date = Date(2000, 2, 29); date.add!"years"(-1); _assertPred!"=="(date, Date(1999, 3, 1)); } //Test B.C. { auto date = Date(-1999, 7, 6); date.add!"years"(-7); _assertPred!"=="(date, Date(-2006, 7, 6)); date.add!"years"(9); _assertPred!"=="(date, Date(-1997, 7, 6)); } { auto date = Date(-1999, 2, 28); date.add!"years"(-1); _assertPred!"=="(date, Date(-2000, 2, 28)); } { auto date = Date(-2000, 2, 29); date.add!"years"(1); _assertPred!"=="(date, Date(-1999, 3, 1)); } //Test Both { auto date = Date(4, 7, 6); date.add!"years"(-5); _assertPred!"=="(date, Date(-1, 7, 6)); date.add!"years"(5); _assertPred!"=="(date, Date(4, 7, 6)); } { auto date = Date(-4, 7, 6); date.add!"years"(5); _assertPred!"=="(date, Date(1, 7, 6)); date.add!"years"(-5); _assertPred!"=="(date, Date(-4, 7, 6)); } { auto date = Date(4, 7, 6); date.add!"years"(-8); _assertPred!"=="(date, Date(-4, 7, 6)); date.add!"years"(8); _assertPred!"=="(date, Date(4, 7, 6)); } { auto date = Date(-4, 7, 6); date.add!"years"(8); _assertPred!"=="(date, Date(4, 7, 6)); date.add!"years"(-8); _assertPred!"=="(date, Date(-4, 7, 6)); } { auto date = Date(-4, 2, 29); date.add!"years"(5); _assertPred!"=="(date, Date(1, 3, 1)); } { auto date = Date(4, 2, 29); date.add!"years"(-5); _assertPred!"=="(date, Date(-1, 3, 1)); } const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(!__traits(compiles, cdate.add!"years"(7))); static assert(!__traits(compiles, idate.add!"years"(7))); } } //Test add!"years"() with AllowDayOverlow.no unittest { version(testStdDateTime) { //Test A.D. { auto date = Date(1999, 7, 6); date.add!"years"(7, AllowDayOverflow.no); _assertPred!"=="(date, Date(2006, 7, 6)); date.add!"years"(-9, AllowDayOverflow.no); _assertPred!"=="(date, Date(1997, 7, 6)); } { auto date = Date(1999, 2, 28); date.add!"years"(1, AllowDayOverflow.no); _assertPred!"=="(date, Date(2000, 2, 28)); } { auto date = Date(2000, 2, 29); date.add!"years"(-1, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 2, 28)); } //Test B.C. { auto date = Date(-1999, 7, 6); date.add!"years"(-7, AllowDayOverflow.no); _assertPred!"=="(date, Date(-2006, 7, 6)); date.add!"years"(9, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1997, 7, 6)); } { auto date = Date(-1999, 2, 28); date.add!"years"(-1, AllowDayOverflow.no); _assertPred!"=="(date, Date(-2000, 2, 28)); } { auto date = Date(-2000, 2, 29); date.add!"years"(1, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 2, 28)); } //Test Both { auto date = Date(4, 7, 6); date.add!"years"(-5, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1, 7, 6)); date.add!"years"(5, AllowDayOverflow.no); _assertPred!"=="(date, Date(4, 7, 6)); } { auto date = Date(-4, 7, 6); date.add!"years"(5, AllowDayOverflow.no); _assertPred!"=="(date, Date(1, 7, 6)); date.add!"years"(-5, AllowDayOverflow.no); _assertPred!"=="(date, Date(-4, 7, 6)); } { auto date = Date(4, 7, 6); date.add!"years"(-8, AllowDayOverflow.no); _assertPred!"=="(date, Date(-4, 7, 6)); date.add!"years"(8, AllowDayOverflow.no); _assertPred!"=="(date, Date(4, 7, 6)); } { auto date = Date(-4, 7, 6); date.add!"years"(8, AllowDayOverflow.no); _assertPred!"=="(date, Date(4, 7, 6)); date.add!"years"(-8, AllowDayOverflow.no); _assertPred!"=="(date, Date(-4, 7, 6)); } { auto date = Date(-4, 2, 29); date.add!"years"(5, AllowDayOverflow.no); _assertPred!"=="(date, Date(1, 2, 28)); } { auto date = Date(4, 2, 29); date.add!"years"(-5, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1, 2, 28)); } } } //Shares documentation with "years" version. /+ref Date+/ void add(string units)(long months, AllowDayOverflow allowOverflow = AllowDayOverflow.yes) pure nothrow if(units == "months") { auto years = months / 12; months %= 12; auto newMonth = _month + months; if(months < 0) { if(newMonth < 1) { newMonth += 12; --years; } } else if(newMonth > 12) { newMonth -= 12; ++years; } _year += years; _month = cast(Month)newMonth; immutable currMaxDay = maxDay(_year, _month); immutable overflow = _day - currMaxDay; if(overflow > 0) { if(allowOverflow == AllowDayOverflow.yes) { ++_month; _day = cast(ubyte)overflow; } else _day = cast(ubyte)currMaxDay; } } //Test add!"months"() with AllowDayOverlow.yes unittest { version(testStdDateTime) { //Test A.D. { auto date = Date(1999, 7, 6); date.add!"months"(3); _assertPred!"=="(date, Date(1999, 10, 6)); date.add!"months"(-4); _assertPred!"=="(date, Date(1999, 6, 6)); } { auto date = Date(1999, 7, 6); date.add!"months"(6); _assertPred!"=="(date, Date(2000, 1, 6)); date.add!"months"(-6); _assertPred!"=="(date, Date(1999, 7, 6)); } { auto date = Date(1999, 7, 6); date.add!"months"(27); _assertPred!"=="(date, Date(2001, 10, 6)); date.add!"months"(-28); _assertPred!"=="(date, Date(1999, 6, 6)); } { auto date = Date(1999, 5, 31); date.add!"months"(1); _assertPred!"=="(date, Date(1999, 7, 1)); } { auto date = Date(1999, 5, 31); date.add!"months"(-1); _assertPred!"=="(date, Date(1999, 5, 1)); } { auto date = Date(1999, 2, 28); date.add!"months"(12); _assertPred!"=="(date, Date(2000, 2, 28)); } { auto date = Date(2000, 2, 29); date.add!"months"(12); _assertPred!"=="(date, Date(2001, 3, 1)); } { auto date = Date(1999, 7, 31); date.add!"months"(1); _assertPred!"=="(date, Date(1999, 8, 31)); date.add!"months"(1); _assertPred!"=="(date, Date(1999, 10, 1)); } { auto date = Date(1998, 8, 31); date.add!"months"(13); _assertPred!"=="(date, Date(1999, 10, 1)); date.add!"months"(-13); _assertPred!"=="(date, Date(1998, 9, 1)); } { auto date = Date(1997, 12, 31); date.add!"months"(13); _assertPred!"=="(date, Date(1999, 1, 31)); date.add!"months"(-13); _assertPred!"=="(date, Date(1997, 12, 31)); } { auto date = Date(1997, 12, 31); date.add!"months"(14); _assertPred!"=="(date, Date(1999, 3, 3)); date.add!"months"(-14); _assertPred!"=="(date, Date(1998, 1, 3)); } { auto date = Date(1998, 12, 31); date.add!"months"(14); _assertPred!"=="(date, Date(2000, 3, 2)); date.add!"months"(-14); _assertPred!"=="(date, Date(1999, 1, 2)); } { auto date = Date(1999, 12, 31); date.add!"months"(14); _assertPred!"=="(date, Date(2001, 3, 3)); date.add!"months"(-14); _assertPred!"=="(date, Date(2000, 1, 3)); } //Test B.C. { auto date = Date(-1999, 7, 6); date.add!"months"(3); _assertPred!"=="(date, Date(-1999, 10, 6)); date.add!"months"(-4); _assertPred!"=="(date, Date(-1999, 6, 6)); } { auto date = Date(-1999, 7, 6); date.add!"months"(6); _assertPred!"=="(date, Date(-1998, 1, 6)); date.add!"months"(-6); _assertPred!"=="(date, Date(-1999, 7, 6)); } { auto date = Date(-1999, 7, 6); date.add!"months"(-27); _assertPred!"=="(date, Date(-2001, 4, 6)); date.add!"months"(28); _assertPred!"=="(date, Date(-1999, 8, 6)); } { auto date = Date(-1999, 5, 31); date.add!"months"(1); _assertPred!"=="(date, Date(-1999, 7, 1)); } { auto date = Date(-1999, 5, 31); date.add!"months"(-1); _assertPred!"=="(date, Date(-1999, 5, 1)); } { auto date = Date(-1999, 2, 28); date.add!"months"(-12); _assertPred!"=="(date, Date(-2000, 2, 28)); } { auto date = Date(-2000, 2, 29); date.add!"months"(-12); _assertPred!"=="(date, Date(-2001, 3, 1)); } { auto date = Date(-1999, 7, 31); date.add!"months"(1); _assertPred!"=="(date, Date(-1999, 8, 31)); date.add!"months"(1); _assertPred!"=="(date, Date(-1999, 10, 1)); } { auto date = Date(-1998, 8, 31); date.add!"months"(13); _assertPred!"=="(date, Date(-1997, 10, 1)); date.add!"months"(-13); _assertPred!"=="(date, Date(-1998, 9, 1)); } { auto date = Date(-1997, 12, 31); date.add!"months"(13); _assertPred!"=="(date, Date(-1995, 1, 31)); date.add!"months"(-13); _assertPred!"=="(date, Date(-1997, 12, 31)); } { auto date = Date(-1997, 12, 31); date.add!"months"(14); _assertPred!"=="(date, Date(-1995, 3, 3)); date.add!"months"(-14); _assertPred!"=="(date, Date(-1996, 1, 3)); } { auto date = Date(-2002, 12, 31); date.add!"months"(14); _assertPred!"=="(date, Date(-2000, 3, 2)); date.add!"months"(-14); _assertPred!"=="(date, Date(-2001, 1, 2)); } { auto date = Date(-2001, 12, 31); date.add!"months"(14); _assertPred!"=="(date, Date(-1999, 3, 3)); date.add!"months"(-14); _assertPred!"=="(date, Date(-2000, 1, 3)); } //Test Both { auto date = Date(1, 1, 1); date.add!"months"(-1); _assertPred!"=="(date, Date(0, 12, 1)); date.add!"months"(1); _assertPred!"=="(date, Date(1, 1, 1)); } { auto date = Date(4, 1, 1); date.add!"months"(-48); _assertPred!"=="(date, Date(0, 1, 1)); date.add!"months"(48); _assertPred!"=="(date, Date(4, 1, 1)); } { auto date = Date(4, 3, 31); date.add!"months"(-49); _assertPred!"=="(date, Date(0, 3, 2)); date.add!"months"(49); _assertPred!"=="(date, Date(4, 4, 2)); } { auto date = Date(4, 3, 31); date.add!"months"(-85); _assertPred!"=="(date, Date(-3, 3, 3)); date.add!"months"(85); _assertPred!"=="(date, Date(4, 4, 3)); } const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(!__traits(compiles, cdate.add!"months"(3))); static assert(!__traits(compiles, idate.add!"months"(3))); } } //Test add!"months"() with AllowDayOverlow.no unittest { version(testStdDateTime) { //Test A.D. { auto date = Date(1999, 7, 6); date.add!"months"(3, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 10, 6)); date.add!"months"(-4, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 6, 6)); } { auto date = Date(1999, 7, 6); date.add!"months"(6, AllowDayOverflow.no); _assertPred!"=="(date, Date(2000, 1, 6)); date.add!"months"(-6, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 7, 6)); } { auto date = Date(1999, 7, 6); date.add!"months"(27, AllowDayOverflow.no); _assertPred!"=="(date, Date(2001, 10, 6)); date.add!"months"(-28, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 6, 6)); } { auto date = Date(1999, 5, 31); date.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 6, 30)); } { auto date = Date(1999, 5, 31); date.add!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 4, 30)); } { auto date = Date(1999, 2, 28); date.add!"months"(12, AllowDayOverflow.no); _assertPred!"=="(date, Date(2000, 2, 28)); } { auto date = Date(2000, 2, 29); date.add!"months"(12, AllowDayOverflow.no); _assertPred!"=="(date, Date(2001, 2, 28)); } { auto date = Date(1999, 7, 31); date.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 8, 31)); date.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 9, 30)); } { auto date = Date(1998, 8, 31); date.add!"months"(13, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 9, 30)); date.add!"months"(-13, AllowDayOverflow.no); _assertPred!"=="(date, Date(1998, 8, 30)); } { auto date = Date(1997, 12, 31); date.add!"months"(13, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 1, 31)); date.add!"months"(-13, AllowDayOverflow.no); _assertPred!"=="(date, Date(1997, 12, 31)); } { auto date = Date(1997, 12, 31); date.add!"months"(14, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 2, 28)); date.add!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(date, Date(1997, 12, 28)); } { auto date = Date(1998, 12, 31); date.add!"months"(14, AllowDayOverflow.no); _assertPred!"=="(date, Date(2000, 2, 29)); date.add!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(date, Date(1998, 12, 29)); } { auto date = Date(1999, 12, 31); date.add!"months"(14, AllowDayOverflow.no); _assertPred!"=="(date, Date(2001, 2, 28)); date.add!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 12, 28)); } //Test B.C. { auto date = Date(-1999, 7, 6); date.add!"months"(3, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 10, 6)); date.add!"months"(-4, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 6, 6)); } { auto date = Date(-1999, 7, 6); date.add!"months"(6, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1998, 1, 6)); date.add!"months"(-6, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 7, 6)); } { auto date = Date(-1999, 7, 6); date.add!"months"(-27, AllowDayOverflow.no); _assertPred!"=="(date, Date(-2001, 4, 6)); date.add!"months"(28, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 8, 6)); } { auto date = Date(-1999, 5, 31); date.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 6, 30)); } { auto date = Date(-1999, 5, 31); date.add!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 4, 30)); } { auto date = Date(-1999, 2, 28); date.add!"months"(-12, AllowDayOverflow.no); _assertPred!"=="(date, Date(-2000, 2, 28)); } { auto date = Date(-2000, 2, 29); date.add!"months"(-12, AllowDayOverflow.no); _assertPred!"=="(date, Date(-2001, 2, 28)); } { auto date = Date(-1999, 7, 31); date.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 8, 31)); date.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 9, 30)); } { auto date = Date(-1998, 8, 31); date.add!"months"(13, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1997, 9, 30)); date.add!"months"(-13, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1998, 8, 30)); } { auto date = Date(-1997, 12, 31); date.add!"months"(13, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1995, 1, 31)); date.add!"months"(-13, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1997, 12, 31)); } { auto date = Date(-1997, 12, 31); date.add!"months"(14, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1995, 2, 28)); date.add!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1997, 12, 28)); } { auto date = Date(-2002, 12, 31); date.add!"months"(14, AllowDayOverflow.no); _assertPred!"=="(date, Date(-2000, 2, 29)); date.add!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(date, Date(-2002, 12, 29)); } { auto date = Date(-2001, 12, 31); date.add!"months"(14, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 2, 28)); date.add!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(date, Date(-2001, 12, 28)); } //Test Both { auto date = Date(1, 1, 1); date.add!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(date, Date(0, 12, 1)); date.add!"months"(1, AllowDayOverflow.no); _assertPred!"=="(date, Date(1, 1, 1)); } { auto date = Date(4, 1, 1); date.add!"months"(-48, AllowDayOverflow.no); _assertPred!"=="(date, Date(0, 1, 1)); date.add!"months"(48, AllowDayOverflow.no); _assertPred!"=="(date, Date(4, 1, 1)); } { auto date = Date(4, 3, 31); date.add!"months"(-49, AllowDayOverflow.no); _assertPred!"=="(date, Date(0, 2, 29)); date.add!"months"(49, AllowDayOverflow.no); _assertPred!"=="(date, Date(4, 3, 29)); } { auto date = Date(4, 3, 31); date.add!"months"(-85, AllowDayOverflow.no); _assertPred!"=="(date, Date(-3, 2, 28)); date.add!"months"(85, AllowDayOverflow.no); _assertPred!"=="(date, Date(4, 3, 28)); } } } /++ Adds the given number of years or months to this $(D Date). A negative number will subtract. The difference between rolling and adding is that rolling does not affect larger units. Rolling a $(D Date) 12 months gets the exact same $(D Date). However, the days can still be affected due to the differing number of days in each month. Because there are no units larger than years, there is no difference between adding and rolling years. Params: units = The type of units to add ("years" or "months"). value = The number of months or years to add to this $(D Date). Examples: -------------------- auto d1 = Date(2010, 1, 1); d1.roll!"months"(1); assert(d1 == Date(2010, 2, 1)); auto d2 = Date(2010, 1, 1); d2.roll!"months"(-1); assert(d2 == Date(2010, 12, 1)); auto d3 = Date(1999, 1, 29); d3.roll!"months"(1); assert(d3 == Date(1999, 3, 1)); auto d4 = Date(1999, 1, 29); d4.roll!"months"(1, AllowDayOverflow.no); assert(d4 == Date(1999, 2, 28)); auto d5 = Date(2000, 2, 29); d5.roll!"years"(1); assert(d5 == Date(2001, 3, 1)); auto d6 = Date(2000, 2, 29); d6.roll!"years"(1, AllowDayOverflow.no); assert(d6 == Date(2001, 2, 28)); -------------------- +/ /+ref Date+/ void roll(string units)(long value, AllowDayOverflow allowOverflow = AllowDayOverflow.yes) pure nothrow if(units == "years") { add!"years"(value, allowOverflow); } //Verify Examples. unittest { version(testStdDateTime) { auto d1 = Date(2010, 1, 1); d1.roll!"months"(1); assert(d1 == Date(2010, 2, 1)); auto d2 = Date(2010, 1, 1); d2.roll!"months"(-1); assert(d2 == Date(2010, 12, 1)); auto d3 = Date(1999, 1, 29); d3.roll!"months"(1); assert(d3 == Date(1999, 3, 1)); auto d4 = Date(1999, 1, 29); d4.roll!"months"(1, AllowDayOverflow.no); assert(d4 == Date(1999, 2, 28)); auto d5 = Date(2000, 2, 29); d5.roll!"years"(1); assert(d5 == Date(2001, 3, 1)); auto d6 = Date(2000, 2, 29); d6.roll!"years"(1, AllowDayOverflow.no); assert(d6 == Date(2001, 2, 28)); } } unittest { version(testStdDateTime) { const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(!__traits(compiles, cdate.roll!"years"(3))); static assert(!__traits(compiles, idate.rolYears(3))); } } //Shares documentation with "years" version. /+ref Date+/ void roll(string units)(long months, AllowDayOverflow allowOverflow = AllowDayOverflow.yes) pure nothrow if(units == "months") { months %= 12; auto newMonth = _month + months; if(months < 0) { if(newMonth < 1) newMonth += 12; } else { if(newMonth > 12) newMonth -= 12; } _month = cast(Month)newMonth; immutable currMaxDay = maxDay(_year, _month); immutable overflow = _day - currMaxDay; if(overflow > 0) { if(allowOverflow == AllowDayOverflow.yes) { ++_month; _day = cast(ubyte)overflow; } else _day = cast(ubyte)currMaxDay; } } //Test roll!"months"() with AllowDayOverlow.yes unittest { version(testStdDateTime) { //Test A.D. { auto date = Date(1999, 7, 6); date.roll!"months"(3); _assertPred!"=="(date, Date(1999, 10, 6)); date.roll!"months"(-4); _assertPred!"=="(date, Date(1999, 6, 6)); } { auto date = Date(1999, 7, 6); date.roll!"months"(6); _assertPred!"=="(date, Date(1999, 1, 6)); date.roll!"months"(-6); _assertPred!"=="(date, Date(1999, 7, 6)); } { auto date = Date(1999, 7, 6); date.roll!"months"(27); _assertPred!"=="(date, Date(1999, 10, 6)); date.roll!"months"(-28); _assertPred!"=="(date, Date(1999, 6, 6)); } { auto date = Date(1999, 5, 31); date.roll!"months"(1); _assertPred!"=="(date, Date(1999, 7, 1)); } { auto date = Date(1999, 5, 31); date.roll!"months"(-1); _assertPred!"=="(date, Date(1999, 5, 1)); } { auto date = Date(1999, 2, 28); date.roll!"months"(12); _assertPred!"=="(date, Date(1999, 2, 28)); } { auto date = Date(2000, 2, 29); date.roll!"months"(12); _assertPred!"=="(date, Date(2000, 2, 29)); } { auto date = Date(1999, 7, 31); date.roll!"months"(1); _assertPred!"=="(date, Date(1999, 8, 31)); date.roll!"months"(1); _assertPred!"=="(date, Date(1999, 10, 1)); } { auto date = Date(1998, 8, 31); date.roll!"months"(13); _assertPred!"=="(date, Date(1998, 10, 1)); date.roll!"months"(-13); _assertPred!"=="(date, Date(1998, 9, 1)); } { auto date = Date(1997, 12, 31); date.roll!"months"(13); _assertPred!"=="(date, Date(1997, 1, 31)); date.roll!"months"(-13); _assertPred!"=="(date, Date(1997, 12, 31)); } { auto date = Date(1997, 12, 31); date.roll!"months"(14); _assertPred!"=="(date, Date(1997, 3, 3)); date.roll!"months"(-14); _assertPred!"=="(date, Date(1997, 1, 3)); } { auto date = Date(1998, 12, 31); date.roll!"months"(14); _assertPred!"=="(date, Date(1998, 3, 3)); date.roll!"months"(-14); _assertPred!"=="(date, Date(1998, 1, 3)); } { auto date = Date(1999, 12, 31); date.roll!"months"(14); _assertPred!"=="(date, Date(1999, 3, 3)); date.roll!"months"(-14); _assertPred!"=="(date, Date(1999, 1, 3)); } //Test B.C. { auto date = Date(-1999, 7, 6); date.roll!"months"(3); _assertPred!"=="(date, Date(-1999, 10, 6)); date.roll!"months"(-4); _assertPred!"=="(date, Date(-1999, 6, 6)); } { auto date = Date(-1999, 7, 6); date.roll!"months"(6); _assertPred!"=="(date, Date(-1999, 1, 6)); date.roll!"months"(-6); _assertPred!"=="(date, Date(-1999, 7, 6)); } { auto date = Date(-1999, 7, 6); date.roll!"months"(-27); _assertPred!"=="(date, Date(-1999, 4, 6)); date.roll!"months"(28); _assertPred!"=="(date, Date(-1999, 8, 6)); } { auto date = Date(-1999, 5, 31); date.roll!"months"(1); _assertPred!"=="(date, Date(-1999, 7, 1)); } { auto date = Date(-1999, 5, 31); date.roll!"months"(-1); _assertPred!"=="(date, Date(-1999, 5, 1)); } { auto date = Date(-1999, 2, 28); date.roll!"months"(-12); _assertPred!"=="(date, Date(-1999, 2, 28)); } { auto date = Date(-2000, 2, 29); date.roll!"months"(-12); _assertPred!"=="(date, Date(-2000, 2, 29)); } { auto date = Date(-1999, 7, 31); date.roll!"months"(1); _assertPred!"=="(date, Date(-1999, 8, 31)); date.roll!"months"(1); _assertPred!"=="(date, Date(-1999, 10, 1)); } { auto date = Date(-1998, 8, 31); date.roll!"months"(13); _assertPred!"=="(date, Date(-1998, 10, 1)); date.roll!"months"(-13); _assertPred!"=="(date, Date(-1998, 9, 1)); } { auto date = Date(-1997, 12, 31); date.roll!"months"(13); _assertPred!"=="(date, Date(-1997, 1, 31)); date.roll!"months"(-13); _assertPred!"=="(date, Date(-1997, 12, 31)); } { auto date = Date(-1997, 12, 31); date.roll!"months"(14); _assertPred!"=="(date, Date(-1997, 3, 3)); date.roll!"months"(-14); _assertPred!"=="(date, Date(-1997, 1, 3)); } { auto date = Date(-2002, 12, 31); date.roll!"months"(14); _assertPred!"=="(date, Date(-2002, 3, 3)); date.roll!"months"(-14); _assertPred!"=="(date, Date(-2002, 1, 3)); } { auto date = Date(-2001, 12, 31); date.roll!"months"(14); _assertPred!"=="(date, Date(-2001, 3, 3)); date.roll!"months"(-14); _assertPred!"=="(date, Date(-2001, 1, 3)); } //Test Both { auto date = Date(1, 1, 1); date.roll!"months"(-1); _assertPred!"=="(date, Date(1, 12, 1)); date.roll!"months"(1); _assertPred!"=="(date, Date(1, 1, 1)); } { auto date = Date(4, 1, 1); date.roll!"months"(-48); _assertPred!"=="(date, Date(4, 1, 1)); date.roll!"months"(48); _assertPred!"=="(date, Date(4, 1, 1)); } { auto date = Date(4, 3, 31); date.roll!"months"(-49); _assertPred!"=="(date, Date(4, 3, 2)); date.roll!"months"(49); _assertPred!"=="(date, Date(4, 4, 2)); } { auto date = Date(4, 3, 31); date.roll!"months"(-85); _assertPred!"=="(date, Date(4, 3, 2)); date.roll!"months"(85); _assertPred!"=="(date, Date(4, 4, 2)); } { auto date = Date(-1, 1, 1); date.roll!"months"(-1); _assertPred!"=="(date, Date(-1, 12, 1)); date.roll!"months"(1); _assertPred!"=="(date, Date(-1, 1, 1)); } { auto date = Date(-4, 1, 1); date.roll!"months"(-48); _assertPred!"=="(date, Date(-4, 1, 1)); date.roll!"months"(48); _assertPred!"=="(date, Date(-4, 1, 1)); } { auto date = Date(-4, 3, 31); date.roll!"months"(-49); _assertPred!"=="(date, Date(-4, 3, 2)); date.roll!"months"(49); _assertPred!"=="(date, Date(-4, 4, 2)); } { auto date = Date(-4, 3, 31); date.roll!"months"(-85); _assertPred!"=="(date, Date(-4, 3, 2)); date.roll!"months"(85); _assertPred!"=="(date, Date(-4, 4, 2)); } const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(!__traits(compiles, cdate.roll!"months"(3))); static assert(!__traits(compiles, idate.roll!"months"(3))); //Verify Examples. auto date1 = Date(2010, 1, 1); date1.roll!"months"(1); assert(date1 == Date(2010, 2, 1)); auto date2 = Date(2010, 1, 1); date2.roll!"months"(-1); assert(date2 == Date(2010, 12, 1)); auto date3 = Date(1999, 1, 29); date3.roll!"months"(1); assert(date3 == Date(1999, 3, 1)); auto date4 = Date(1999, 1, 29); date4.roll!"months"(1, AllowDayOverflow.no); assert(date4 == Date(1999, 2, 28)); } } //Test roll!"months"() with AllowDayOverlow.no unittest { version(testStdDateTime) { //Test A.D. { auto date = Date(1999, 7, 6); date.roll!"months"(3, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 10, 6)); date.roll!"months"(-4, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 6, 6)); } { auto date = Date(1999, 7, 6); date.roll!"months"(6, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 1, 6)); date.roll!"months"(-6, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 7, 6)); } { auto date = Date(1999, 7, 6); date.roll!"months"(27, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 10, 6)); date.roll!"months"(-28, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 6, 6)); } { auto date = Date(1999, 5, 31); date.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 6, 30)); } { auto date = Date(1999, 5, 31); date.roll!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 4, 30)); } { auto date = Date(1999, 2, 28); date.roll!"months"(12, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 2, 28)); } { auto date = Date(2000, 2, 29); date.roll!"months"(12, AllowDayOverflow.no); _assertPred!"=="(date, Date(2000, 2, 29)); } { auto date = Date(1999, 7, 31); date.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 8, 31)); date.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 9, 30)); } { auto date = Date(1998, 8, 31); date.roll!"months"(13, AllowDayOverflow.no); _assertPred!"=="(date, Date(1998, 9, 30)); date.roll!"months"(-13, AllowDayOverflow.no); _assertPred!"=="(date, Date(1998, 8, 30)); } { auto date = Date(1997, 12, 31); date.roll!"months"(13, AllowDayOverflow.no); _assertPred!"=="(date, Date(1997, 1, 31)); date.roll!"months"(-13, AllowDayOverflow.no); _assertPred!"=="(date, Date(1997, 12, 31)); } { auto date = Date(1997, 12, 31); date.roll!"months"(14, AllowDayOverflow.no); _assertPred!"=="(date, Date(1997, 2, 28)); date.roll!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(date, Date(1997, 12, 28)); } { auto date = Date(1998, 12, 31); date.roll!"months"(14, AllowDayOverflow.no); _assertPred!"=="(date, Date(1998, 2, 28)); date.roll!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(date, Date(1998, 12, 28)); } { auto date = Date(1999, 12, 31); date.roll!"months"(14, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 2, 28)); date.roll!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(date, Date(1999, 12, 28)); } //Test B.C. { auto date = Date(-1999, 7, 6); date.roll!"months"(3, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 10, 6)); date.roll!"months"(-4, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 6, 6)); } { auto date = Date(-1999, 7, 6); date.roll!"months"(6, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 1, 6)); date.roll!"months"(-6, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 7, 6)); } { auto date = Date(-1999, 7, 6); date.roll!"months"(-27, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 4, 6)); date.roll!"months"(28, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 8, 6)); } { auto date = Date(-1999, 5, 31); date.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 6, 30)); } { auto date = Date(-1999, 5, 31); date.roll!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 4, 30)); } { auto date = Date(-1999, 2, 28); date.roll!"months"(-12, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 2, 28)); } { auto date = Date(-2000, 2, 29); date.roll!"months"(-12, AllowDayOverflow.no); _assertPred!"=="(date, Date(-2000, 2, 29)); } { auto date = Date(-1999, 7, 31); date.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 8, 31)); date.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1999, 9, 30)); } { auto date = Date(-1998, 8, 31); date.roll!"months"(13, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1998, 9, 30)); date.roll!"months"(-13, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1998, 8, 30)); } { auto date = Date(-1997, 12, 31); date.roll!"months"(13, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1997, 1, 31)); date.roll!"months"(-13, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1997, 12, 31)); } { auto date = Date(-1997, 12, 31); date.roll!"months"(14, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1997, 2, 28)); date.roll!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1997, 12, 28)); } { auto date = Date(-2002, 12, 31); date.roll!"months"(14, AllowDayOverflow.no); _assertPred!"=="(date, Date(-2002, 2, 28)); date.roll!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(date, Date(-2002, 12, 28)); } { auto date = Date(-2001, 12, 31); date.roll!"months"(14, AllowDayOverflow.no); _assertPred!"=="(date, Date(-2001, 2, 28)); date.roll!"months"(-14, AllowDayOverflow.no); _assertPred!"=="(date, Date(-2001, 12, 28)); } //Test Both { auto date = Date(1, 1, 1); date.roll!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(date, Date(1, 12, 1)); date.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(date, Date(1, 1, 1)); } { auto date = Date(4, 1, 1); date.roll!"months"(-48, AllowDayOverflow.no); _assertPred!"=="(date, Date(4, 1, 1)); date.roll!"months"(48, AllowDayOverflow.no); _assertPred!"=="(date, Date(4, 1, 1)); } { auto date = Date(4, 3, 31); date.roll!"months"(-49, AllowDayOverflow.no); _assertPred!"=="(date, Date(4, 2, 29)); date.roll!"months"(49, AllowDayOverflow.no); _assertPred!"=="(date, Date(4, 3, 29)); } { auto date = Date(4, 3, 31); date.roll!"months"(-85, AllowDayOverflow.no); _assertPred!"=="(date, Date(4, 2, 29)); date.roll!"months"(85, AllowDayOverflow.no); _assertPred!"=="(date, Date(4, 3, 29)); } { auto date = Date(-1, 1, 1); date.roll!"months"(-1, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1, 12, 1)); date.roll!"months"(1, AllowDayOverflow.no); _assertPred!"=="(date, Date(-1, 1, 1)); } { auto date = Date(-4, 1, 1); date.roll!"months"(-48, AllowDayOverflow.no); _assertPred!"=="(date, Date(-4, 1, 1)); date.roll!"months"(48, AllowDayOverflow.no); _assertPred!"=="(date, Date(-4, 1, 1)); } { auto date = Date(-4, 3, 31); date.roll!"months"(-49, AllowDayOverflow.no); _assertPred!"=="(date, Date(-4, 2, 29)); date.roll!"months"(49, AllowDayOverflow.no); _assertPred!"=="(date, Date(-4, 3, 29)); } { auto date = Date(-4, 3, 31); date.roll!"months"(-85, AllowDayOverflow.no); _assertPred!"=="(date, Date(-4, 2, 29)); date.roll!"months"(85, AllowDayOverflow.no); _assertPred!"=="(date, Date(-4, 3, 29)); } } } /++ Adds the given number of units to this $(D Date). A negative number will subtract. The difference between rolling and adding is that rolling does not affect larger units. For instance, rolling a $(D Date) one year's worth of days gets the exact same $(D Date). The only accepted units are $(D "days"). Params: units = The units to add. Must be $(D "days"). value = The number of days to add to this $(D Date). Examples: -------------------- auto d = Date(2010, 1, 1); d.roll!"days"(1); assert(d == Date(2010, 1, 2)); d.roll!"days"(365); assert(d == Date(2010, 1, 26)); d.roll!"days"(-32); assert(d == Date(2010, 1, 25)); -------------------- +/ /+ref Date+/ void roll(string units)(long days) pure nothrow if(units == "days") { immutable limit = maxDay(_year, _month); days %= limit; auto newDay = _day + days; if(days < 0) { if(newDay < 1) newDay += limit; } else if(newDay > limit) newDay -= limit; _day = cast(ubyte)newDay; } //Verify Examples. unittest { version(testStdDateTime) { auto d = Date(2010, 1, 1); d.roll!"days"(1); assert(d == Date(2010, 1, 2)); d.roll!"days"(365); assert(d == Date(2010, 1, 26)); d.roll!"days"(-32); assert(d == Date(2010, 1, 25)); } } unittest { version(testStdDateTime) { //Test A.D. { auto date = Date(1999, 2, 28); date.roll!"days"(1); _assertPred!"=="(date, Date(1999, 2, 1)); date.roll!"days"(-1); _assertPred!"=="(date, Date(1999, 2, 28)); } { auto date = Date(2000, 2, 28); date.roll!"days"(1); _assertPred!"=="(date, Date(2000, 2, 29)); date.roll!"days"(1); _assertPred!"=="(date, Date(2000, 2, 1)); date.roll!"days"(-1); _assertPred!"=="(date, Date(2000, 2, 29)); } { auto date = Date(1999, 6, 30); date.roll!"days"(1); _assertPred!"=="(date, Date(1999, 6, 1)); date.roll!"days"(-1); _assertPred!"=="(date, Date(1999, 6, 30)); } { auto date = Date(1999, 7, 31); date.roll!"days"(1); _assertPred!"=="(date, Date(1999, 7, 1)); date.roll!"days"(-1); _assertPred!"=="(date, Date(1999, 7, 31)); } { auto date = Date(1999, 1, 1); date.roll!"days"(-1); _assertPred!"=="(date, Date(1999, 1, 31)); date.roll!"days"(1); _assertPred!"=="(date, Date(1999, 1, 1)); } { auto date = Date(1999, 7, 6); date.roll!"days"(9); _assertPred!"=="(date, Date(1999, 7, 15)); date.roll!"days"(-11); _assertPred!"=="(date, Date(1999, 7, 4)); date.roll!"days"(30); _assertPred!"=="(date, Date(1999, 7, 3)); date.roll!"days"(-3); _assertPred!"=="(date, Date(1999, 7, 31)); } { auto date = Date(1999, 7, 6); date.roll!"days"(365); _assertPred!"=="(date, Date(1999, 7, 30)); date.roll!"days"(-365); _assertPred!"=="(date, Date(1999, 7, 6)); date.roll!"days"(366); _assertPred!"=="(date, Date(1999, 7, 31)); date.roll!"days"(730); _assertPred!"=="(date, Date(1999, 7, 17)); date.roll!"days"(-1096); _assertPred!"=="(date, Date(1999, 7, 6)); } { auto date = Date(1999, 2, 6); date.roll!"days"(365); _assertPred!"=="(date, Date(1999, 2, 7)); date.roll!"days"(-365); _assertPred!"=="(date, Date(1999, 2, 6)); date.roll!"days"(366); _assertPred!"=="(date, Date(1999, 2, 8)); date.roll!"days"(730); _assertPred!"=="(date, Date(1999, 2, 10)); date.roll!"days"(-1096); _assertPred!"=="(date, Date(1999, 2, 6)); } //Test B.C. { auto date = Date(-1999, 2, 28); date.roll!"days"(1); _assertPred!"=="(date, Date(-1999, 2, 1)); date.roll!"days"(-1); _assertPred!"=="(date, Date(-1999, 2, 28)); } { auto date = Date(-2000, 2, 28); date.roll!"days"(1); _assertPred!"=="(date, Date(-2000, 2, 29)); date.roll!"days"(1); _assertPred!"=="(date, Date(-2000, 2, 1)); date.roll!"days"(-1); _assertPred!"=="(date, Date(-2000, 2, 29)); } { auto date = Date(-1999, 6, 30); date.roll!"days"(1); _assertPred!"=="(date, Date(-1999, 6, 1)); date.roll!"days"(-1); _assertPred!"=="(date, Date(-1999, 6, 30)); } { auto date = Date(-1999, 7, 31); date.roll!"days"(1); _assertPred!"=="(date, Date(-1999, 7, 1)); date.roll!"days"(-1); _assertPred!"=="(date, Date(-1999, 7, 31)); } { auto date = Date(-1999, 1, 1); date.roll!"days"(-1); _assertPred!"=="(date, Date(-1999, 1, 31)); date.roll!"days"(1); _assertPred!"=="(date, Date(-1999, 1, 1)); } { auto date = Date(-1999, 7, 6); date.roll!"days"(9); _assertPred!"=="(date, Date(-1999, 7, 15)); date.roll!"days"(-11); _assertPred!"=="(date, Date(-1999, 7, 4)); date.roll!"days"(30); _assertPred!"=="(date, Date(-1999, 7, 3)); date.roll!"days"(-3); _assertPred!"=="(date, Date(-1999, 7, 31)); } { auto date = Date(-1999, 7, 6); date.roll!"days"(365); _assertPred!"=="(date, Date(-1999, 7, 30)); date.roll!"days"(-365); _assertPred!"=="(date, Date(-1999, 7, 6)); date.roll!"days"(366); _assertPred!"=="(date, Date(-1999, 7, 31)); date.roll!"days"(730); _assertPred!"=="(date, Date(-1999, 7, 17)); date.roll!"days"(-1096); _assertPred!"=="(date, Date(-1999, 7, 6)); } //Test Both { auto date = Date(1, 7, 6); date.roll!"days"(-365); _assertPred!"=="(date, Date(1, 7, 13)); date.roll!"days"(365); _assertPred!"=="(date, Date(1, 7, 6)); date.roll!"days"(-731); _assertPred!"=="(date, Date(1, 7, 19)); date.roll!"days"(730); _assertPred!"=="(date, Date(1, 7, 5)); } { auto date = Date(0, 7, 6); date.roll!"days"(-365); _assertPred!"=="(date, Date(0, 7, 13)); date.roll!"days"(365); _assertPred!"=="(date, Date(0, 7, 6)); date.roll!"days"(-731); _assertPred!"=="(date, Date(0, 7, 19)); date.roll!"days"(730); _assertPred!"=="(date, Date(0, 7, 5)); } const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(!__traits(compiles, cdate.roll!"days"(12))); static assert(!__traits(compiles, idate.roll!"days"(12))); //Verify Examples. auto date = Date(2010, 1, 1); date.roll!"days"(1); assert(date == Date(2010, 1, 2)); date.roll!"days"(365); assert(date == Date(2010, 1, 26)); date.roll!"days"(-32); assert(date == Date(2010, 1, 25)); } } /++ Gives the result of adding or subtracting a duration from this $(D Date). The legal types of arithmetic for Date using this operator are $(BOOKTABLE, $(TR $(TD Date) $(TD +) $(TD duration) $(TD -->) $(TD Date)) $(TR $(TD Date) $(TD -) $(TD duration) $(TD -->) $(TD Date)) ) Params: duration = The duration to add to or subtract from this $(D Date). +/ Date opBinary(string op, D)(in D duration) const pure nothrow if((op == "+" || op == "-") && (is(Unqual!D == Duration) || is(Unqual!D == TickDuration))) { Date retval = this; static if(is(Unqual!D == Duration)) immutable days = duration.total!"days"; else static if(is(Unqual!D == TickDuration)) immutable days = convert!("hnsecs", "days")(duration.hnsecs); //Ideally, this would just be //return retval.addDays(unaryFun!(op ~ "a")(days)); //But there isn't currently a pure version of unaryFun!(). static if(op == "+") immutable signedDays = days; else static if(op == "-") immutable signedDays = -days; else static assert(0); return retval.addDays(signedDays); } unittest { version(testStdDateTime) { auto date = Date(1999, 7, 6); _assertPred!"=="(date + dur!"weeks"(7), Date(1999, 8, 24)); _assertPred!"=="(date + dur!"weeks"(-7), Date(1999, 5, 18)); _assertPred!"=="(date + dur!"days"(7), Date(1999, 7, 13)); _assertPred!"=="(date + dur!"days"(-7), Date(1999, 6, 29)); _assertPred!"=="(date + dur!"hours"(24), Date(1999, 7, 7)); _assertPred!"=="(date + dur!"hours"(-24), Date(1999, 7, 5)); _assertPred!"=="(date + dur!"minutes"(1440), Date(1999, 7, 7)); _assertPred!"=="(date + dur!"minutes"(-1440), Date(1999, 7, 5)); _assertPred!"=="(date + dur!"seconds"(86_400), Date(1999, 7, 7)); _assertPred!"=="(date + dur!"seconds"(-86_400), Date(1999, 7, 5)); _assertPred!"=="(date + dur!"msecs"(86_400_000), Date(1999, 7, 7)); _assertPred!"=="(date + dur!"msecs"(-86_400_000), Date(1999, 7, 5)); _assertPred!"=="(date + dur!"usecs"(86_400_000_000), Date(1999, 7, 7)); _assertPred!"=="(date + dur!"usecs"(-86_400_000_000), Date(1999, 7, 5)); _assertPred!"=="(date + dur!"hnsecs"(864_000_000_000), Date(1999, 7, 7)); _assertPred!"=="(date + dur!"hnsecs"(-864_000_000_000), Date(1999, 7, 5)); //This probably only runs in cases where gettimeofday() is used, but it's //hard to do this test correctly with variable ticksPerSec. if(TickDuration.ticksPerSec == 1_000_000) { _assertPred!"=="(date + TickDuration.from!"usecs"(86_400_000_000), Date(1999, 7, 7)); _assertPred!"=="(date + TickDuration.from!"usecs"(-86_400_000_000), Date(1999, 7, 5)); } _assertPred!"=="(date - dur!"weeks"(-7), Date(1999, 8, 24)); _assertPred!"=="(date - dur!"weeks"(7), Date(1999, 5, 18)); _assertPred!"=="(date - dur!"days"(-7), Date(1999, 7, 13)); _assertPred!"=="(date - dur!"days"(7), Date(1999, 6, 29)); _assertPred!"=="(date - dur!"hours"(-24), Date(1999, 7, 7)); _assertPred!"=="(date - dur!"hours"(24), Date(1999, 7, 5)); _assertPred!"=="(date - dur!"minutes"(-1440), Date(1999, 7, 7)); _assertPred!"=="(date - dur!"minutes"(1440), Date(1999, 7, 5)); _assertPred!"=="(date - dur!"seconds"(-86_400), Date(1999, 7, 7)); _assertPred!"=="(date - dur!"seconds"(86_400), Date(1999, 7, 5)); _assertPred!"=="(date - dur!"msecs"(-86_400_000), Date(1999, 7, 7)); _assertPred!"=="(date - dur!"msecs"(86_400_000), Date(1999, 7, 5)); _assertPred!"=="(date - dur!"usecs"(-86_400_000_000), Date(1999, 7, 7)); _assertPred!"=="(date - dur!"usecs"(86_400_000_000), Date(1999, 7, 5)); _assertPred!"=="(date - dur!"hnsecs"(-864_000_000_000), Date(1999, 7, 7)); _assertPred!"=="(date - dur!"hnsecs"(864_000_000_000), Date(1999, 7, 5)); //This probably only runs in cases where gettimeofday() is used, but it's //hard to do this test correctly with variable ticksPerSec. if(TickDuration.ticksPerSec == 1_000_000) { _assertPred!"=="(date - TickDuration.from!"usecs"(-86_400_000_000), Date(1999, 7, 7)); _assertPred!"=="(date - TickDuration.from!"usecs"(86_400_000_000), Date(1999, 7, 5)); } auto duration = dur!"days"(12); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, date + duration)); static assert(__traits(compiles, cdate + duration)); static assert(__traits(compiles, idate + duration)); static assert(__traits(compiles, date - duration)); static assert(__traits(compiles, cdate - duration)); static assert(__traits(compiles, idate - duration)); } } /++ Gives the result of adding or subtracting a duration from this $(D Date), as well as assigning the result to this $(D Date). The legal types of arithmetic for $(D Date) using this operator are $(BOOKTABLE, $(TR $(TD Date) $(TD +) $(TD duration) $(TD -->) $(TD Date)) $(TR $(TD Date) $(TD -) $(TD duration) $(TD -->) $(TD Date)) ) Params: duration = The duration to add to or subtract from this $(D Date). +/ /+ref+/ Date opOpAssign(string op, D)(in D duration) pure nothrow if((op == "+" || op == "-") && (is(Unqual!D == Duration) || is(Unqual!D == TickDuration))) { static if(is(Unqual!D == Duration)) immutable days = duration.total!"days"; else static if(is(Unqual!D == TickDuration)) immutable days = convert!("hnsecs", "days")(duration.hnsecs); //Ideally, this would just be //return addDays(unaryFun!(op ~ "a")(days)); //But there isn't currently a pure version of unaryFun!(). static if(op == "+") immutable signedDays = days; else static if(op == "-") immutable signedDays = -days; else static assert(0); return addDays(signedDays); } unittest { version(testStdDateTime) { _assertPred!"+="(Date(1999, 7, 6), dur!"weeks"(7), Date(1999, 8, 24)); _assertPred!"+="(Date(1999, 7, 6), dur!"weeks"(-7), Date(1999, 5, 18)); _assertPred!"+="(Date(1999, 7, 6), dur!"days"(7), Date(1999, 7, 13)); _assertPred!"+="(Date(1999, 7, 6), dur!"days"(-7), Date(1999, 6, 29)); _assertPred!"+="(Date(1999, 7, 6), dur!"hours"(24), Date(1999, 7, 7)); _assertPred!"+="(Date(1999, 7, 6), dur!"hours"(-24), Date(1999, 7, 5)); _assertPred!"+="(Date(1999, 7, 6), dur!"minutes"(1440), Date(1999, 7, 7)); _assertPred!"+="(Date(1999, 7, 6), dur!"minutes"(-1440), Date(1999, 7, 5)); _assertPred!"+="(Date(1999, 7, 6), dur!"seconds"(86_400), Date(1999, 7, 7)); _assertPred!"+="(Date(1999, 7, 6), dur!"seconds"(-86_400), Date(1999, 7, 5)); _assertPred!"+="(Date(1999, 7, 6), dur!"msecs"(86_400_000), Date(1999, 7, 7)); _assertPred!"+="(Date(1999, 7, 6), dur!"msecs"(-86_400_000), Date(1999, 7, 5)); _assertPred!"+="(Date(1999, 7, 6), dur!"usecs"(86_400_000_000), Date(1999, 7, 7)); _assertPred!"+="(Date(1999, 7, 6), dur!"usecs"(-86_400_000_000), Date(1999, 7, 5)); _assertPred!"+="(Date(1999, 7, 6), dur!"hnsecs"(864_000_000_000), Date(1999, 7, 7)); _assertPred!"+="(Date(1999, 7, 6), dur!"hnsecs"(-864_000_000_000), Date(1999, 7, 5)); _assertPred!"-="(Date(1999, 7, 6), dur!"weeks"(-7), Date(1999, 8, 24)); _assertPred!"-="(Date(1999, 7, 6), dur!"weeks"(7), Date(1999, 5, 18)); _assertPred!"-="(Date(1999, 7, 6), dur!"days"(-7), Date(1999, 7, 13)); _assertPred!"-="(Date(1999, 7, 6), dur!"days"(7), Date(1999, 6, 29)); _assertPred!"-="(Date(1999, 7, 6), dur!"hours"(-24), Date(1999, 7, 7)); _assertPred!"-="(Date(1999, 7, 6), dur!"hours"(24), Date(1999, 7, 5)); _assertPred!"-="(Date(1999, 7, 6), dur!"minutes"(-1440), Date(1999, 7, 7)); _assertPred!"-="(Date(1999, 7, 6), dur!"minutes"(1440), Date(1999, 7, 5)); _assertPred!"-="(Date(1999, 7, 6), dur!"seconds"(-86_400), Date(1999, 7, 7)); _assertPred!"-="(Date(1999, 7, 6), dur!"seconds"(86_400), Date(1999, 7, 5)); _assertPred!"-="(Date(1999, 7, 6), dur!"msecs"(-86_400_000), Date(1999, 7, 7)); _assertPred!"-="(Date(1999, 7, 6), dur!"msecs"(86_400_000), Date(1999, 7, 5)); _assertPred!"-="(Date(1999, 7, 6), dur!"usecs"(-86_400_000_000), Date(1999, 7, 7)); _assertPred!"-="(Date(1999, 7, 6), dur!"usecs"(86_400_000_000), Date(1999, 7, 5)); _assertPred!"-="(Date(1999, 7, 6), dur!"hnsecs"(-864_000_000_000), Date(1999, 7, 7)); _assertPred!"-="(Date(1999, 7, 6), dur!"hnsecs"(864_000_000_000), Date(1999, 7, 5)); auto duration = dur!"days"(12); auto date = Date(1999, 7, 6); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, date += duration)); static assert(!__traits(compiles, cdate += duration)); static assert(!__traits(compiles, idate += duration)); static assert(__traits(compiles, date -= duration)); static assert(!__traits(compiles, cdate -= duration)); static assert(!__traits(compiles, idate -= duration)); } } /++ Gives the difference between two $(D Date)s. The legal types of arithmetic for Date using this operator are $(BOOKTABLE, $(TR $(TD Date) $(TD -) $(TD Date) $(TD -->) $(TD duration)) ) +/ Duration opBinary(string op)(in Date rhs) const pure nothrow if(op == "-") { return dur!"days"(this.dayOfGregorianCal - rhs.dayOfGregorianCal); } unittest { version(testStdDateTime) { auto date = Date(1999, 7, 6); _assertPred!"=="(Date(1999, 7, 6) - Date(1998, 7, 6), dur!"days"(365)); _assertPred!"=="(Date(1998, 7, 6) - Date(1999, 7, 6), dur!"days"(-365)); _assertPred!"=="(Date(1999, 6, 6) - Date(1999, 5, 6), dur!"days"(31)); _assertPred!"=="(Date(1999, 5, 6) - Date(1999, 6, 6), dur!"days"(-31)); _assertPred!"=="(Date(1999, 1, 1) - Date(1998, 12, 31), dur!"days"(1)); _assertPred!"=="(Date(1998, 12, 31) - Date(1999, 1, 1), dur!"days"(-1)); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, date - date)); static assert(__traits(compiles, cdate - date)); static assert(__traits(compiles, idate - date)); static assert(__traits(compiles, date - cdate)); static assert(__traits(compiles, cdate - cdate)); static assert(__traits(compiles, idate - cdate)); static assert(__traits(compiles, date - idate)); static assert(__traits(compiles, cdate - idate)); static assert(__traits(compiles, idate - idate)); } } /++ Returns the difference between the two $(D Date)s in months. To get the difference in years, subtract the year property of two $(D SysTime)s. To get the difference in days or weeks, subtract the $(D SysTime)s themselves and use the $(D Duration) that results. Because converting between months and smaller units requires a specific date (which $(D Duration)s don't have), getting the difference in months requires some math using both the year and month properties, so this is a convenience function for getting the difference in months. Note that the number of days in the months or how far into the month either $(D Date) is is irrelevant. It is the difference in the month property combined with the difference in years * 12. So, for instance, December 31st and January 1st are one month apart just as December 1st and January 31st are one month apart. Params: rhs = The $(D Date) to subtract from this one. Examples: -------------------- assert(Date(1999, 2, 1).diffMonths(Date(1999, 1, 31)) == 1); assert(Date(1999, 1, 31).diffMonths(Date(1999, 2, 1)) == -1); assert(Date(1999, 3, 1).diffMonths(Date(1999, 1, 1)) == 2); assert(Date(1999, 1, 1).diffMonths(Date(1999, 3, 31)) == -2); -------------------- +/ int diffMonths(in Date rhs) const pure nothrow { immutable yearDiff = _year - rhs._year; immutable monthDiff = _month - rhs._month; return yearDiff * 12 + monthDiff; } unittest { version(testStdDateTime) { auto date = Date(1999, 7, 6); //Test A.D. _assertPred!"=="(date.diffMonths(Date(1998, 6, 5)), 13); _assertPred!"=="(date.diffMonths(Date(1998, 7, 5)), 12); _assertPred!"=="(date.diffMonths(Date(1998, 8, 5)), 11); _assertPred!"=="(date.diffMonths(Date(1998, 9, 5)), 10); _assertPred!"=="(date.diffMonths(Date(1998, 10, 5)), 9); _assertPred!"=="(date.diffMonths(Date(1998, 11, 5)), 8); _assertPred!"=="(date.diffMonths(Date(1998, 12, 5)), 7); _assertPred!"=="(date.diffMonths(Date(1999, 1, 5)), 6); _assertPred!"=="(date.diffMonths(Date(1999, 2, 6)), 5); _assertPred!"=="(date.diffMonths(Date(1999, 3, 6)), 4); _assertPred!"=="(date.diffMonths(Date(1999, 4, 6)), 3); _assertPred!"=="(date.diffMonths(Date(1999, 5, 6)), 2); _assertPred!"=="(date.diffMonths(Date(1999, 6, 6)), 1); _assertPred!"=="(date.diffMonths(date), 0); _assertPred!"=="(date.diffMonths(Date(1999, 8, 6)), -1); _assertPred!"=="(date.diffMonths(Date(1999, 9, 6)), -2); _assertPred!"=="(date.diffMonths(Date(1999, 10, 6)), -3); _assertPred!"=="(date.diffMonths(Date(1999, 11, 6)), -4); _assertPred!"=="(date.diffMonths(Date(1999, 12, 6)), -5); _assertPred!"=="(date.diffMonths(Date(2000, 1, 6)), -6); _assertPred!"=="(date.diffMonths(Date(2000, 2, 6)), -7); _assertPred!"=="(date.diffMonths(Date(2000, 3, 6)), -8); _assertPred!"=="(date.diffMonths(Date(2000, 4, 6)), -9); _assertPred!"=="(date.diffMonths(Date(2000, 5, 6)), -10); _assertPred!"=="(date.diffMonths(Date(2000, 6, 6)), -11); _assertPred!"=="(date.diffMonths(Date(2000, 7, 6)), -12); _assertPred!"=="(date.diffMonths(Date(2000, 8, 6)), -13); _assertPred!"=="(Date(1998, 6, 5).diffMonths(date), -13); _assertPred!"=="(Date(1998, 7, 5).diffMonths(date), -12); _assertPred!"=="(Date(1998, 8, 5).diffMonths(date), -11); _assertPred!"=="(Date(1998, 9, 5).diffMonths(date), -10); _assertPred!"=="(Date(1998, 10, 5).diffMonths(date), -9); _assertPred!"=="(Date(1998, 11, 5).diffMonths(date), -8); _assertPred!"=="(Date(1998, 12, 5).diffMonths(date), -7); _assertPred!"=="(Date(1999, 1, 5).diffMonths(date), -6); _assertPred!"=="(Date(1999, 2, 6).diffMonths(date), -5); _assertPred!"=="(Date(1999, 3, 6).diffMonths(date), -4); _assertPred!"=="(Date(1999, 4, 6).diffMonths(date), -3); _assertPred!"=="(Date(1999, 5, 6).diffMonths(date), -2); _assertPred!"=="(Date(1999, 6, 6).diffMonths(date), -1); _assertPred!"=="(Date(1999, 8, 6).diffMonths(date), 1); _assertPred!"=="(Date(1999, 9, 6).diffMonths(date), 2); _assertPred!"=="(Date(1999, 10, 6).diffMonths(date), 3); _assertPred!"=="(Date(1999, 11, 6).diffMonths(date), 4); _assertPred!"=="(Date(1999, 12, 6).diffMonths(date), 5); _assertPred!"=="(Date(2000, 1, 6).diffMonths(date), 6); _assertPred!"=="(Date(2000, 2, 6).diffMonths(date), 7); _assertPred!"=="(Date(2000, 3, 6).diffMonths(date), 8); _assertPred!"=="(Date(2000, 4, 6).diffMonths(date), 9); _assertPred!"=="(Date(2000, 5, 6).diffMonths(date), 10); _assertPred!"=="(Date(2000, 6, 6).diffMonths(date), 11); _assertPred!"=="(Date(2000, 7, 6).diffMonths(date), 12); _assertPred!"=="(Date(2000, 8, 6).diffMonths(date), 13); _assertPred!"=="(date.diffMonths(Date(1999, 6, 30)), 1); _assertPred!"=="(date.diffMonths(Date(1999, 7, 1)), 0); _assertPred!"=="(date.diffMonths(Date(1999, 7, 6)), 0); _assertPred!"=="(date.diffMonths(Date(1999, 7, 11)), 0); _assertPred!"=="(date.diffMonths(Date(1999, 7, 16)), 0); _assertPred!"=="(date.diffMonths(Date(1999, 7, 21)), 0); _assertPred!"=="(date.diffMonths(Date(1999, 7, 26)), 0); _assertPred!"=="(date.diffMonths(Date(1999, 7, 31)), 0); _assertPred!"=="(date.diffMonths(Date(1999, 8, 1)), -1); _assertPred!"=="(date.diffMonths(Date(1990, 6, 30)), 109); _assertPred!"=="(date.diffMonths(Date(1990, 7, 1)), 108); _assertPred!"=="(date.diffMonths(Date(1990, 7, 6)), 108); _assertPred!"=="(date.diffMonths(Date(1990, 7, 11)), 108); _assertPred!"=="(date.diffMonths(Date(1990, 7, 16)), 108); _assertPred!"=="(date.diffMonths(Date(1990, 7, 21)), 108); _assertPred!"=="(date.diffMonths(Date(1990, 7, 26)), 108); _assertPred!"=="(date.diffMonths(Date(1990, 7, 31)), 108); _assertPred!"=="(date.diffMonths(Date(1990, 8, 1)), 107); _assertPred!"=="(Date(1999, 6, 30).diffMonths(date), -1); _assertPred!"=="(Date(1999, 7, 1).diffMonths(date), 0); _assertPred!"=="(Date(1999, 7, 6).diffMonths(date), 0); _assertPred!"=="(Date(1999, 7, 11).diffMonths(date), 0); _assertPred!"=="(Date(1999, 7, 16).diffMonths(date), 0); _assertPred!"=="(Date(1999, 7, 21).diffMonths(date), 0); _assertPred!"=="(Date(1999, 7, 26).diffMonths(date), 0); _assertPred!"=="(Date(1999, 7, 31).diffMonths(date), 0); _assertPred!"=="(Date(1999, 8, 1).diffMonths(date), 1); _assertPred!"=="(Date(1990, 6, 30).diffMonths(date), -109); _assertPred!"=="(Date(1990, 7, 1).diffMonths(date), -108); _assertPred!"=="(Date(1990, 7, 6).diffMonths(date), -108); _assertPred!"=="(Date(1990, 7, 11).diffMonths(date), -108); _assertPred!"=="(Date(1990, 7, 16).diffMonths(date), -108); _assertPred!"=="(Date(1990, 7, 21).diffMonths(date), -108); _assertPred!"=="(Date(1990, 7, 26).diffMonths(date), -108); _assertPred!"=="(Date(1990, 7, 31).diffMonths(date), -108); _assertPred!"=="(Date(1990, 8, 1).diffMonths(date), -107); //Test B.C. auto dateBC = Date(-1999, 7, 6); _assertPred!"=="(dateBC.diffMonths(Date(-2000, 6, 5)), 13); _assertPred!"=="(dateBC.diffMonths(Date(-2000, 7, 5)), 12); _assertPred!"=="(dateBC.diffMonths(Date(-2000, 8, 5)), 11); _assertPred!"=="(dateBC.diffMonths(Date(-2000, 9, 5)), 10); _assertPred!"=="(dateBC.diffMonths(Date(-2000, 10, 5)), 9); _assertPred!"=="(dateBC.diffMonths(Date(-2000, 11, 5)), 8); _assertPred!"=="(dateBC.diffMonths(Date(-2000, 12, 5)), 7); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 1, 5)), 6); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 2, 6)), 5); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 3, 6)), 4); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 4, 6)), 3); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 5, 6)), 2); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 6, 6)), 1); _assertPred!"=="(dateBC.diffMonths(dateBC), 0); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 8, 6)), -1); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 9, 6)), -2); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 10, 6)), -3); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 11, 6)), -4); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 12, 6)), -5); _assertPred!"=="(dateBC.diffMonths(Date(-1998, 1, 6)), -6); _assertPred!"=="(dateBC.diffMonths(Date(-1998, 2, 6)), -7); _assertPred!"=="(dateBC.diffMonths(Date(-1998, 3, 6)), -8); _assertPred!"=="(dateBC.diffMonths(Date(-1998, 4, 6)), -9); _assertPred!"=="(dateBC.diffMonths(Date(-1998, 5, 6)), -10); _assertPred!"=="(dateBC.diffMonths(Date(-1998, 6, 6)), -11); _assertPred!"=="(dateBC.diffMonths(Date(-1998, 7, 6)), -12); _assertPred!"=="(dateBC.diffMonths(Date(-1998, 8, 6)), -13); _assertPred!"=="(Date(-2000, 6, 5).diffMonths(dateBC), -13); _assertPred!"=="(Date(-2000, 7, 5).diffMonths(dateBC), -12); _assertPred!"=="(Date(-2000, 8, 5).diffMonths(dateBC), -11); _assertPred!"=="(Date(-2000, 9, 5).diffMonths(dateBC), -10); _assertPred!"=="(Date(-2000, 10, 5).diffMonths(dateBC), -9); _assertPred!"=="(Date(-2000, 11, 5).diffMonths(dateBC), -8); _assertPred!"=="(Date(-2000, 12, 5).diffMonths(dateBC), -7); _assertPred!"=="(Date(-1999, 1, 5).diffMonths(dateBC), -6); _assertPred!"=="(Date(-1999, 2, 6).diffMonths(dateBC), -5); _assertPred!"=="(Date(-1999, 3, 6).diffMonths(dateBC), -4); _assertPred!"=="(Date(-1999, 4, 6).diffMonths(dateBC), -3); _assertPred!"=="(Date(-1999, 5, 6).diffMonths(dateBC), -2); _assertPred!"=="(Date(-1999, 6, 6).diffMonths(dateBC), -1); _assertPred!"=="(Date(-1999, 8, 6).diffMonths(dateBC), 1); _assertPred!"=="(Date(-1999, 9, 6).diffMonths(dateBC), 2); _assertPred!"=="(Date(-1999, 10, 6).diffMonths(dateBC), 3); _assertPred!"=="(Date(-1999, 11, 6).diffMonths(dateBC), 4); _assertPred!"=="(Date(-1999, 12, 6).diffMonths(dateBC), 5); _assertPred!"=="(Date(-1998, 1, 6).diffMonths(dateBC), 6); _assertPred!"=="(Date(-1998, 2, 6).diffMonths(dateBC), 7); _assertPred!"=="(Date(-1998, 3, 6).diffMonths(dateBC), 8); _assertPred!"=="(Date(-1998, 4, 6).diffMonths(dateBC), 9); _assertPred!"=="(Date(-1998, 5, 6).diffMonths(dateBC), 10); _assertPred!"=="(Date(-1998, 6, 6).diffMonths(dateBC), 11); _assertPred!"=="(Date(-1998, 7, 6).diffMonths(dateBC), 12); _assertPred!"=="(Date(-1998, 8, 6).diffMonths(dateBC), 13); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 6, 30)), 1); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 7, 1)), 0); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 7, 6)), 0); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 7, 11)), 0); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 7, 16)), 0); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 7, 21)), 0); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 7, 26)), 0); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 7, 31)), 0); _assertPred!"=="(dateBC.diffMonths(Date(-1999, 8, 1)), -1); _assertPred!"=="(dateBC.diffMonths(Date(-2008, 6, 30)), 109); _assertPred!"=="(dateBC.diffMonths(Date(-2008, 7, 1)), 108); _assertPred!"=="(dateBC.diffMonths(Date(-2008, 7, 6)), 108); _assertPred!"=="(dateBC.diffMonths(Date(-2008, 7, 11)), 108); _assertPred!"=="(dateBC.diffMonths(Date(-2008, 7, 16)), 108); _assertPred!"=="(dateBC.diffMonths(Date(-2008, 7, 21)), 108); _assertPred!"=="(dateBC.diffMonths(Date(-2008, 7, 26)), 108); _assertPred!"=="(dateBC.diffMonths(Date(-2008, 7, 31)), 108); _assertPred!"=="(dateBC.diffMonths(Date(-2008, 8, 1)), 107); _assertPred!"=="(Date(-1999, 6, 30).diffMonths(dateBC), -1); _assertPred!"=="(Date(-1999, 7, 1).diffMonths(dateBC), 0); _assertPred!"=="(Date(-1999, 7, 6).diffMonths(dateBC), 0); _assertPred!"=="(Date(-1999, 7, 11).diffMonths(dateBC), 0); _assertPred!"=="(Date(-1999, 7, 16).diffMonths(dateBC), 0); _assertPred!"=="(Date(-1999, 7, 21).diffMonths(dateBC), 0); _assertPred!"=="(Date(-1999, 7, 26).diffMonths(dateBC), 0); _assertPred!"=="(Date(-1999, 7, 31).diffMonths(dateBC), 0); _assertPred!"=="(Date(-1999, 8, 1).diffMonths(dateBC), 1); _assertPred!"=="(Date(-2008, 6, 30).diffMonths(dateBC), -109); _assertPred!"=="(Date(-2008, 7, 1).diffMonths(dateBC), -108); _assertPred!"=="(Date(-2008, 7, 6).diffMonths(dateBC), -108); _assertPred!"=="(Date(-2008, 7, 11).diffMonths(dateBC), -108); _assertPred!"=="(Date(-2008, 7, 16).diffMonths(dateBC), -108); _assertPred!"=="(Date(-2008, 7, 21).diffMonths(dateBC), -108); _assertPred!"=="(Date(-2008, 7, 26).diffMonths(dateBC), -108); _assertPred!"=="(Date(-2008, 7, 31).diffMonths(dateBC), -108); _assertPred!"=="(Date(-2008, 8, 1).diffMonths(dateBC), -107); //Test Both _assertPred!"=="(Date(3, 3, 3).diffMonths(Date(-5, 5, 5)), 94); _assertPred!"=="(Date(-5, 5, 5).diffMonths(Date(3, 3, 3)), -94); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, date.diffMonths(date))); static assert(__traits(compiles, cdate.diffMonths(date))); static assert(__traits(compiles, idate.diffMonths(date))); static assert(__traits(compiles, date.diffMonths(cdate))); static assert(__traits(compiles, cdate.diffMonths(cdate))); static assert(__traits(compiles, idate.diffMonths(cdate))); static assert(__traits(compiles, date.diffMonths(idate))); static assert(__traits(compiles, cdate.diffMonths(idate))); static assert(__traits(compiles, idate.diffMonths(idate))); //Verify Examples. assert(Date(1999, 2, 1).diffMonths(Date(1999, 1, 31)) == 1); assert(Date(1999, 1, 31).diffMonths(Date(1999, 2, 1)) == -1); assert(Date(1999, 3, 1).diffMonths(Date(1999, 1, 1)) == 2); assert(Date(1999, 1, 1).diffMonths(Date(1999, 3, 31)) == -2); } } /++ Whether this $(D Date) is in a leap year. +/ @property bool isLeapYear() const pure nothrow { return yearIsLeapYear(_year); } unittest { version(testStdDateTime) { auto date = Date(1999, 7, 6); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(!__traits(compiles, date.isLeapYear = true)); static assert(!__traits(compiles, cdate.isLeapYear = true)); static assert(!__traits(compiles, idate.isLeapYear = true)); } } /++ Day of the week this $(D Date) is on. +/ @property DayOfWeek dayOfWeek() const pure nothrow { return getDayOfWeek(dayOfGregorianCal); } unittest { version(testStdDateTime) { const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, cdate.dayOfWeek == DayOfWeek.sun)); static assert(!__traits(compiles, cdate.dayOfWeek = DayOfWeek.sun)); static assert(__traits(compiles, idate.dayOfWeek == DayOfWeek.sun)); static assert(!__traits(compiles, idate.dayOfWeek = DayOfWeek.sun)); } } /++ Day of the year this $(D Date) is on. Examples: -------------------- assert(Date(1999, 1, 1).dayOfYear == 1); assert(Date(1999, 12, 31).dayOfYear == 365); assert(Date(2000, 12, 31).dayOfYear == 366); -------------------- +/ @property ushort dayOfYear() const pure nothrow { if (_month >= Month.jan && _month <= Month.dec) { immutable int[] lastDay = isLeapYear ? lastDayLeap : lastDayNonLeap; auto monthIndex = _month - Month.jan; return cast(ushort)(lastDay[monthIndex] + _day); } assert(0, "Invalid month."); } //Verify Examples. version(testStdDateTime) unittest { assert(Date(1999, 1, 1).dayOfYear == 1); assert(Date(1999, 12, 31).dayOfYear == 365); assert(Date(2000, 12, 31).dayOfYear == 366); } version(testStdDateTime) unittest { foreach(year; filter!((a){return !yearIsLeapYear(a);}) (chain(testYearsBC, testYearsAD))) { foreach(doy; testDaysOfYear) { _assertPred!"=="(Date(year, doy.md.month, doy.md.day).dayOfYear, doy.day); } } foreach(year; filter!((a){return yearIsLeapYear(a);}) (chain(testYearsBC, testYearsAD))) { foreach(doy; testDaysOfLeapYear) { _assertPred!"=="(Date(year, doy.md.month, doy.md.day).dayOfYear, doy.day); } } const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, cdate.dayOfYear == 187)); static assert(__traits(compiles, idate.dayOfYear == 187)); } /++ Day of the year. Params: day = The day of the year to set which day of the year this $(D Date) is on. Throws: $(D DateTimeException) if the given day is an invalid day of the year. +/ @property void dayOfYear(int day) pure { immutable int[] lastDay = isLeapYear ? lastDayLeap : lastDayNonLeap; if(day <= 0 || day > (isLeapYear ? daysInLeapYear : daysInYear) ) throw new DateTimeException("Invalid day of the year."); foreach (i; 1..lastDay.length) { if (day <= lastDay[i]) { _month = cast(Month)(cast(int)Month.jan + i - 1); _day = cast(ubyte)(day - lastDay[i - 1]); return; } } assert(0, "Invalid day of the year."); } version(testStdDateTime) unittest { static void test(Date date, int day, MonthDay expected, size_t line = __LINE__) { date.dayOfYear = day; _assertPred!"=="(date.month, expected.month, "", __FILE__, line); _assertPred!"=="(date.day, expected.day, "", __FILE__, line); } foreach(doy; testDaysOfYear) { test(Date(1999, 1, 1), doy.day, doy.md); test(Date(-1, 1, 1), doy.day, doy.md); } foreach(doy; testDaysOfLeapYear) { test(Date(2000, 1, 1), doy.day, doy.md); test(Date(-4, 1, 1), doy.day, doy.md); } const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(!__traits(compiles, cdate.dayOfYear = 187)); static assert(!__traits(compiles, idate.dayOfYear = 187)); } /++ The Xth day of the Gregorian Calendar that this $(D Date) is on. Examples: -------------------- assert(Date(1, 1, 1).dayOfGregorianCal == 1); assert(Date(1, 12, 31).dayOfGregorianCal == 365); assert(Date(2, 1, 1).dayOfGregorianCal == 366); assert(Date(0, 12, 31).dayOfGregorianCal == 0); assert(Date(0, 1, 1).dayOfGregorianCal == -365); assert(Date(-1, 12, 31).dayOfGregorianCal == -366); assert(Date(2000, 1, 1).dayOfGregorianCal == 730_120); assert(Date(2010, 12, 31).dayOfGregorianCal == 734_137); -------------------- +/ @property int dayOfGregorianCal() const pure nothrow { if(isAD) { if(_year == 1) return dayOfYear; int years = _year - 1; auto days = (years / 400) * daysIn400Years; years %= 400; days += (years / 100) * daysIn100Years; years %= 100; days += (years / 4) * daysIn4Years; years %= 4; days += years * daysInYear; days += dayOfYear; return days; } else if(_year == 0) return dayOfYear - daysInLeapYear; else { int years = _year; auto days = (years / 400) * daysIn400Years; years %= 400; days += (years / 100) * daysIn100Years; years %= 100; days += (years / 4) * daysIn4Years; years %= 4; if(years < 0) { days -= daysInLeapYear; ++years; days += years * daysInYear; days -= daysInYear - dayOfYear; } else days -= daysInLeapYear - dayOfYear; return days; } } //Verify Examples. version(testStdDateTime) unittest { assert(Date(1, 1, 1).dayOfGregorianCal == 1); assert(Date(1, 12, 31).dayOfGregorianCal == 365); assert(Date(2, 1, 1).dayOfGregorianCal == 366); assert(Date(0, 12, 31).dayOfGregorianCal == 0); assert(Date(0, 1, 1).dayOfGregorianCal == -365); assert(Date(-1, 12, 31).dayOfGregorianCal == -366); assert(Date(2000, 1, 1).dayOfGregorianCal == 730_120); assert(Date(2010, 12, 31).dayOfGregorianCal == 734_137); } version(testStdDateTime) unittest { foreach(gd; chain(testGregDaysBC, testGregDaysAD)) _assertPred!"=="(gd.date.dayOfGregorianCal, gd.day); auto date = Date(1999, 7, 6); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, date.dayOfGregorianCal)); static assert(__traits(compiles, cdate.dayOfGregorianCal)); static assert(__traits(compiles, idate.dayOfGregorianCal)); } /++ The Xth day of the Gregorian Calendar that this $(D Date) is on. Params: day = The day of the Gregorian Calendar to set this $(D Date) to. Examples: -------------------- auto date = Date.init; date.dayOfGregorianCal = 1; assert(date == Date(1, 1, 1)); date.dayOfGregorianCal = 365; assert(date == Date(1, 12, 31)); date.dayOfGregorianCal = 366; assert(date == Date(2, 1, 1)); date.dayOfGregorianCal = 0; assert(date == Date(0, 12, 31)); date.dayOfGregorianCal = -365; assert(date == Date(-0, 1, 1)); date.dayOfGregorianCal = -366; assert(date == Date(-1, 12, 31)); date.dayOfGregorianCal = 730_120; assert(date == Date(2000, 1, 1)); date.dayOfGregorianCal = 734_137; assert(date == Date(2010, 12, 31)); -------------------- +/ @property void dayOfGregorianCal(int day) pure nothrow { this = Date(day); } unittest { version(testStdDateTime) { { auto date = Date(1999, 7, 6); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, date.dayOfGregorianCal = 187)); static assert(!__traits(compiles, cdate.dayOfGregorianCal = 187)); static assert(!__traits(compiles, idate.dayOfGregorianCal = 187)); } //Verify Examples. { auto date = Date.init; date.dayOfGregorianCal = 1; assert(date == Date(1, 1, 1)); date.dayOfGregorianCal = 365; assert(date == Date(1, 12, 31)); date.dayOfGregorianCal = 366; assert(date == Date(2, 1, 1)); date.dayOfGregorianCal = 0; assert(date == Date(0, 12, 31)); date.dayOfGregorianCal = -365; assert(date == Date(-0, 1, 1)); date.dayOfGregorianCal = -366; assert(date == Date(-1, 12, 31)); date.dayOfGregorianCal = 730_120; assert(date == Date(2000, 1, 1)); date.dayOfGregorianCal = 734_137; assert(date == Date(2010, 12, 31)); } } } /++ The ISO 8601 week of the year that this $(D Date) is in. See_Also: $(WEB en.wikipedia.org/wiki/ISO_week_date, ISO Week Date) +/ @property ubyte isoWeek() const pure nothrow { immutable weekday = dayOfWeek; immutable adjustedWeekday = weekday == DayOfWeek.sun ? 7 : weekday; immutable week = (dayOfYear - adjustedWeekday + 10) / 7; try { if(week == 53) { switch(Date(_year + 1, 1, 1).dayOfWeek) { case DayOfWeek.mon: case DayOfWeek.tue: case DayOfWeek.wed: case DayOfWeek.thu: return 1; case DayOfWeek.fri: case DayOfWeek.sat: case DayOfWeek.sun: return 53; default: assert(0, "Invalid ISO Week"); } } else if(week > 0) return cast(ubyte)week; else return Date(_year - 1, 12, 31).isoWeek; } catch(Exception e) assert(0, "Date's constructor threw."); } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(Date(2009, 12, 28).isoWeek, 53); _assertPred!"=="(Date(2009, 12, 29).isoWeek, 53); _assertPred!"=="(Date(2009, 12, 30).isoWeek, 53); _assertPred!"=="(Date(2009, 12, 31).isoWeek, 53); _assertPred!"=="(Date(2010, 1, 1).isoWeek, 53); _assertPred!"=="(Date(2010, 1, 2).isoWeek, 53); _assertPred!"=="(Date(2010, 1, 3).isoWeek, 53); _assertPred!"=="(Date(2010, 1, 4).isoWeek, 1); _assertPred!"=="(Date(2010, 1, 5).isoWeek, 1); _assertPred!"=="(Date(2010, 1, 6).isoWeek, 1); _assertPred!"=="(Date(2010, 1, 7).isoWeek, 1); _assertPred!"=="(Date(2010, 1, 8).isoWeek, 1); _assertPred!"=="(Date(2010, 1, 9).isoWeek, 1); _assertPred!"=="(Date(2010, 1, 10).isoWeek, 1); _assertPred!"=="(Date(2010, 1, 11).isoWeek, 2); _assertPred!"=="(Date(2010, 12, 31).isoWeek, 52); _assertPred!"=="(Date(2004, 12, 26).isoWeek, 52); _assertPred!"=="(Date(2004, 12, 27).isoWeek, 53); _assertPred!"=="(Date(2004, 12, 28).isoWeek, 53); _assertPred!"=="(Date(2004, 12, 29).isoWeek, 53); _assertPred!"=="(Date(2004, 12, 30).isoWeek, 53); _assertPred!"=="(Date(2004, 12, 31).isoWeek, 53); _assertPred!"=="(Date(2005, 1, 1).isoWeek, 53); _assertPred!"=="(Date(2005, 1, 2).isoWeek, 53); _assertPred!"=="(Date(2005, 12, 31).isoWeek, 52); _assertPred!"=="(Date(2007, 1, 1).isoWeek, 1); _assertPred!"=="(Date(2007, 12, 30).isoWeek, 52); _assertPred!"=="(Date(2007, 12, 31).isoWeek, 1); _assertPred!"=="(Date(2008, 1, 1).isoWeek, 1); _assertPred!"=="(Date(2008, 12, 28).isoWeek, 52); _assertPred!"=="(Date(2008, 12, 29).isoWeek, 1); _assertPred!"=="(Date(2008, 12, 30).isoWeek, 1); _assertPred!"=="(Date(2008, 12, 31).isoWeek, 1); _assertPred!"=="(Date(2009, 1, 1).isoWeek, 1); _assertPred!"=="(Date(2009, 1, 2).isoWeek, 1); _assertPred!"=="(Date(2009, 1, 3).isoWeek, 1); _assertPred!"=="(Date(2009, 1, 4).isoWeek, 1); //Test B.C. //The algorithm should work identically for both A.D. and B.C. since //it doesn't really take the year into account, so B.C. testing //probably isn't really needed. _assertPred!"=="(Date(0, 12, 31).isoWeek, 52); _assertPred!"=="(Date(0, 1, 4).isoWeek, 1); _assertPred!"=="(Date(0, 1, 1).isoWeek, 52); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, cdate.isoWeek == 3)); static assert(!__traits(compiles, cdate.isoWeek = 3)); static assert(__traits(compiles, idate.isoWeek == 3)); static assert(!__traits(compiles, idate.isoWeek = 3)); } } /++ $(D Date) for the last day in the month that this $(D Date) is in. Examples: -------------------- assert(Date(1999, 1, 6).endOfMonth == Date(1999, 1, 31)); assert(Date(1999, 2, 7).endOfMonth == Date(1999, 2, 28)); assert(Date(2000, 2, 7).endOfMonth == Date(1999, 2, 29)); assert(Date(2000, 6, 4).endOfMonth == Date(1999, 6, 30)); -------------------- +/ @property Date endOfMonth() const pure nothrow { try return Date(_year, _month, maxDay(_year, _month)); catch(Exception e) assert(0, "Date's constructor threw."); } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(Date(1999, 1, 1).endOfMonth, Date(1999, 1, 31)); _assertPred!"=="(Date(1999, 2, 1).endOfMonth, Date(1999, 2, 28)); _assertPred!"=="(Date(2000, 2, 1).endOfMonth, Date(2000, 2, 29)); _assertPred!"=="(Date(1999, 3, 1).endOfMonth, Date(1999, 3, 31)); _assertPred!"=="(Date(1999, 4, 1).endOfMonth, Date(1999, 4, 30)); _assertPred!"=="(Date(1999, 5, 1).endOfMonth, Date(1999, 5, 31)); _assertPred!"=="(Date(1999, 6, 1).endOfMonth, Date(1999, 6, 30)); _assertPred!"=="(Date(1999, 7, 1).endOfMonth, Date(1999, 7, 31)); _assertPred!"=="(Date(1999, 8, 1).endOfMonth, Date(1999, 8, 31)); _assertPred!"=="(Date(1999, 9, 1).endOfMonth, Date(1999, 9, 30)); _assertPred!"=="(Date(1999, 10, 1).endOfMonth, Date(1999, 10, 31)); _assertPred!"=="(Date(1999, 11, 1).endOfMonth, Date(1999, 11, 30)); _assertPred!"=="(Date(1999, 12, 1).endOfMonth, Date(1999, 12, 31)); //Test B.C. _assertPred!"=="(Date(-1999, 1, 1).endOfMonth, Date(-1999, 1, 31)); _assertPred!"=="(Date(-1999, 2, 1).endOfMonth, Date(-1999, 2, 28)); _assertPred!"=="(Date(-2000, 2, 1).endOfMonth, Date(-2000, 2, 29)); _assertPred!"=="(Date(-1999, 3, 1).endOfMonth, Date(-1999, 3, 31)); _assertPred!"=="(Date(-1999, 4, 1).endOfMonth, Date(-1999, 4, 30)); _assertPred!"=="(Date(-1999, 5, 1).endOfMonth, Date(-1999, 5, 31)); _assertPred!"=="(Date(-1999, 6, 1).endOfMonth, Date(-1999, 6, 30)); _assertPred!"=="(Date(-1999, 7, 1).endOfMonth, Date(-1999, 7, 31)); _assertPred!"=="(Date(-1999, 8, 1).endOfMonth, Date(-1999, 8, 31)); _assertPred!"=="(Date(-1999, 9, 1).endOfMonth, Date(-1999, 9, 30)); _assertPred!"=="(Date(-1999, 10, 1).endOfMonth, Date(-1999, 10, 31)); _assertPred!"=="(Date(-1999, 11, 1).endOfMonth, Date(-1999, 11, 30)); _assertPred!"=="(Date(-1999, 12, 1).endOfMonth, Date(-1999, 12, 31)); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(!__traits(compiles, cdate.endOfMonth = Date(1999, 7, 30))); static assert(!__traits(compiles, idate.endOfMonth = Date(1999, 7, 30))); //Verify Examples. assert(Date(1999, 1, 6).endOfMonth == Date(1999, 1, 31)); assert(Date(1999, 2, 7).endOfMonth == Date(1999, 2, 28)); assert(Date(2000, 2, 7).endOfMonth == Date(2000, 2, 29)); assert(Date(2000, 6, 4).endOfMonth == Date(2000, 6, 30)); } } /++ The last day in the month that this $(D Date) is in. Examples: -------------------- assert(Date(1999, 1, 6).daysInMonth == 31); assert(Date(1999, 2, 7).daysInMonth == 28); assert(Date(2000, 2, 7).daysInMonth == 29); assert(Date(2000, 6, 4).daysInMonth == 30); -------------------- +/ @property ubyte daysInMonth() const pure nothrow { return maxDay(_year, _month); } //Explicitly undocumented. Do not use. To be removed in March 2013. deprecated("Please use daysInMonth instead.") @property ubyte endOfMonthDay() const nothrow { return maxDay(_year, _month); } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(Date(1999, 1, 1).daysInMonth, 31); _assertPred!"=="(Date(1999, 2, 1).daysInMonth, 28); _assertPred!"=="(Date(2000, 2, 1).daysInMonth, 29); _assertPred!"=="(Date(1999, 3, 1).daysInMonth, 31); _assertPred!"=="(Date(1999, 4, 1).daysInMonth, 30); _assertPred!"=="(Date(1999, 5, 1).daysInMonth, 31); _assertPred!"=="(Date(1999, 6, 1).daysInMonth, 30); _assertPred!"=="(Date(1999, 7, 1).daysInMonth, 31); _assertPred!"=="(Date(1999, 8, 1).daysInMonth, 31); _assertPred!"=="(Date(1999, 9, 1).daysInMonth, 30); _assertPred!"=="(Date(1999, 10, 1).daysInMonth, 31); _assertPred!"=="(Date(1999, 11, 1).daysInMonth, 30); _assertPred!"=="(Date(1999, 12, 1).daysInMonth, 31); //Test B.C. _assertPred!"=="(Date(-1999, 1, 1).daysInMonth, 31); _assertPred!"=="(Date(-1999, 2, 1).daysInMonth, 28); _assertPred!"=="(Date(-2000, 2, 1).daysInMonth, 29); _assertPred!"=="(Date(-1999, 3, 1).daysInMonth, 31); _assertPred!"=="(Date(-1999, 4, 1).daysInMonth, 30); _assertPred!"=="(Date(-1999, 5, 1).daysInMonth, 31); _assertPred!"=="(Date(-1999, 6, 1).daysInMonth, 30); _assertPred!"=="(Date(-1999, 7, 1).daysInMonth, 31); _assertPred!"=="(Date(-1999, 8, 1).daysInMonth, 31); _assertPred!"=="(Date(-1999, 9, 1).daysInMonth, 30); _assertPred!"=="(Date(-1999, 10, 1).daysInMonth, 31); _assertPred!"=="(Date(-1999, 11, 1).daysInMonth, 30); _assertPred!"=="(Date(-1999, 12, 1).daysInMonth, 31); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(!__traits(compiles, cdate.daysInMonth = 30)); static assert(!__traits(compiles, idate.daysInMonth = 30)); //Verify Examples. assert(Date(1999, 1, 6).daysInMonth == 31); assert(Date(1999, 2, 7).daysInMonth == 28); assert(Date(2000, 2, 7).daysInMonth == 29); assert(Date(2000, 6, 4).daysInMonth == 30); } } /++ Whether the current year is a date in A.D. Examples: -------------------- assert(Date(1, 1, 1).isAD); assert(Date(2010, 12, 31).isAD); assert(!Date(0, 12, 31).isAD); assert(!Date(-2010, 1, 1).isAD); -------------------- +/ @property bool isAD() const pure nothrow { return _year > 0; } unittest { version(testStdDateTime) { assert(Date(2010, 7, 4).isAD); assert(Date(1, 1, 1).isAD); assert(!Date(0, 1, 1).isAD); assert(!Date(-1, 1, 1).isAD); assert(!Date(-2010, 7, 4).isAD); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, cdate.isAD)); static assert(__traits(compiles, idate.isAD)); //Verify Examples. assert(Date(1, 1, 1).isAD); assert(Date(2010, 12, 31).isAD); assert(!Date(0, 12, 31).isAD); assert(!Date(-2010, 1, 1).isAD); } } /++ The julian day for this $(D Date) at noon (since the julian day changes at noon). +/ @property long julianDay() const pure nothrow { return dayOfGregorianCal + 1_721_425; } unittest { version(testStdDateTime) { _assertPred!"=="(Date(-4713, 11, 24).julianDay, 0); _assertPred!"=="(Date(0, 12, 31).julianDay, 1_721_425); _assertPred!"=="(Date(1, 1, 1).julianDay, 1_721_426); _assertPred!"=="(Date(1582, 10, 15).julianDay, 2_299_161); _assertPred!"=="(Date(1858, 11, 17).julianDay, 2_400_001); _assertPred!"=="(Date(1982, 1, 4).julianDay, 2_444_974); _assertPred!"=="(Date(1996, 3, 31).julianDay, 2_450_174); _assertPred!"=="(Date(2010, 8, 24).julianDay, 2_455_433); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, cdate.julianDay)); static assert(__traits(compiles, idate.julianDay)); } } /++ The modified julian day for any time on this date (since, the modified julian day changes at midnight). +/ @property long modJulianDay() const pure nothrow { return julianDay - 2_400_001; } unittest { version(testStdDateTime) { _assertPred!"=="(Date(1858, 11, 17).modJulianDay, 0); _assertPred!"=="(Date(2010, 8, 24).modJulianDay, 55_432); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, cdate.modJulianDay)); static assert(__traits(compiles, idate.modJulianDay)); } } /++ Converts this $(D Date) to a string with the format YYYYMMDD. Examples: -------------------- assert(Date(2010, 7, 4).toISOString() == "20100704"); assert(Date(1998, 12, 25).toISOString() == "19981225"); assert(Date(0, 1, 5).toISOString() == "00000105"); assert(Date(-4, 1, 5).toISOString() == "-00040105"); -------------------- +/ string toISOString() const nothrow { try { if(_year >= 0) { if(_year < 10_000) return format("%04d%02d%02d", _year, _month, _day); else return format("+%05d%02d%02d", _year, _month, _day); } else if(_year > -10_000) return format("%05d%02d%02d", _year, _month, _day); else return format("%06d%02d%02d", _year, _month, _day); } catch(Exception e) assert(0, "format() threw."); } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(Date(9, 12, 4).toISOString(), "00091204"); _assertPred!"=="(Date(99, 12, 4).toISOString(), "00991204"); _assertPred!"=="(Date(999, 12, 4).toISOString(), "09991204"); _assertPred!"=="(Date(9999, 7, 4).toISOString(), "99990704"); _assertPred!"=="(Date(10000, 10, 20).toISOString(), "+100001020"); //Test B.C. _assertPred!"=="(Date(0, 12, 4).toISOString(), "00001204"); _assertPred!"=="(Date(-9, 12, 4).toISOString(), "-00091204"); _assertPred!"=="(Date(-99, 12, 4).toISOString(), "-00991204"); _assertPred!"=="(Date(-999, 12, 4).toISOString(), "-09991204"); _assertPred!"=="(Date(-9999, 7, 4).toISOString(), "-99990704"); _assertPred!"=="(Date(-10000, 10, 20).toISOString(), "-100001020"); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, cdate.toISOString())); static assert(__traits(compiles, idate.toISOString())); //Verify Examples. assert(Date(2010, 7, 4).toISOString() == "20100704"); assert(Date(1998, 12, 25).toISOString() == "19981225"); assert(Date(0, 1, 5).toISOString() == "00000105"); assert(Date(-4, 1, 5).toISOString() == "-00040105"); } } /++ Converts this $(D Date) to a string with the format YYYY-MM-DD. Examples: -------------------- assert(Date(2010, 7, 4).toISOExtString() == "2010-07-04"); assert(Date(1998, 12, 25).toISOExtString() == "1998-12-25"); assert(Date(0, 1, 5).toISOExtString() == "0000-01-05"); assert(Date(-4, 1, 5).toISOExtString() == "-0004-01-05"); -------------------- +/ string toISOExtString() const nothrow { try { if(_year >= 0) { if(_year < 10_000) return format("%04d-%02d-%02d", _year, _month, _day); else return format("+%05d-%02d-%02d", _year, _month, _day); } else if(_year > -10_000) return format("%05d-%02d-%02d", _year, _month, _day); else return format("%06d-%02d-%02d", _year, _month, _day); } catch(Exception e) assert(0, "format() threw."); } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(Date(9, 12, 4).toISOExtString(), "0009-12-04"); _assertPred!"=="(Date(99, 12, 4).toISOExtString(), "0099-12-04"); _assertPred!"=="(Date(999, 12, 4).toISOExtString(), "0999-12-04"); _assertPred!"=="(Date(9999, 7, 4).toISOExtString(), "9999-07-04"); _assertPred!"=="(Date(10000, 10, 20).toISOExtString(), "+10000-10-20"); //Test B.C. _assertPred!"=="(Date(0, 12, 4).toISOExtString(), "0000-12-04"); _assertPred!"=="(Date(-9, 12, 4).toISOExtString(), "-0009-12-04"); _assertPred!"=="(Date(-99, 12, 4).toISOExtString(), "-0099-12-04"); _assertPred!"=="(Date(-999, 12, 4).toISOExtString(), "-0999-12-04"); _assertPred!"=="(Date(-9999, 7, 4).toISOExtString(), "-9999-07-04"); _assertPred!"=="(Date(-10000, 10, 20).toISOExtString(), "-10000-10-20"); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, cdate.toISOExtString())); static assert(__traits(compiles, idate.toISOExtString())); //Verify Examples. assert(Date(2010, 7, 4).toISOExtString() == "2010-07-04"); assert(Date(1998, 12, 25).toISOExtString() == "1998-12-25"); assert(Date(0, 1, 5).toISOExtString() == "0000-01-05"); assert(Date(-4, 1, 5).toISOExtString() == "-0004-01-05"); } } /++ Converts this $(D Date) to a string with the format YYYY-Mon-DD. Examples: -------------------- assert(Date(2010, 7, 4).toSimpleString() == "2010-Jul-04"); assert(Date(1998, 12, 25).toSimpleString() == "1998-Dec-25"); assert(Date(0, 1, 5).toSimpleString() == "0000-Jan-05"); assert(Date(-4, 1, 5).toSimpleString() == "-0004-Jan-05"); -------------------- +/ string toSimpleString() const nothrow { try { if(_year >= 0) { if(_year < 10_000) return format("%04d-%s-%02d", _year, monthToString(_month, false), _day); else return format("+%05d-%s-%02d", _year, monthToString(_month, false), _day); } else if(_year > -10_000) return format("%05d-%s-%02d", _year, monthToString(_month, false), _day); else return format("%06d-%s-%02d", _year, monthToString(_month, false), _day); } catch(Exception e) assert(0, "format() threw."); } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(Date(9, 12, 4).toSimpleString(), "0009-Dec-04"); _assertPred!"=="(Date(99, 12, 4).toSimpleString(), "0099-Dec-04"); _assertPred!"=="(Date(999, 12, 4).toSimpleString(), "0999-Dec-04"); _assertPred!"=="(Date(9999, 7, 4).toSimpleString(), "9999-Jul-04"); _assertPred!"=="(Date(10000, 10, 20).toSimpleString(), "+10000-Oct-20"); //Test B.C. _assertPred!"=="(Date(0, 12, 4).toSimpleString(), "0000-Dec-04"); _assertPred!"=="(Date(-9, 12, 4).toSimpleString(), "-0009-Dec-04"); _assertPred!"=="(Date(-99, 12, 4).toSimpleString(), "-0099-Dec-04"); _assertPred!"=="(Date(-999, 12, 4).toSimpleString(), "-0999-Dec-04"); _assertPred!"=="(Date(-9999, 7, 4).toSimpleString(), "-9999-Jul-04"); _assertPred!"=="(Date(-10000, 10, 20).toSimpleString(), "-10000-Oct-20"); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, cdate.toSimpleString())); static assert(__traits(compiles, idate.toSimpleString())); //Verify Examples. assert(Date(2010, 7, 4).toSimpleString() == "2010-Jul-04"); assert(Date(1998, 12, 25).toSimpleString() == "1998-Dec-25"); assert(Date(0, 1, 5).toSimpleString() == "0000-Jan-05"); assert(Date(-4, 1, 5).toSimpleString() == "-0004-Jan-05"); } } //TODO Add a function which returns a string in a user-specified format. /+ Converts this $(D Date) to a string. +/ //Due to bug http://d.puremagic.com/issues/show_bug.cgi?id=3715 , we can't //have versions of toString() with extra modifiers, so we define one version //with modifiers and one without. string toString() { return toSimpleString(); } /++ Converts this $(D Date) to a string. +/ //Due to bug http://d.puremagic.com/issues/show_bug.cgi?id=3715 , we can't //have versions of toString() with extra modifiers, so we define one version //with modifiers and one without. string toString() const nothrow { return toSimpleString(); } unittest { version(testStdDateTime) { auto date = Date(1999, 7, 6); const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(__traits(compiles, date.toString())); static assert(__traits(compiles, cdate.toString())); static assert(__traits(compiles, idate.toString())); } } /++ Creates a $(D Date) from a string with the format YYYYMMDD. Whitespace is stripped from the given string. Params: isoString = A string formatted in the ISO format for dates. Throws: $(D DateTimeException) if the given string is not in the ISO format or if the resulting $(D Date) would not be valid. Examples: -------------------- assert(Date.fromISOString("20100704") == Date(2010, 7, 4)); assert(Date.fromISOString("19981225") == Date(1998, 12, 25)); assert(Date.fromISOString("00000105") == Date(0, 1, 5)); assert(Date.fromISOString("-00040105") == Date(-4, 1, 5)); assert(Date.fromISOString(" 20100704 ") == Date(2010, 7, 4)); -------------------- +/ static Date fromISOString(S)(in S isoString) if(isSomeString!S) { auto dstr = to!dstring(strip(isoString)); enforce(dstr.length >= 8, new DateTimeException(format("Invalid ISO String: %s", isoString))); auto day = dstr[$-2 .. $]; auto month = dstr[$-4 .. $-2]; auto year = dstr[0 .. $-4]; enforce(!canFind!(not!isDigit)(day), new DateTimeException(format("Invalid ISO String: %s", isoString))); enforce(!canFind!(not!isDigit)(month), new DateTimeException(format("Invalid ISO String: %s", isoString))); if(year.length > 4) { enforce(year.startsWith("-") || year.startsWith("+"), new DateTimeException(format("Invalid ISO String: %s", isoString))); enforce(!canFind!(not!isDigit)(year[1..$]), new DateTimeException(format("Invalid ISO String: %s", isoString))); } else enforce(!canFind!(not!isDigit)(year), new DateTimeException(format("Invalid ISO String: %s", isoString))); return Date(to!short(year), to!ubyte(month), to!ubyte(day)); } unittest { version(testStdDateTime) { assertThrown!DateTimeException(Date.fromISOString("")); assertThrown!DateTimeException(Date.fromISOString("990704")); assertThrown!DateTimeException(Date.fromISOString("0100704")); assertThrown!DateTimeException(Date.fromISOString("2010070")); assertThrown!DateTimeException(Date.fromISOString("2010070 ")); assertThrown!DateTimeException(Date.fromISOString("120100704")); assertThrown!DateTimeException(Date.fromISOString("-0100704")); assertThrown!DateTimeException(Date.fromISOString("+0100704")); assertThrown!DateTimeException(Date.fromISOString("2010070a")); assertThrown!DateTimeException(Date.fromISOString("20100a04")); assertThrown!DateTimeException(Date.fromISOString("2010a704")); assertThrown!DateTimeException(Date.fromISOString("99-07-04")); assertThrown!DateTimeException(Date.fromISOString("010-07-04")); assertThrown!DateTimeException(Date.fromISOString("2010-07-0")); assertThrown!DateTimeException(Date.fromISOString("2010-07-0 ")); assertThrown!DateTimeException(Date.fromISOString("12010-07-04")); assertThrown!DateTimeException(Date.fromISOString("-010-07-04")); assertThrown!DateTimeException(Date.fromISOString("+010-07-04")); assertThrown!DateTimeException(Date.fromISOString("2010-07-0a")); assertThrown!DateTimeException(Date.fromISOString("2010-0a-04")); assertThrown!DateTimeException(Date.fromISOString("2010-a7-04")); assertThrown!DateTimeException(Date.fromISOString("2010/07/04")); assertThrown!DateTimeException(Date.fromISOString("2010/7/04")); assertThrown!DateTimeException(Date.fromISOString("2010/7/4")); assertThrown!DateTimeException(Date.fromISOString("2010/07/4")); assertThrown!DateTimeException(Date.fromISOString("2010-7-04")); assertThrown!DateTimeException(Date.fromISOString("2010-7-4")); assertThrown!DateTimeException(Date.fromISOString("2010-07-4")); assertThrown!DateTimeException(Date.fromISOString("99Jul04")); assertThrown!DateTimeException(Date.fromISOString("010Jul04")); assertThrown!DateTimeException(Date.fromISOString("2010Jul0")); assertThrown!DateTimeException(Date.fromISOString("2010Jul0 ")); assertThrown!DateTimeException(Date.fromISOString("12010Jul04")); assertThrown!DateTimeException(Date.fromISOString("-010Jul04")); assertThrown!DateTimeException(Date.fromISOString("+010Jul04")); assertThrown!DateTimeException(Date.fromISOString("2010Jul0a")); assertThrown!DateTimeException(Date.fromISOString("2010Jua04")); assertThrown!DateTimeException(Date.fromISOString("2010aul04")); assertThrown!DateTimeException(Date.fromISOString("99-Jul-04")); assertThrown!DateTimeException(Date.fromISOString("010-Jul-04")); assertThrown!DateTimeException(Date.fromISOString("2010-Jul-0")); assertThrown!DateTimeException(Date.fromISOString("2010-Jul-0 ")); assertThrown!DateTimeException(Date.fromISOString("12010-Jul-04")); assertThrown!DateTimeException(Date.fromISOString("-010-Jul-04")); assertThrown!DateTimeException(Date.fromISOString("+010-Jul-04")); assertThrown!DateTimeException(Date.fromISOString("2010-Jul-0a")); assertThrown!DateTimeException(Date.fromISOString("2010-Jua-04")); assertThrown!DateTimeException(Date.fromISOString("2010-Jal-04")); assertThrown!DateTimeException(Date.fromISOString("2010-aul-04")); assertThrown!DateTimeException(Date.fromISOString("2010-07-04")); assertThrown!DateTimeException(Date.fromISOString("2010-Jul-04")); _assertPred!"=="(Date.fromISOString("19990706"), Date(1999, 7, 6)); _assertPred!"=="(Date.fromISOString("-19990706"), Date(-1999, 7, 6)); _assertPred!"=="(Date.fromISOString("+019990706"), Date(1999, 7, 6)); _assertPred!"=="(Date.fromISOString("19990706 "), Date(1999, 7, 6)); _assertPred!"=="(Date.fromISOString(" 19990706"), Date(1999, 7, 6)); _assertPred!"=="(Date.fromISOString(" 19990706 "), Date(1999, 7, 6)); //Verify Examples. assert(Date.fromISOString("20100704") == Date(2010, 7, 4)); assert(Date.fromISOString("19981225") == Date(1998, 12, 25)); assert(Date.fromISOString("00000105") == Date(0, 1, 5)); assert(Date.fromISOString("-00040105") == Date(-4, 1, 5)); assert(Date.fromISOString(" 20100704 ") == Date(2010, 7, 4)); } } /++ Creates a $(D Date) from a string with the format YYYY-MM-DD. Whitespace is stripped from the given string. Params: isoExtString = A string formatted in the ISO Extended format for dates. Throws: $(D DateTimeException) if the given string is not in the ISO Extended format or if the resulting $(D Date) would not be valid. Examples: -------------------- assert(Date.fromISOExtString("2010-07-04") == Date(2010, 7, 4)); assert(Date.fromISOExtString("1998-12-25") == Date(1998, 12, 25)); assert(Date.fromISOExtString("0000-01-05") == Date(0, 1, 5)); assert(Date.fromISOExtString("-0004-01-05") == Date(-4, 1, 5)); assert(Date.fromISOExtString(" 2010-07-04 ") == Date(2010, 7, 4)); -------------------- +/ static Date fromISOExtString(S)(in S isoExtString) if(isSomeString!(S)) { auto dstr = to!dstring(strip(isoExtString)); enforce(dstr.length >= 10, new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); auto day = dstr[$-2 .. $]; auto month = dstr[$-5 .. $-3]; auto year = dstr[0 .. $-6]; enforce(dstr[$-3] == '-', new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); enforce(dstr[$-6] == '-', new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); enforce(!canFind!(not!isDigit)(day), new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); enforce(!canFind!(not!isDigit)(month), new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); if(year.length > 4) { enforce(year.startsWith("-") || year.startsWith("+"), new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); enforce(!canFind!(not!isDigit)(year[1..$]), new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); } else enforce(!canFind!(not!isDigit)(year), new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); return Date(to!short(year), to!ubyte(month), to!ubyte(day)); } unittest { version(testStdDateTime) { assertThrown!DateTimeException(Date.fromISOExtString("")); assertThrown!DateTimeException(Date.fromISOExtString("990704")); assertThrown!DateTimeException(Date.fromISOExtString("0100704")); assertThrown!DateTimeException(Date.fromISOExtString("2010070")); assertThrown!DateTimeException(Date.fromISOExtString("2010070 ")); assertThrown!DateTimeException(Date.fromISOExtString("120100704")); assertThrown!DateTimeException(Date.fromISOExtString("-0100704")); assertThrown!DateTimeException(Date.fromISOExtString("+0100704")); assertThrown!DateTimeException(Date.fromISOExtString("2010070a")); assertThrown!DateTimeException(Date.fromISOExtString("20100a04")); assertThrown!DateTimeException(Date.fromISOExtString("2010a704")); assertThrown!DateTimeException(Date.fromISOExtString("99-07-04")); assertThrown!DateTimeException(Date.fromISOExtString("010-07-04")); assertThrown!DateTimeException(Date.fromISOExtString("2010-07-0")); assertThrown!DateTimeException(Date.fromISOExtString("2010-07-0 ")); assertThrown!DateTimeException(Date.fromISOExtString("12010-07-04")); assertThrown!DateTimeException(Date.fromISOExtString("-010-07-04")); assertThrown!DateTimeException(Date.fromISOExtString("+010-07-04")); assertThrown!DateTimeException(Date.fromISOExtString("2010-07-0a")); assertThrown!DateTimeException(Date.fromISOExtString("2010-0a-04")); assertThrown!DateTimeException(Date.fromISOExtString("2010-a7-04")); assertThrown!DateTimeException(Date.fromISOExtString("2010/07/04")); assertThrown!DateTimeException(Date.fromISOExtString("2010/7/04")); assertThrown!DateTimeException(Date.fromISOExtString("2010/7/4")); assertThrown!DateTimeException(Date.fromISOExtString("2010/07/4")); assertThrown!DateTimeException(Date.fromISOExtString("2010-7-04")); assertThrown!DateTimeException(Date.fromISOExtString("2010-7-4")); assertThrown!DateTimeException(Date.fromISOExtString("2010-07-4")); assertThrown!DateTimeException(Date.fromISOExtString("99Jul04")); assertThrown!DateTimeException(Date.fromISOExtString("010Jul04")); assertThrown!DateTimeException(Date.fromISOExtString("2010Jul0")); assertThrown!DateTimeException(Date.fromISOExtString("2010-Jul-0 ")); assertThrown!DateTimeException(Date.fromISOExtString("12010Jul04")); assertThrown!DateTimeException(Date.fromISOExtString("-010Jul04")); assertThrown!DateTimeException(Date.fromISOExtString("+010Jul04")); assertThrown!DateTimeException(Date.fromISOExtString("2010Jul0a")); assertThrown!DateTimeException(Date.fromISOExtString("2010Jua04")); assertThrown!DateTimeException(Date.fromISOExtString("2010aul04")); assertThrown!DateTimeException(Date.fromISOExtString("99-Jul-04")); assertThrown!DateTimeException(Date.fromISOExtString("010-Jul-04")); assertThrown!DateTimeException(Date.fromISOExtString("2010-Jul-0")); assertThrown!DateTimeException(Date.fromISOExtString("2010Jul0 ")); assertThrown!DateTimeException(Date.fromISOExtString("12010-Jul-04")); assertThrown!DateTimeException(Date.fromISOExtString("-010-Jul-04")); assertThrown!DateTimeException(Date.fromISOExtString("+010-Jul-04")); assertThrown!DateTimeException(Date.fromISOExtString("2010-Jul-0a")); assertThrown!DateTimeException(Date.fromISOExtString("2010-Jua-04")); assertThrown!DateTimeException(Date.fromISOExtString("2010-Jal-04")); assertThrown!DateTimeException(Date.fromISOExtString("2010-aul-04")); assertThrown!DateTimeException(Date.fromISOExtString("20100704")); assertThrown!DateTimeException(Date.fromISOExtString("2010-Jul-04")); _assertPred!"=="(Date.fromISOExtString("1999-07-06"), Date(1999, 7, 6)); _assertPred!"=="(Date.fromISOExtString("-1999-07-06"), Date(-1999, 7, 6)); _assertPred!"=="(Date.fromISOExtString("+01999-07-06"), Date(1999, 7, 6)); _assertPred!"=="(Date.fromISOExtString("1999-07-06 "), Date(1999, 7, 6)); _assertPred!"=="(Date.fromISOExtString(" 1999-07-06"), Date(1999, 7, 6)); _assertPred!"=="(Date.fromISOExtString(" 1999-07-06 "), Date(1999, 7, 6)); //Verify Examples. assert(Date.fromISOExtString("2010-07-04") == Date(2010, 7, 4)); assert(Date.fromISOExtString("1998-12-25") == Date(1998, 12, 25)); assert(Date.fromISOExtString("0000-01-05") == Date(0, 1, 5)); assert(Date.fromISOExtString("-0004-01-05") == Date(-4, 1, 5)); assert(Date.fromISOExtString(" 2010-07-04 ") == Date(2010, 7, 4)); } } /++ Creates a $(D Date) from a string with the format YYYY-Mon-DD. Whitespace is stripped from the given string. Params: simpleString = A string formatted in the way that toSimpleString formats dates. Throws: $(D DateTimeException) if the given string is not in the correct format or if the resulting $(D Date) would not be valid. Examples: -------------------- assert(Date.fromSimpleString("2010-Jul-04") == Date(2010, 7, 4)); assert(Date.fromSimpleString("1998-Dec-25") == Date(1998, 12, 25)); assert(Date.fromSimpleString("0000-Jan-05") == Date(0, 1, 5)); assert(Date.fromSimpleString("-0004-Jan-05") == Date(-4, 1, 5)); assert(Date.fromSimpleString(" 2010-Jul-04 ") == Date(2010, 7, 4)); -------------------- +/ static Date fromSimpleString(S)(in S simpleString) if(isSomeString!(S)) { auto dstr = to!dstring(strip(simpleString)); enforce(dstr.length >= 11, new DateTimeException(format("Invalid string format: %s", simpleString))); auto day = dstr[$-2 .. $]; auto month = monthFromString(to!string(dstr[$-6 .. $-3])); auto year = dstr[0 .. $-7]; enforce(dstr[$-3] == '-', new DateTimeException(format("Invalid string format: %s", simpleString))); enforce(dstr[$-7] == '-', new DateTimeException(format("Invalid string format: %s", simpleString))); enforce(!canFind!(not!isDigit)(day), new DateTimeException(format("Invalid string format: %s", simpleString))); if(year.length > 4) { enforce(year.startsWith("-") || year.startsWith("+"), new DateTimeException(format("Invalid string format: %s", simpleString))); enforce(!canFind!(not!isDigit)(year[1..$]), new DateTimeException(format("Invalid string format: %s", simpleString))); } else enforce(!canFind!(not!isDigit)(year), new DateTimeException(format("Invalid string format: %s", simpleString))); return Date(to!short(year), month, to!ubyte(day)); } unittest { version(testStdDateTime) { assertThrown!DateTimeException(Date.fromSimpleString("")); assertThrown!DateTimeException(Date.fromSimpleString("990704")); assertThrown!DateTimeException(Date.fromSimpleString("0100704")); assertThrown!DateTimeException(Date.fromSimpleString("2010070")); assertThrown!DateTimeException(Date.fromSimpleString("2010070 ")); assertThrown!DateTimeException(Date.fromSimpleString("120100704")); assertThrown!DateTimeException(Date.fromSimpleString("-0100704")); assertThrown!DateTimeException(Date.fromSimpleString("+0100704")); assertThrown!DateTimeException(Date.fromSimpleString("2010070a")); assertThrown!DateTimeException(Date.fromSimpleString("20100a04")); assertThrown!DateTimeException(Date.fromSimpleString("2010a704")); assertThrown!DateTimeException(Date.fromSimpleString("99-07-04")); assertThrown!DateTimeException(Date.fromSimpleString("010-07-04")); assertThrown!DateTimeException(Date.fromSimpleString("2010-07-0")); assertThrown!DateTimeException(Date.fromSimpleString("2010-07-0 ")); assertThrown!DateTimeException(Date.fromSimpleString("12010-07-04")); assertThrown!DateTimeException(Date.fromSimpleString("-010-07-04")); assertThrown!DateTimeException(Date.fromSimpleString("+010-07-04")); assertThrown!DateTimeException(Date.fromSimpleString("2010-07-0a")); assertThrown!DateTimeException(Date.fromSimpleString("2010-0a-04")); assertThrown!DateTimeException(Date.fromSimpleString("2010-a7-04")); assertThrown!DateTimeException(Date.fromSimpleString("2010/07/04")); assertThrown!DateTimeException(Date.fromSimpleString("2010/7/04")); assertThrown!DateTimeException(Date.fromSimpleString("2010/7/4")); assertThrown!DateTimeException(Date.fromSimpleString("2010/07/4")); assertThrown!DateTimeException(Date.fromSimpleString("2010-7-04")); assertThrown!DateTimeException(Date.fromSimpleString("2010-7-4")); assertThrown!DateTimeException(Date.fromSimpleString("2010-07-4")); assertThrown!DateTimeException(Date.fromSimpleString("99Jul04")); assertThrown!DateTimeException(Date.fromSimpleString("010Jul04")); assertThrown!DateTimeException(Date.fromSimpleString("2010Jul0")); assertThrown!DateTimeException(Date.fromSimpleString("2010Jul0 ")); assertThrown!DateTimeException(Date.fromSimpleString("12010Jul04")); assertThrown!DateTimeException(Date.fromSimpleString("-010Jul04")); assertThrown!DateTimeException(Date.fromSimpleString("+010Jul04")); assertThrown!DateTimeException(Date.fromSimpleString("2010Jul0a")); assertThrown!DateTimeException(Date.fromSimpleString("2010Jua04")); assertThrown!DateTimeException(Date.fromSimpleString("2010aul04")); assertThrown!DateTimeException(Date.fromSimpleString("99-Jul-04")); assertThrown!DateTimeException(Date.fromSimpleString("010-Jul-04")); assertThrown!DateTimeException(Date.fromSimpleString("2010-Jul-0")); assertThrown!DateTimeException(Date.fromSimpleString("2010-Jul-0 ")); assertThrown!DateTimeException(Date.fromSimpleString("12010-Jul-04")); assertThrown!DateTimeException(Date.fromSimpleString("-010-Jul-04")); assertThrown!DateTimeException(Date.fromSimpleString("+010-Jul-04")); assertThrown!DateTimeException(Date.fromSimpleString("2010-Jul-0a")); assertThrown!DateTimeException(Date.fromSimpleString("2010-Jua-04")); assertThrown!DateTimeException(Date.fromSimpleString("2010-Jal-04")); assertThrown!DateTimeException(Date.fromSimpleString("2010-aul-04")); assertThrown!DateTimeException(Date.fromSimpleString("20100704")); assertThrown!DateTimeException(Date.fromSimpleString("2010-07-04")); _assertPred!"=="(Date.fromSimpleString("1999-Jul-06"), Date(1999, 7, 6)); _assertPred!"=="(Date.fromSimpleString("-1999-Jul-06"), Date(-1999, 7, 6)); _assertPred!"=="(Date.fromSimpleString("+01999-Jul-06"), Date(1999, 7, 6)); _assertPred!"=="(Date.fromSimpleString("1999-Jul-06 "), Date(1999, 7, 6)); _assertPred!"=="(Date.fromSimpleString(" 1999-Jul-06"), Date(1999, 7, 6)); _assertPred!"=="(Date.fromSimpleString(" 1999-Jul-06 "), Date(1999, 7, 6)); //Verify Examples. assert(Date.fromSimpleString("2010-Jul-04") == Date(2010, 7, 4)); assert(Date.fromSimpleString("1998-Dec-25") == Date(1998, 12, 25)); assert(Date.fromSimpleString("0000-Jan-05") == Date(0, 1, 5)); assert(Date.fromSimpleString("-0004-Jan-05") == Date(-4, 1, 5)); assert(Date.fromSimpleString(" 2010-Jul-04 ") == Date(2010, 7, 4)); } } //TODO Add function which takes a user-specified time format and produces a Date //TODO Add function which takes pretty much any time-string and produces a Date // Obviously, it will be less efficient, and it probably won't manage _every_ // possible date format, but a smart conversion function would be nice. /++ Returns the $(D Date) farthest in the past which is representable by $(D Date). +/ @property static Date min() pure nothrow { auto date = Date.init; date._year = short.min; date._month = Month.jan; date._day = 1; return date; } unittest { version(testStdDateTime) { assert(Date.min.year < 0); assert(Date.min < Date.max); } } /++ Returns the $(D Date) farthest in the future which is representable by $(D Date). +/ @property static Date max() pure nothrow { auto date = Date.init; date._year = short.max; date._month = Month.dec; date._day = 31; return date; } unittest { version(testStdDateTime) { assert(Date.max.year > 0); assert(Date.max > Date.min); } } private: /+ Whether the given values form a valid date. Params: year = The year to test. month = The month of the Gregorian Calendar to test. day = The day of the month to test. +/ static bool _valid(int year, int month, int day) pure nothrow { if(!valid!"months"(month)) return false; return valid!"days"(year, month, day); } /+ Adds the given number of days to this $(D Date). A negative number will subtract. The month will be adjusted along with the day if the number of days added (or subtracted) would overflow (or underflow) the current month. The year will be adjusted along with the month if the increase (or decrease) to the month would cause it to overflow (or underflow) the current year. $(D addDays(numDays)) is effectively equivalent to $(D date.dayOfGregorianCal = date.dayOfGregorianCal + days). Params: days = The number of days to add to this Date. +/ ref Date addDays(long days) pure nothrow { dayOfGregorianCal = cast(int)(dayOfGregorianCal + days); return this; } unittest { version(testStdDateTime) { //Test A.D. { auto date = Date(1999, 2, 28); date.addDays(1); _assertPred!"=="(date, Date(1999, 3, 1)); date.addDays(-1); _assertPred!"=="(date, Date(1999, 2, 28)); } { auto date = Date(2000, 2, 28); date.addDays(1); _assertPred!"=="(date, Date(2000, 2, 29)); date.addDays(1); _assertPred!"=="(date, Date(2000, 3, 1)); date.addDays(-1); _assertPred!"=="(date, Date(2000, 2, 29)); } { auto date = Date(1999, 6, 30); date.addDays(1); _assertPred!"=="(date, Date(1999, 7, 1)); date.addDays(-1); _assertPred!"=="(date, Date(1999, 6, 30)); } { auto date = Date(1999, 7, 31); date.addDays(1); _assertPred!"=="(date, Date(1999, 8, 1)); date.addDays(-1); _assertPred!"=="(date, Date(1999, 7, 31)); } { auto date = Date(1999, 1, 1); date.addDays(-1); _assertPred!"=="(date, Date(1998, 12, 31)); date.addDays(1); _assertPred!"=="(date, Date(1999, 1, 1)); } { auto date = Date(1999, 7, 6); date.addDays(9); _assertPred!"=="(date, Date(1999, 7, 15)); date.addDays(-11); _assertPred!"=="(date, Date(1999, 7, 4)); date.addDays(30); _assertPred!"=="(date, Date(1999, 8, 3)); date.addDays(-3); _assertPred!"=="(date, Date(1999, 7, 31)); } { auto date = Date(1999, 7, 6); date.addDays(365); _assertPred!"=="(date, Date(2000, 7, 5)); date.addDays(-365); _assertPred!"=="(date, Date(1999, 7, 6)); date.addDays(366); _assertPred!"=="(date, Date(2000, 7, 6)); date.addDays(730); _assertPred!"=="(date, Date(2002, 7, 6)); date.addDays(-1096); _assertPred!"=="(date, Date(1999, 7, 6)); } //Test B.C. { auto date = Date(-1999, 2, 28); date.addDays(1); _assertPred!"=="(date, Date(-1999, 3, 1)); date.addDays(-1); _assertPred!"=="(date, Date(-1999, 2, 28)); } { auto date = Date(-2000, 2, 28); date.addDays(1); _assertPred!"=="(date, Date(-2000, 2, 29)); date.addDays(1); _assertPred!"=="(date, Date(-2000, 3, 1)); date.addDays(-1); _assertPred!"=="(date, Date(-2000, 2, 29)); } { auto date = Date(-1999, 6, 30); date.addDays(1); _assertPred!"=="(date, Date(-1999, 7, 1)); date.addDays(-1); _assertPred!"=="(date, Date(-1999, 6, 30)); } { auto date = Date(-1999, 7, 31); date.addDays(1); _assertPred!"=="(date, Date(-1999, 8, 1)); date.addDays(-1); _assertPred!"=="(date, Date(-1999, 7, 31)); } { auto date = Date(-1999, 1, 1); date.addDays(-1); _assertPred!"=="(date, Date(-2000, 12, 31)); date.addDays(1); _assertPred!"=="(date, Date(-1999, 1, 1)); } { auto date = Date(-1999, 7, 6); date.addDays(9); _assertPred!"=="(date, Date(-1999, 7, 15)); date.addDays(-11); _assertPred!"=="(date, Date(-1999, 7, 4)); date.addDays(30); _assertPred!"=="(date, Date(-1999, 8, 3)); date.addDays(-3); } { auto date = Date(-1999, 7, 6); date.addDays(365); _assertPred!"=="(date, Date(-1998, 7, 6)); date.addDays(-365); _assertPred!"=="(date, Date(-1999, 7, 6)); date.addDays(366); _assertPred!"=="(date, Date(-1998, 7, 7)); date.addDays(730); _assertPred!"=="(date, Date(-1996, 7, 6)); date.addDays(-1096); _assertPred!"=="(date, Date(-1999, 7, 6)); } //Test Both { auto date = Date(1, 7, 6); date.addDays(-365); _assertPred!"=="(date, Date(0, 7, 6)); date.addDays(365); _assertPred!"=="(date, Date(1, 7, 6)); date.addDays(-731); _assertPred!"=="(date, Date(-1, 7, 6)); date.addDays(730); _assertPred!"=="(date, Date(1, 7, 5)); } const cdate = Date(1999, 7, 6); immutable idate = Date(1999, 7, 6); static assert(!__traits(compiles, cdate.addDays(12))); static assert(!__traits(compiles, idate.addDays(12))); } } pure invariant() { assert(valid!"months"(_month), "Invariant Failure: year [" ~ numToString(_year) ~ "] month [" ~ numToString(_month) ~ "] day [" ~ numToString(_day) ~ "]"); assert(valid!"days"(_year, _month, _day), "Invariant Failure: year [" ~ numToString(_year) ~ "] month [" ~ numToString(_month) ~ "] day [" ~ numToString(_day) ~ "]"); } short _year = 1; Month _month = Month.jan; ubyte _day = 1; } /++ Represents a time of day with hours, minutes, and seconds. It uses 24 hour time. +/ struct TimeOfDay { public: /++ Params: hour = Hour of the day [0 - 24$(RPAREN). minute = Minute of the hour [0 - 60$(RPAREN). second = Second of the minute [0 - 60$(RPAREN). Throws: $(D DateTimeException) if the resulting $(D TimeOfDay) would be not be valid. +/ this(int hour, int minute, int second = 0) pure { enforceValid!"hours"(hour); enforceValid!"minutes"(minute); enforceValid!"seconds"(second); _hour = cast(ubyte)hour; _minute = cast(ubyte)minute; _second = cast(ubyte)second; } unittest { version(testStdDateTime) { assert(TimeOfDay(0, 0) == TimeOfDay.init); { auto tod = TimeOfDay(0, 0); _assertPred!"=="(tod._hour, 0); _assertPred!"=="(tod._minute, 0); _assertPred!"=="(tod._second, 0); } { auto tod = TimeOfDay(12, 30, 33); _assertPred!"=="(tod._hour, 12); _assertPred!"=="(tod._minute, 30); _assertPred!"=="(tod._second, 33); } { auto tod = TimeOfDay(23, 59, 59); _assertPred!"=="(tod._hour, 23); _assertPred!"=="(tod._minute, 59); _assertPred!"=="(tod._second, 59); } assertThrown!DateTimeException(TimeOfDay(24, 0, 0)); assertThrown!DateTimeException(TimeOfDay(0, 60, 0)); assertThrown!DateTimeException(TimeOfDay(0, 0, 60)); } } /++ Compares this $(D TimeOfDay) with the given $(D TimeOfDay). Returns: $(BOOKTABLE, $(TR $(TD this &lt; rhs) $(TD &lt; 0)) $(TR $(TD this == rhs) $(TD 0)) $(TR $(TD this &gt; rhs) $(TD &gt; 0)) ) +/ int opCmp(in TimeOfDay rhs) const pure nothrow { if(_hour < rhs._hour) return -1; if(_hour > rhs._hour) return 1; if(_minute < rhs._minute) return -1; if(_minute > rhs._minute) return 1; if(_second < rhs._second) return -1; if(_second > rhs._second) return 1; return 0; } unittest { version(testStdDateTime) { _assertPred!("opCmp", "==")(TimeOfDay(0, 0, 0), TimeOfDay.init); _assertPred!("opCmp", "==")(TimeOfDay(0, 0, 0), TimeOfDay(0, 0, 0)); _assertPred!("opCmp", "==")(TimeOfDay(12, 0, 0), TimeOfDay(12, 0, 0)); _assertPred!("opCmp", "==")(TimeOfDay(0, 30, 0), TimeOfDay(0, 30, 0)); _assertPred!("opCmp", "==")(TimeOfDay(0, 0, 33), TimeOfDay(0, 0, 33)); _assertPred!("opCmp", "==")(TimeOfDay(12, 30, 0), TimeOfDay(12, 30, 0)); _assertPred!("opCmp", "==")(TimeOfDay(12, 30, 33), TimeOfDay(12, 30, 33)); _assertPred!("opCmp", "==")(TimeOfDay(0, 30, 33), TimeOfDay(0, 30, 33)); _assertPred!("opCmp", "==")(TimeOfDay(0, 0, 33), TimeOfDay(0, 0, 33)); _assertPred!("opCmp", "<")(TimeOfDay(12, 30, 33), TimeOfDay(13, 30, 33)); _assertPred!("opCmp", ">")(TimeOfDay(13, 30, 33), TimeOfDay(12, 30, 33)); _assertPred!("opCmp", "<")(TimeOfDay(12, 30, 33), TimeOfDay(12, 31, 33)); _assertPred!("opCmp", ">")(TimeOfDay(12, 31, 33), TimeOfDay(12, 30, 33)); _assertPred!("opCmp", "<")(TimeOfDay(12, 30, 33), TimeOfDay(12, 30, 34)); _assertPred!("opCmp", ">")(TimeOfDay(12, 30, 34), TimeOfDay(12, 30, 33)); _assertPred!("opCmp", ">")(TimeOfDay(13, 30, 33), TimeOfDay(12, 30, 34)); _assertPred!("opCmp", "<")(TimeOfDay(12, 30, 34), TimeOfDay(13, 30, 33)); _assertPred!("opCmp", ">")(TimeOfDay(13, 30, 33), TimeOfDay(12, 31, 33)); _assertPred!("opCmp", "<")(TimeOfDay(12, 31, 33), TimeOfDay(13, 30, 33)); _assertPred!("opCmp", ">")(TimeOfDay(12, 31, 33), TimeOfDay(12, 30, 34)); _assertPred!("opCmp", "<")(TimeOfDay(12, 30, 34), TimeOfDay(12, 31, 33)); const ctod = TimeOfDay(12, 30, 33); immutable itod = TimeOfDay(12, 30, 33); static assert(__traits(compiles, ctod.opCmp(itod))); static assert(__traits(compiles, itod.opCmp(ctod))); } } /++ Hours passed midnight. +/ @property ubyte hour() const pure nothrow { return _hour; } unittest { version(testStdDateTime) { _assertPred!"=="(TimeOfDay.init.hour, 0); _assertPred!"=="(TimeOfDay(12, 0, 0).hour, 12); const ctod = TimeOfDay(12, 0, 0); immutable itod = TimeOfDay(12, 0, 0); static assert(__traits(compiles, ctod.hour == 12)); static assert(__traits(compiles, itod.hour == 12)); } } /++ Hours passed midnight. Params: hour = The hour of the day to set this $(D TimeOfDay)'s hour to. Throws: $(D DateTimeException) if the given hour would result in an invalid $(D TimeOfDay). +/ @property void hour(int hour) pure { enforceValid!"hours"(hour); _hour = cast(ubyte)hour; } unittest { version(testStdDateTime) { assertThrown!DateTimeException((){TimeOfDay(0, 0, 0).hour = 24;}()); auto tod = TimeOfDay(0, 0, 0); tod.hour = 12; _assertPred!"=="(tod, TimeOfDay(12, 0, 0)); const ctod = TimeOfDay(0, 0, 0); immutable itod = TimeOfDay(0, 0, 0); static assert(!__traits(compiles, ctod.hour = 12)); static assert(!__traits(compiles, itod.hour = 12)); } } /++ Minutes passed the hour. +/ @property ubyte minute() const pure nothrow { return _minute; } unittest { version(testStdDateTime) { _assertPred!"=="(TimeOfDay.init.minute, 0); _assertPred!"=="(TimeOfDay(0, 30, 0).minute, 30); const ctod = TimeOfDay(0, 30, 0); immutable itod = TimeOfDay(0, 30, 0); static assert(__traits(compiles, ctod.minute == 30)); static assert(__traits(compiles, itod.minute == 30)); } } /++ Minutes passed the hour. Params: minute = The minute to set this $(D TimeOfDay)'s minute to. Throws: $(D DateTimeException) if the given minute would result in an invalid $(D TimeOfDay). +/ @property void minute(int minute) pure { enforceValid!"minutes"(minute); _minute = cast(ubyte)minute; } unittest { version(testStdDateTime) { assertThrown!DateTimeException((){TimeOfDay(0, 0, 0).minute = 60;}()); auto tod = TimeOfDay(0, 0, 0); tod.minute = 30; _assertPred!"=="(tod, TimeOfDay(0, 30, 0)); const ctod = TimeOfDay(0, 0, 0); immutable itod = TimeOfDay(0, 0, 0); static assert(!__traits(compiles, ctod.minute = 30)); static assert(!__traits(compiles, itod.minute = 30)); } } /++ Seconds passed the minute. +/ @property ubyte second() const pure nothrow { return _second; } unittest { version(testStdDateTime) { _assertPred!"=="(TimeOfDay.init.second, 0); _assertPred!"=="(TimeOfDay(0, 0, 33).second, 33); const ctod = TimeOfDay(0, 0, 33); immutable itod = TimeOfDay(0, 0, 33); static assert(__traits(compiles, ctod.second == 33)); static assert(__traits(compiles, itod.second == 33)); } } /++ Seconds passed the minute. Params: second = The second to set this $(D TimeOfDay)'s second to. Throws: $(D DateTimeException) if the given second would result in an invalid $(D TimeOfDay). +/ @property void second(int second) pure { enforceValid!"seconds"(second); _second = cast(ubyte)second; } unittest { version(testStdDateTime) { assertThrown!DateTimeException((){TimeOfDay(0, 0, 0).second = 60;}()); auto tod = TimeOfDay(0, 0, 0); tod.second = 33; _assertPred!"=="(tod, TimeOfDay(0, 0, 33)); const ctod = TimeOfDay(0, 0, 0); immutable itod = TimeOfDay(0, 0, 0); static assert(!__traits(compiles, ctod.second = 33)); static assert(!__traits(compiles, itod.second = 33)); } } /++ Adds the given number of units to this $(D TimeOfDay). A negative number will subtract. The difference between rolling and adding is that rolling does not affect larger units. For instance, rolling a $(D TimeOfDay) one hours's worth of minutes gets the exact same $(D TimeOfDay). Accepted units are $(D "hours"), $(D "minutes"), and $(D "seconds"). Params: units = The units to add. value = The number of $(D_PARAM units) to add to this $(D TimeOfDay). Examples: -------------------- auto tod1 = TimeOfDay(7, 12, 0); tod1.roll!"hours"(1); assert(tod1 == TimeOfDay(8, 12, 0)); auto tod2 = TimeOfDay(7, 12, 0); tod2.roll!"hours"(-1); assert(tod2 == TimeOfDay(6, 12, 0)); auto tod3 = TimeOfDay(23, 59, 0); tod3.roll!"minutes"(1); assert(tod3 == TimeOfDay(23, 0, 0)); auto tod4 = TimeOfDay(0, 0, 0); tod4.roll!"minutes"(-1); assert(tod4 == TimeOfDay(0, 59, 0)); auto tod5 = TimeOfDay(23, 59, 59); tod5.roll!"seconds"(1); assert(tod5 == TimeOfDay(23, 59, 0)); auto tod6 = TimeOfDay(0, 0, 0); tod6.roll!"seconds"(-1); assert(tod6 == TimeOfDay(0, 0, 59)); -------------------- +/ /+ref TimeOfDay+/ void roll(string units)(long value) pure nothrow if(units == "hours") { this += dur!"hours"(value); } //Verify Examples. unittest { version(testStdDateTime) { auto tod1 = TimeOfDay(7, 12, 0); tod1.roll!"hours"(1); assert(tod1 == TimeOfDay(8, 12, 0)); auto tod2 = TimeOfDay(7, 12, 0); tod2.roll!"hours"(-1); assert(tod2 == TimeOfDay(6, 12, 0)); auto tod3 = TimeOfDay(23, 59, 0); tod3.roll!"minutes"(1); assert(tod3 == TimeOfDay(23, 0, 0)); auto tod4 = TimeOfDay(0, 0, 0); tod4.roll!"minutes"(-1); assert(tod4 == TimeOfDay(0, 59, 0)); auto tod5 = TimeOfDay(23, 59, 59); tod5.roll!"seconds"(1); assert(tod5 == TimeOfDay(23, 59, 0)); auto tod6 = TimeOfDay(0, 0, 0); tod6.roll!"seconds"(-1); assert(tod6 == TimeOfDay(0, 0, 59)); } } unittest { version(testStdDateTime) { const ctod = TimeOfDay(0, 0, 0); immutable itod = TimeOfDay(0, 0, 0); static assert(!__traits(compiles, ctod.roll!"hours"(53))); static assert(!__traits(compiles, itod.roll!"hours"(53))); } } //Shares documentation with "hours" version. /+ref TimeOfDay+/ void roll(string units)(long value) pure nothrow if(units == "minutes" || units == "seconds") { static if(units == "minutes") enum memberVarStr = "minute"; else static if(units == "seconds") enum memberVarStr = "second"; else static assert(0); value %= 60; mixin("auto newVal = cast(ubyte)(_" ~ memberVarStr ~ ") + value;"); if(value < 0) { if(newVal < 0) newVal += 60; } else if(newVal >= 60) newVal -= 60; mixin("_" ~ memberVarStr ~ " = cast(ubyte)newVal;"); } //Test roll!"minutes"(). unittest { version(testStdDateTime) { static void testTOD(TimeOfDay orig, int minutes, in TimeOfDay expected, size_t line = __LINE__) { orig.roll!"minutes"(minutes); _assertPred!"=="(orig, expected, "", __FILE__, line); } testTOD(TimeOfDay(12, 30, 33), 0, TimeOfDay(12, 30, 33)); testTOD(TimeOfDay(12, 30, 33), 1, TimeOfDay(12, 31, 33)); testTOD(TimeOfDay(12, 30, 33), 2, TimeOfDay(12, 32, 33)); testTOD(TimeOfDay(12, 30, 33), 3, TimeOfDay(12, 33, 33)); testTOD(TimeOfDay(12, 30, 33), 4, TimeOfDay(12, 34, 33)); testTOD(TimeOfDay(12, 30, 33), 5, TimeOfDay(12, 35, 33)); testTOD(TimeOfDay(12, 30, 33), 10, TimeOfDay(12, 40, 33)); testTOD(TimeOfDay(12, 30, 33), 15, TimeOfDay(12, 45, 33)); testTOD(TimeOfDay(12, 30, 33), 29, TimeOfDay(12, 59, 33)); testTOD(TimeOfDay(12, 30, 33), 30, TimeOfDay(12, 0, 33)); testTOD(TimeOfDay(12, 30, 33), 45, TimeOfDay(12, 15, 33)); testTOD(TimeOfDay(12, 30, 33), 60, TimeOfDay(12, 30, 33)); testTOD(TimeOfDay(12, 30, 33), 75, TimeOfDay(12, 45, 33)); testTOD(TimeOfDay(12, 30, 33), 90, TimeOfDay(12, 0, 33)); testTOD(TimeOfDay(12, 30, 33), 100, TimeOfDay(12, 10, 33)); testTOD(TimeOfDay(12, 30, 33), 689, TimeOfDay(12, 59, 33)); testTOD(TimeOfDay(12, 30, 33), 690, TimeOfDay(12, 0, 33)); testTOD(TimeOfDay(12, 30, 33), 691, TimeOfDay(12, 1, 33)); testTOD(TimeOfDay(12, 30, 33), 960, TimeOfDay(12, 30, 33)); testTOD(TimeOfDay(12, 30, 33), 1439, TimeOfDay(12, 29, 33)); testTOD(TimeOfDay(12, 30, 33), 1440, TimeOfDay(12, 30, 33)); testTOD(TimeOfDay(12, 30, 33), 1441, TimeOfDay(12, 31, 33)); testTOD(TimeOfDay(12, 30, 33), 2880, TimeOfDay(12, 30, 33)); testTOD(TimeOfDay(12, 30, 33), -1, TimeOfDay(12, 29, 33)); testTOD(TimeOfDay(12, 30, 33), -2, TimeOfDay(12, 28, 33)); testTOD(TimeOfDay(12, 30, 33), -3, TimeOfDay(12, 27, 33)); testTOD(TimeOfDay(12, 30, 33), -4, TimeOfDay(12, 26, 33)); testTOD(TimeOfDay(12, 30, 33), -5, TimeOfDay(12, 25, 33)); testTOD(TimeOfDay(12, 30, 33), -10, TimeOfDay(12, 20, 33)); testTOD(TimeOfDay(12, 30, 33), -15, TimeOfDay(12, 15, 33)); testTOD(TimeOfDay(12, 30, 33), -29, TimeOfDay(12, 1, 33)); testTOD(TimeOfDay(12, 30, 33), -30, TimeOfDay(12, 0, 33)); testTOD(TimeOfDay(12, 30, 33), -45, TimeOfDay(12, 45, 33)); testTOD(TimeOfDay(12, 30, 33), -60, TimeOfDay(12, 30, 33)); testTOD(TimeOfDay(12, 30, 33), -75, TimeOfDay(12, 15, 33)); testTOD(TimeOfDay(12, 30, 33), -90, TimeOfDay(12, 0, 33)); testTOD(TimeOfDay(12, 30, 33), -100, TimeOfDay(12, 50, 33)); testTOD(TimeOfDay(12, 30, 33), -749, TimeOfDay(12, 1, 33)); testTOD(TimeOfDay(12, 30, 33), -750, TimeOfDay(12, 0, 33)); testTOD(TimeOfDay(12, 30, 33), -751, TimeOfDay(12, 59, 33)); testTOD(TimeOfDay(12, 30, 33), -960, TimeOfDay(12, 30, 33)); testTOD(TimeOfDay(12, 30, 33), -1439, TimeOfDay(12, 31, 33)); testTOD(TimeOfDay(12, 30, 33), -1440, TimeOfDay(12, 30, 33)); testTOD(TimeOfDay(12, 30, 33), -1441, TimeOfDay(12, 29, 33)); testTOD(TimeOfDay(12, 30, 33), -2880, TimeOfDay(12, 30, 33)); testTOD(TimeOfDay(12, 0, 33), 1, TimeOfDay(12, 1, 33)); testTOD(TimeOfDay(12, 0, 33), 0, TimeOfDay(12, 0, 33)); testTOD(TimeOfDay(12, 0, 33), -1, TimeOfDay(12, 59, 33)); testTOD(TimeOfDay(11, 59, 33), 1, TimeOfDay(11, 0, 33)); testTOD(TimeOfDay(11, 59, 33), 0, TimeOfDay(11, 59, 33)); testTOD(TimeOfDay(11, 59, 33), -1, TimeOfDay(11, 58, 33)); testTOD(TimeOfDay(0, 0, 33), 1, TimeOfDay(0, 1, 33)); testTOD(TimeOfDay(0, 0, 33), 0, TimeOfDay(0, 0, 33)); testTOD(TimeOfDay(0, 0, 33), -1, TimeOfDay(0, 59, 33)); testTOD(TimeOfDay(23, 59, 33), 1, TimeOfDay(23, 0, 33)); testTOD(TimeOfDay(23, 59, 33), 0, TimeOfDay(23, 59, 33)); testTOD(TimeOfDay(23, 59, 33), -1, TimeOfDay(23, 58, 33)); const ctod = TimeOfDay(0, 0, 0); immutable itod = TimeOfDay(0, 0, 0); static assert(!__traits(compiles, ctod.roll!"minutes"(7))); static assert(!__traits(compiles, itod.roll!"minutes"(7))); //Verify Examples. auto tod1 = TimeOfDay(7, 12, 0); tod1.roll!"minutes"(1); assert(tod1 == TimeOfDay(7, 13, 0)); auto tod2 = TimeOfDay(7, 12, 0); tod2.roll!"minutes"(-1); assert(tod2 == TimeOfDay(7, 11, 0)); auto tod3 = TimeOfDay(23, 59, 0); tod3.roll!"minutes"(1); assert(tod3 == TimeOfDay(23, 0, 0)); auto tod4 = TimeOfDay(0, 0, 0); tod4.roll!"minutes"(-1); assert(tod4 == TimeOfDay(0, 59, 0)); auto tod5 = TimeOfDay(7, 32, 12); tod5.roll!"seconds"(1); assert(tod5 == TimeOfDay(7, 32, 13)); auto tod6 = TimeOfDay(7, 32, 12); tod6.roll!"seconds"(-1); assert(tod6 == TimeOfDay(7, 32, 11)); auto tod7 = TimeOfDay(23, 59, 59); tod7.roll!"seconds"(1); assert(tod7 == TimeOfDay(23, 59, 0)); auto tod8 = TimeOfDay(0, 0, 0); tod8.roll!"seconds"(-1); assert(tod8 == TimeOfDay(0, 0, 59)); } } //Test roll!"seconds"(). unittest { version(testStdDateTime) { static void testTOD(TimeOfDay orig, int seconds, in TimeOfDay expected, size_t line = __LINE__) { orig.roll!"seconds"(seconds); _assertPred!"=="(orig, expected, "", __FILE__, line); } testTOD(TimeOfDay(12, 30, 33), 0, TimeOfDay(12, 30, 33)); testTOD(TimeOfDay(12, 30, 33), 1, TimeOfDay(12, 30, 34)); testTOD(TimeOfDay(12, 30, 33), 2, TimeOfDay(12, 30, 35)); testTOD(TimeOfDay(12, 30, 33), 3, TimeOfDay(12, 30, 36)); testTOD(TimeOfDay(12, 30, 33), 4, TimeOfDay(12, 30, 37)); testTOD(TimeOfDay(12, 30, 33), 5, TimeOfDay(12, 30, 38)); testTOD(TimeOfDay(12, 30, 33), 10, TimeOfDay(12, 30, 43)); testTOD(TimeOfDay(12, 30, 33), 15, TimeOfDay(12, 30, 48)); testTOD(TimeOfDay(12, 30, 33), 26, TimeOfDay(12, 30, 59)); testTOD(TimeOfDay(12, 30, 33), 27, TimeOfDay(12, 30, 0)); testTOD(TimeOfDay(12, 30, 33), 30, TimeOfDay(12, 30, 3)); testTOD(TimeOfDay(12, 30, 33), 59, TimeOfDay(12, 30, 32)); testTOD(TimeOfDay(12, 30, 33), 60, TimeOfDay(12, 30, 33)); testTOD(TimeOfDay(12, 30, 33), 61, TimeOfDay(12, 30, 34)); testTOD(TimeOfDay(12, 30, 33), 1766, TimeOfDay(12, 30, 59)); testTOD(TimeOfDay(12, 30, 33), 1767, TimeOfDay(12, 30, 0)); testTOD(TimeOfDay(12, 30, 33), 1768, TimeOfDay(12, 30, 1)); testTOD(TimeOfDay(12, 30, 33), 2007, TimeOfDay(12, 30, 0)); testTOD(TimeOfDay(12, 30, 33), 3599, TimeOfDay(12, 30, 32)); testTOD(TimeOfDay(12, 30, 33), 3600, TimeOfDay(12, 30, 33)); testTOD(TimeOfDay(12, 30, 33), 3601, TimeOfDay(12, 30, 34)); testTOD(TimeOfDay(12, 30, 33), 7200, TimeOfDay(12, 30, 33)); testTOD(TimeOfDay(12, 30, 33), -1, TimeOfDay(12, 30, 32)); testTOD(TimeOfDay(12, 30, 33), -2, TimeOfDay(12, 30, 31)); testTOD(TimeOfDay(12, 30, 33), -3, TimeOfDay(12, 30, 30)); testTOD(TimeOfDay(12, 30, 33), -4, TimeOfDay(12, 30, 29)); testTOD(TimeOfDay(12, 30, 33), -5, TimeOfDay(12, 30, 28)); testTOD(TimeOfDay(12, 30, 33), -10, TimeOfDay(12, 30, 23)); testTOD(TimeOfDay(12, 30, 33), -15, TimeOfDay(12, 30, 18)); testTOD(TimeOfDay(12, 30, 33), -33, TimeOfDay(12, 30, 0)); testTOD(TimeOfDay(12, 30, 33), -34, TimeOfDay(12, 30, 59)); testTOD(TimeOfDay(12, 30, 33), -35, TimeOfDay(12, 30, 58)); testTOD(TimeOfDay(12, 30, 33), -59, TimeOfDay(12, 30, 34)); testTOD(TimeOfDay(12, 30, 33), -60, TimeOfDay(12, 30, 33)); testTOD(TimeOfDay(12, 30, 33), -61, TimeOfDay(12, 30, 32)); testTOD(TimeOfDay(12, 30, 0), 1, TimeOfDay(12, 30, 1)); testTOD(TimeOfDay(12, 30, 0), 0, TimeOfDay(12, 30, 0)); testTOD(TimeOfDay(12, 30, 0), -1, TimeOfDay(12, 30, 59)); testTOD(TimeOfDay(12, 0, 0), 1, TimeOfDay(12, 0, 1)); testTOD(TimeOfDay(12, 0, 0), 0, TimeOfDay(12, 0, 0)); testTOD(TimeOfDay(12, 0, 0), -1, TimeOfDay(12, 0, 59)); testTOD(TimeOfDay(0, 0, 0), 1, TimeOfDay(0, 0, 1)); testTOD(TimeOfDay(0, 0, 0), 0, TimeOfDay(0, 0, 0)); testTOD(TimeOfDay(0, 0, 0), -1, TimeOfDay(0, 0, 59)); testTOD(TimeOfDay(23, 59, 59), 1, TimeOfDay(23, 59, 0)); testTOD(TimeOfDay(23, 59, 59), 0, TimeOfDay(23, 59, 59)); testTOD(TimeOfDay(23, 59, 59), -1, TimeOfDay(23, 59, 58)); const ctod = TimeOfDay(0, 0, 0); immutable itod = TimeOfDay(0, 0, 0); static assert(!__traits(compiles, ctod.roll!"seconds"(7))); static assert(!__traits(compiles, itod.roll!"seconds"(7))); } } /++ Gives the result of adding or subtracting a duration from this $(D TimeOfDay). The legal types of arithmetic for $(D TimeOfDay) using this operator are $(BOOKTABLE, $(TR $(TD TimeOfDay) $(TD +) $(TD duration) $(TD -->) $(TD TimeOfDay)) $(TR $(TD TimeOfDay) $(TD -) $(TD duration) $(TD -->) $(TD TimeOfDay)) ) Params: duration = The duration to add to or subtract from this $(D TimeOfDay). +/ TimeOfDay opBinary(string op, D)(in D duration) const pure nothrow if((op == "+" || op == "-") && (is(Unqual!D == Duration) || is(Unqual!D == TickDuration))) { TimeOfDay retval = this; static if(is(Unqual!D == Duration)) immutable hnsecs = duration.total!"hnsecs"; else static if(is(Unqual!D == TickDuration)) immutable hnsecs = duration.hnsecs; //Ideally, this would just be //return retval.addSeconds(convert!("hnsecs", "seconds")(unaryFun!(op ~ "a")(hnsecs))); //But there isn't currently a pure version of unaryFun!(). static if(op == "+") immutable signedHNSecs = hnsecs; else static if(op == "-") immutable signedHNSecs = -hnsecs; else static assert(0); return retval.addSeconds(convert!("hnsecs", "seconds")(signedHNSecs)); } unittest { version(testStdDateTime) { auto tod = TimeOfDay(12, 30, 33); _assertPred!"=="(tod + dur!"hours"(7), TimeOfDay(19, 30, 33)); _assertPred!"=="(tod + dur!"hours"(-7), TimeOfDay(5, 30, 33)); _assertPred!"=="(tod + dur!"minutes"(7), TimeOfDay(12, 37, 33)); _assertPred!"=="(tod + dur!"minutes"(-7), TimeOfDay(12, 23, 33)); _assertPred!"=="(tod + dur!"seconds"(7), TimeOfDay(12, 30, 40)); _assertPred!"=="(tod + dur!"seconds"(-7), TimeOfDay(12, 30, 26)); _assertPred!"=="(tod + dur!"msecs"(7000), TimeOfDay(12, 30, 40)); _assertPred!"=="(tod + dur!"msecs"(-7000), TimeOfDay(12, 30, 26)); _assertPred!"=="(tod + dur!"usecs"(7_000_000), TimeOfDay(12, 30, 40)); _assertPred!"=="(tod + dur!"usecs"(-7_000_000), TimeOfDay(12, 30, 26)); _assertPred!"=="(tod + dur!"hnsecs"(70_000_000), TimeOfDay(12, 30, 40)); _assertPred!"=="(tod + dur!"hnsecs"(-70_000_000), TimeOfDay(12, 30, 26)); //This probably only runs in cases where gettimeofday() is used, but it's //hard to do this test correctly with variable ticksPerSec. if(TickDuration.ticksPerSec == 1_000_000) { _assertPred!"=="(tod + TickDuration.from!"usecs"(7_000_000), TimeOfDay(12, 30, 40)); _assertPred!"=="(tod + TickDuration.from!"usecs"(-7_000_000), TimeOfDay(12, 30, 26)); } _assertPred!"=="(tod - dur!"hours"(-7), TimeOfDay(19, 30, 33)); _assertPred!"=="(tod - dur!"hours"(7), TimeOfDay(5, 30, 33)); _assertPred!"=="(tod - dur!"minutes"(-7), TimeOfDay(12, 37, 33)); _assertPred!"=="(tod - dur!"minutes"(7), TimeOfDay(12, 23, 33)); _assertPred!"=="(tod - dur!"seconds"(-7), TimeOfDay(12, 30, 40)); _assertPred!"=="(tod - dur!"seconds"(7), TimeOfDay(12, 30, 26)); _assertPred!"=="(tod - dur!"msecs"(-7000), TimeOfDay(12, 30, 40)); _assertPred!"=="(tod - dur!"msecs"(7000), TimeOfDay(12, 30, 26)); _assertPred!"=="(tod - dur!"usecs"(-7_000_000), TimeOfDay(12, 30, 40)); _assertPred!"=="(tod - dur!"usecs"(7_000_000), TimeOfDay(12, 30, 26)); _assertPred!"=="(tod - dur!"hnsecs"(-70_000_000), TimeOfDay(12, 30, 40)); _assertPred!"=="(tod - dur!"hnsecs"(70_000_000), TimeOfDay(12, 30, 26)); //This probably only runs in cases where gettimeofday() is used, but it's //hard to do this test correctly with variable ticksPerSec. if(TickDuration.ticksPerSec == 1_000_000) { _assertPred!"=="(tod - TickDuration.from!"usecs"(-7_000_000), TimeOfDay(12, 30, 40)); _assertPred!"=="(tod - TickDuration.from!"usecs"(7_000_000), TimeOfDay(12, 30, 26)); } auto duration = dur!"hours"(11); const ctod = TimeOfDay(12, 33, 30); immutable itod = TimeOfDay(12, 33, 30); static assert(__traits(compiles, tod + duration)); static assert(__traits(compiles, ctod + duration)); static assert(__traits(compiles, itod + duration)); static assert(__traits(compiles, tod - duration)); static assert(__traits(compiles, ctod - duration)); static assert(__traits(compiles, itod - duration)); } } /++ Gives the result of adding or subtracting a duration from this $(D TimeOfDay), as well as assigning the result to this $(D TimeOfDay). The legal types of arithmetic for $(D TimeOfDay) using this operator are $(BOOKTABLE, $(TR $(TD TimeOfDay) $(TD +) $(TD duration) $(TD -->) $(TD TimeOfDay)) $(TR $(TD TimeOfDay) $(TD -) $(TD duration) $(TD -->) $(TD TimeOfDay)) ) Params: duration = The duration to add to or subtract from this $(D TimeOfDay). +/ /+ref+/ TimeOfDay opOpAssign(string op, D)(in D duration) pure nothrow if((op == "+" || op == "-") && (is(Unqual!D == Duration) || is(Unqual!D == TickDuration))) { static if(is(Unqual!D == Duration)) immutable hnsecs = duration.total!"hnsecs"; else static if(is(Unqual!D == TickDuration)) immutable hnsecs = duration.hnsecs; //Ideally, this would just be //return addSeconds(convert!("hnsecs", "seconds")(unaryFun!(op ~ "a")(hnsecs))); //But there isn't currently a pure version of unaryFun!(). static if(op == "+") immutable signedHNSecs = hnsecs; else static if(op == "-") immutable signedHNSecs = -hnsecs; else static assert(0); return addSeconds(convert!("hnsecs", "seconds")(signedHNSecs)); } unittest { version(testStdDateTime) { auto duration = dur!"hours"(12); _assertPred!"+="(TimeOfDay(12, 30, 33), dur!"hours"(7), TimeOfDay(19, 30, 33)); _assertPred!"+="(TimeOfDay(12, 30, 33), dur!"hours"(-7), TimeOfDay(5, 30, 33)); _assertPred!"+="(TimeOfDay(12, 30, 33), dur!"minutes"(7), TimeOfDay(12, 37, 33)); _assertPred!"+="(TimeOfDay(12, 30, 33), dur!"minutes"(-7), TimeOfDay(12, 23, 33)); _assertPred!"+="(TimeOfDay(12, 30, 33), dur!"seconds"(7), TimeOfDay(12, 30, 40)); _assertPred!"+="(TimeOfDay(12, 30, 33), dur!"seconds"(-7), TimeOfDay(12, 30, 26)); _assertPred!"+="(TimeOfDay(12, 30, 33), dur!"msecs"(7000), TimeOfDay(12, 30, 40)); _assertPred!"+="(TimeOfDay(12, 30, 33), dur!"msecs"(-7000), TimeOfDay(12, 30, 26)); _assertPred!"+="(TimeOfDay(12, 30, 33), dur!"usecs"(7_000_000), TimeOfDay(12, 30, 40)); _assertPred!"+="(TimeOfDay(12, 30, 33), dur!"usecs"(-7_000_000), TimeOfDay(12, 30, 26)); _assertPred!"+="(TimeOfDay(12, 30, 33), dur!"hnsecs"(70_000_000), TimeOfDay(12, 30, 40)); _assertPred!"+="(TimeOfDay(12, 30, 33), dur!"hnsecs"(-70_000_000), TimeOfDay(12, 30, 26)); _assertPred!"-="(TimeOfDay(12, 30, 33), dur!"hours"(-7), TimeOfDay(19, 30, 33)); _assertPred!"-="(TimeOfDay(12, 30, 33), dur!"hours"(7), TimeOfDay(5, 30, 33)); _assertPred!"-="(TimeOfDay(12, 30, 33), dur!"minutes"(-7), TimeOfDay(12, 37, 33)); _assertPred!"-="(TimeOfDay(12, 30, 33), dur!"minutes"(7), TimeOfDay(12, 23, 33)); _assertPred!"-="(TimeOfDay(12, 30, 33), dur!"seconds"(-7), TimeOfDay(12, 30, 40)); _assertPred!"-="(TimeOfDay(12, 30, 33), dur!"seconds"(7), TimeOfDay(12, 30, 26)); _assertPred!"-="(TimeOfDay(12, 30, 33), dur!"msecs"(-7000), TimeOfDay(12, 30, 40)); _assertPred!"-="(TimeOfDay(12, 30, 33), dur!"msecs"(7000), TimeOfDay(12, 30, 26)); _assertPred!"-="(TimeOfDay(12, 30, 33), dur!"usecs"(-7_000_000), TimeOfDay(12, 30, 40)); _assertPred!"-="(TimeOfDay(12, 30, 33), dur!"usecs"(7_000_000), TimeOfDay(12, 30, 26)); _assertPred!"-="(TimeOfDay(12, 30, 33), dur!"hnsecs"(-70_000_000), TimeOfDay(12, 30, 40)); _assertPred!"-="(TimeOfDay(12, 30, 33), dur!"hnsecs"(70_000_000), TimeOfDay(12, 30, 26)); const ctod = TimeOfDay(12, 33, 30); immutable itod = TimeOfDay(12, 33, 30); static assert(!__traits(compiles, ctod += duration)); static assert(!__traits(compiles, itod += duration)); static assert(!__traits(compiles, ctod -= duration)); static assert(!__traits(compiles, itod -= duration)); } } /++ Gives the difference between two $(D TimeOfDay)s. The legal types of arithmetic for $(D TimeOfDay) using this operator are $(BOOKTABLE, $(TR $(TD TimeOfDay) $(TD -) $(TD TimeOfDay) $(TD -->) $(TD duration)) ) Params: rhs = The $(D TimeOfDay) to subtract from this one. +/ Duration opBinary(string op)(in TimeOfDay rhs) const pure nothrow if(op == "-") { immutable lhsSec = _hour * 3600 + _minute * 60 + _second; immutable rhsSec = rhs._hour * 3600 + rhs._minute * 60 + rhs._second; return dur!"seconds"(lhsSec - rhsSec); } unittest { version(testStdDateTime) { auto tod = TimeOfDay(12, 30, 33); _assertPred!"=="(TimeOfDay(7, 12, 52) - TimeOfDay(12, 30, 33), dur!"seconds"(-19_061)); _assertPred!"=="(TimeOfDay(12, 30, 33) - TimeOfDay(7, 12, 52), dur!"seconds"(19_061)); _assertPred!"=="(TimeOfDay(12, 30, 33) - TimeOfDay(14, 30, 33), dur!"seconds"(-7200)); _assertPred!"=="(TimeOfDay(14, 30, 33) - TimeOfDay(12, 30, 33), dur!"seconds"(7200)); _assertPred!"=="(TimeOfDay(12, 30, 33) - TimeOfDay(12, 34, 33), dur!"seconds"(-240)); _assertPred!"=="(TimeOfDay(12, 34, 33) - TimeOfDay(12, 30, 33), dur!"seconds"(240)); _assertPred!"=="(TimeOfDay(12, 30, 33) - TimeOfDay(12, 30, 34), dur!"seconds"(-1)); _assertPred!"=="(TimeOfDay(12, 30, 34) - TimeOfDay(12, 30, 33), dur!"seconds"(1)); const ctod = TimeOfDay(12, 30, 33); immutable itod = TimeOfDay(12, 30, 33); static assert(__traits(compiles, tod - tod)); static assert(__traits(compiles, ctod - tod)); static assert(__traits(compiles, itod - tod)); static assert(__traits(compiles, tod - ctod)); static assert(__traits(compiles, ctod - ctod)); static assert(__traits(compiles, itod - ctod)); static assert(__traits(compiles, tod - itod)); static assert(__traits(compiles, ctod - itod)); static assert(__traits(compiles, itod - itod)); } } /++ Converts this $(D TimeOfDay) to a string with the format HHMMSS. Examples: -------------------- assert(TimeOfDay(0, 0, 0).toISOString() == "000000"); assert(TimeOfDay(12, 30, 33).toISOString() == "123033"); -------------------- +/ string toISOString() const nothrow { try return format("%02d%02d%02d", _hour, _minute, _second); catch(Exception e) assert(0, "format() threw."); } unittest { version(testStdDateTime) { auto tod = TimeOfDay(12, 30, 33); const ctod = TimeOfDay(12, 30, 33); immutable itod = TimeOfDay(12, 30, 33); static assert(__traits(compiles, tod.toISOString())); static assert(__traits(compiles, ctod.toISOString())); static assert(__traits(compiles, itod.toISOString())); //Verify Examples. assert(TimeOfDay(0, 0, 0).toISOString() == "000000"); assert(TimeOfDay(12, 30, 33).toISOString() == "123033"); } } /++ Converts this $(D TimeOfDay) to a string with the format HH:MM:SS. Examples: -------------------- assert(TimeOfDay(0, 0, 0).toISOExtString() == "000000"); assert(TimeOfDay(12, 30, 33).toISOExtString() == "123033"); -------------------- +/ string toISOExtString() const nothrow { try return format("%02d:%02d:%02d", _hour, _minute, _second); catch(Exception e) assert(0, "format() threw."); } unittest { version(testStdDateTime) { auto tod = TimeOfDay(12, 30, 33); const ctod = TimeOfDay(12, 30, 33); immutable itod = TimeOfDay(12, 30, 33); static assert(__traits(compiles, tod.toISOExtString())); static assert(__traits(compiles, ctod.toISOExtString())); static assert(__traits(compiles, itod.toISOExtString())); //Verify Examples. assert(TimeOfDay(0, 0, 0).toISOExtString() == "00:00:00"); assert(TimeOfDay(12, 30, 33).toISOExtString() == "12:30:33"); } } /+ Converts this $(D TimeOfDay) to a string. +/ //Due to bug http://d.puremagic.com/issues/show_bug.cgi?id=3715 , we can't //have versions of toString() with extra modifiers, so we define one version //with modifiers and one without. string toString() { return toISOExtString(); } /++ Converts this TimeOfDay to a string. +/ //Due to bug http://d.puremagic.com/issues/show_bug.cgi?id=3715 , we can't //have versions of toString() with extra modifiers, so we define one version //with modifiers and one without. string toString() const nothrow { return toISOExtString(); } unittest { version(testStdDateTime) { auto tod = TimeOfDay(12, 30, 33); const ctod = TimeOfDay(12, 30, 33); immutable itod = TimeOfDay(12, 30, 33); static assert(__traits(compiles, tod.toString())); static assert(__traits(compiles, ctod.toString())); static assert(__traits(compiles, itod.toString())); } } //TODO Add a function which returns a string in a user-specified format. /++ Creates a $(D TimeOfDay) from a string with the format HHMMSS. Whitespace is stripped from the given string. Params: isoString = A string formatted in the ISO format for times. Throws: $(D DateTimeException) if the given string is not in the ISO format or if the resulting $(D TimeOfDay) would not be valid. Examples: -------------------- assert(TimeOfDay.fromISOString("000000") == TimeOfDay(0, 0, 0)); assert(TimeOfDay.fromISOString("123033") == TimeOfDay(12, 30, 33)); assert(TimeOfDay.fromISOString(" 123033 ") == TimeOfDay(12, 30, 33)); -------------------- +/ static TimeOfDay fromISOString(S)(in S isoString) if(isSomeString!S) { auto dstr = to!dstring(strip(isoString)); enforce(dstr.length == 6, new DateTimeException(format("Invalid ISO String: %s", isoString))); auto hours = dstr[0 .. 2]; auto minutes = dstr[2 .. 4]; auto seconds = dstr[4 .. $]; enforce(!canFind!(not!isDigit)(hours), new DateTimeException(format("Invalid ISO String: %s", isoString))); enforce(!canFind!(not!isDigit)(minutes), new DateTimeException(format("Invalid ISO String: %s", isoString))); enforce(!canFind!(not!isDigit)(seconds), new DateTimeException(format("Invalid ISO String: %s", isoString))); return TimeOfDay(to!int(hours), to!int(minutes), to!int(seconds)); } unittest { version(testStdDateTime) { assertThrown!DateTimeException(TimeOfDay.fromISOString("")); assertThrown!DateTimeException(TimeOfDay.fromISOString("0")); assertThrown!DateTimeException(TimeOfDay.fromISOString("00")); assertThrown!DateTimeException(TimeOfDay.fromISOString("000")); assertThrown!DateTimeException(TimeOfDay.fromISOString("0000")); assertThrown!DateTimeException(TimeOfDay.fromISOString("00000")); assertThrown!DateTimeException(TimeOfDay.fromISOString("13033")); assertThrown!DateTimeException(TimeOfDay.fromISOString("1277")); assertThrown!DateTimeException(TimeOfDay.fromISOString("12707")); assertThrown!DateTimeException(TimeOfDay.fromISOString("12070")); assertThrown!DateTimeException(TimeOfDay.fromISOString("12303a")); assertThrown!DateTimeException(TimeOfDay.fromISOString("1230a3")); assertThrown!DateTimeException(TimeOfDay.fromISOString("123a33")); assertThrown!DateTimeException(TimeOfDay.fromISOString("12a033")); assertThrown!DateTimeException(TimeOfDay.fromISOString("1a0033")); assertThrown!DateTimeException(TimeOfDay.fromISOString("a20033")); assertThrown!DateTimeException(TimeOfDay.fromISOString("1200330")); assertThrown!DateTimeException(TimeOfDay.fromISOString("0120033")); assertThrown!DateTimeException(TimeOfDay.fromISOString("-120033")); assertThrown!DateTimeException(TimeOfDay.fromISOString("+120033")); assertThrown!DateTimeException(TimeOfDay.fromISOString("120033am")); assertThrown!DateTimeException(TimeOfDay.fromISOString("120033pm")); assertThrown!DateTimeException(TimeOfDay.fromISOString("0::")); assertThrown!DateTimeException(TimeOfDay.fromISOString(":0:")); assertThrown!DateTimeException(TimeOfDay.fromISOString("::0")); assertThrown!DateTimeException(TimeOfDay.fromISOString("0:0:0")); assertThrown!DateTimeException(TimeOfDay.fromISOString("0:0:00")); assertThrown!DateTimeException(TimeOfDay.fromISOString("0:00:0")); assertThrown!DateTimeException(TimeOfDay.fromISOString("00:0:0")); assertThrown!DateTimeException(TimeOfDay.fromISOString("00:00:0")); assertThrown!DateTimeException(TimeOfDay.fromISOString("00:0:00")); assertThrown!DateTimeException(TimeOfDay.fromISOString("13:0:33")); assertThrown!DateTimeException(TimeOfDay.fromISOString("12:7:7")); assertThrown!DateTimeException(TimeOfDay.fromISOString("12:7:07")); assertThrown!DateTimeException(TimeOfDay.fromISOString("12:07:0")); assertThrown!DateTimeException(TimeOfDay.fromISOString("12:30:3a")); assertThrown!DateTimeException(TimeOfDay.fromISOString("12:30:a3")); assertThrown!DateTimeException(TimeOfDay.fromISOString("12:3a:33")); assertThrown!DateTimeException(TimeOfDay.fromISOString("12:a0:33")); assertThrown!DateTimeException(TimeOfDay.fromISOString("1a:00:33")); assertThrown!DateTimeException(TimeOfDay.fromISOString("a2:00:33")); assertThrown!DateTimeException(TimeOfDay.fromISOString("12:003:30")); assertThrown!DateTimeException(TimeOfDay.fromISOString("120:03:30")); assertThrown!DateTimeException(TimeOfDay.fromISOString("012:00:33")); assertThrown!DateTimeException(TimeOfDay.fromISOString("01:200:33")); assertThrown!DateTimeException(TimeOfDay.fromISOString("-12:00:33")); assertThrown!DateTimeException(TimeOfDay.fromISOString("+12:00:33")); assertThrown!DateTimeException(TimeOfDay.fromISOString("12:00:33am")); assertThrown!DateTimeException(TimeOfDay.fromISOString("12:00:33pm")); assertThrown!DateTimeException(TimeOfDay.fromISOString("12:00:33")); _assertPred!"=="(TimeOfDay.fromISOString("011217"), TimeOfDay(1, 12, 17)); _assertPred!"=="(TimeOfDay.fromISOString("001412"), TimeOfDay(0, 14, 12)); _assertPred!"=="(TimeOfDay.fromISOString("000007"), TimeOfDay(0, 0, 7)); _assertPred!"=="(TimeOfDay.fromISOString("011217 "), TimeOfDay(1, 12, 17)); _assertPred!"=="(TimeOfDay.fromISOString(" 011217"), TimeOfDay(1, 12, 17)); _assertPred!"=="(TimeOfDay.fromISOString(" 011217 "), TimeOfDay(1, 12, 17)); //Verify Examples. assert(TimeOfDay.fromISOString("000000") == TimeOfDay(0, 0, 0)); assert(TimeOfDay.fromISOString("123033") == TimeOfDay(12, 30, 33)); assert(TimeOfDay.fromISOString(" 123033 ") == TimeOfDay(12, 30, 33)); } } /++ Creates a $(D TimeOfDay) from a string with the format HH:MM:SS. Whitespace is stripped from the given string. Params: isoString = A string formatted in the ISO Extended format for times. Throws: $(D DateTimeException) if the given string is not in the ISO Extended format or if the resulting $(D TimeOfDay) would not be valid. Examples: -------------------- assert(TimeOfDay.fromISOExtString("00:00:00") == TimeOfDay(0, 0, 0)); assert(TimeOfDay.fromISOExtString("12:30:33") == TimeOfDay(12, 30, 33)); assert(TimeOfDay.fromISOExtString(" 12:30:33 ") == TimeOfDay(12, 30, 33)); -------------------- +/ static TimeOfDay fromISOExtString(S)(in S isoExtString) if(isSomeString!S) { auto dstr = to!dstring(strip(isoExtString)); enforce(dstr.length == 8, new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); auto hours = dstr[0 .. 2]; auto minutes = dstr[3 .. 5]; auto seconds = dstr[6 .. $]; enforce(dstr[2] == ':', new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); enforce(dstr[5] == ':', new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); enforce(!canFind!(not!isDigit)(hours), new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); enforce(!canFind!(not!isDigit)(minutes), new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); enforce(!canFind!(not!isDigit)(seconds), new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); return TimeOfDay(to!int(hours), to!int(minutes), to!int(seconds)); } unittest { version(testStdDateTime) { assertThrown!DateTimeException(TimeOfDay.fromISOExtString("")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("0")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("00")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("000")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("0000")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("00000")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("13033")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("1277")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("12707")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("12070")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("12303a")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("1230a3")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("123a33")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("12a033")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("1a0033")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("a20033")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("1200330")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("0120033")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("-120033")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("+120033")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("120033am")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("120033pm")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("0::")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString(":0:")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("::0")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("0:0:0")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("0:0:00")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("0:00:0")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("00:0:0")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("00:00:0")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("00:0:00")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("13:0:33")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("12:7:7")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("12:7:07")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("12:07:0")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("12:30:3a")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("12:30:a3")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("12:3a:33")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("12:a0:33")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("1a:00:33")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("a2:00:33")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("12:003:30")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("120:03:30")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("012:00:33")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("01:200:33")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("-12:00:33")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("+12:00:33")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("12:00:33am")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("12:00:33pm")); assertThrown!DateTimeException(TimeOfDay.fromISOExtString("120033")); _assertPred!"=="(TimeOfDay.fromISOExtString("01:12:17"), TimeOfDay(1, 12, 17)); _assertPred!"=="(TimeOfDay.fromISOExtString("00:14:12"), TimeOfDay(0, 14, 12)); _assertPred!"=="(TimeOfDay.fromISOExtString("00:00:07"), TimeOfDay(0, 0, 7)); _assertPred!"=="(TimeOfDay.fromISOExtString("01:12:17 "), TimeOfDay(1, 12, 17)); _assertPred!"=="(TimeOfDay.fromISOExtString(" 01:12:17"), TimeOfDay(1, 12, 17)); _assertPred!"=="(TimeOfDay.fromISOExtString(" 01:12:17 "), TimeOfDay(1, 12, 17)); //Verify Examples. assert(TimeOfDay.fromISOExtString("00:00:00") == TimeOfDay(0, 0, 0)); assert(TimeOfDay.fromISOExtString("12:30:33") == TimeOfDay(12, 30, 33)); assert(TimeOfDay.fromISOExtString(" 12:30:33 ") == TimeOfDay(12, 30, 33)); } } //TODO Add function which takes a user-specified time format and produces a TimeOfDay //TODO Add function which takes pretty much any time-string and produces a TimeOfDay // Obviously, it will be less efficient, and it probably won't manage _every_ // possible date format, but a smart conversion function would be nice. /++ Returns midnight. +/ @property static TimeOfDay min() pure nothrow { return TimeOfDay.init; } unittest { version(testStdDateTime) { assert(TimeOfDay.min.hour == 0); assert(TimeOfDay.min.minute == 0); assert(TimeOfDay.min.second == 0); assert(TimeOfDay.min < TimeOfDay.max); } } /++ Returns one second short of midnight. +/ @property static TimeOfDay max() pure nothrow { auto tod = TimeOfDay.init; tod._hour = maxHour; tod._minute = maxMinute; tod._second = maxSecond; return tod; } unittest { version(testStdDateTime) { assert(TimeOfDay.max.hour == 23); assert(TimeOfDay.max.minute == 59); assert(TimeOfDay.max.second == 59); assert(TimeOfDay.max > TimeOfDay.min); } } private: /+ Add seconds to the time of day. Negative values will subtract. If the number of seconds overflows (or underflows), then the seconds will wrap, increasing (or decreasing) the number of minutes accordingly. If the number of minutes overflows (or underflows), then the minutes will wrap. If the number of minutes overflows(or underflows), then the hour will wrap. (e.g. adding 90 seconds to 23:59:00 would result in 00:00:30). Params: seconds = The number of seconds to add to this TimeOfDay. +/ ref TimeOfDay addSeconds(long seconds) pure nothrow { long hnsecs = convert!("seconds", "hnsecs")(seconds); hnsecs += convert!("hours", "hnsecs")(_hour); hnsecs += convert!("minutes", "hnsecs")(_minute); hnsecs += convert!("seconds", "hnsecs")(_second); hnsecs %= convert!("days", "hnsecs")(1); if(hnsecs < 0) hnsecs += convert!("days", "hnsecs")(1); immutable newHours = splitUnitsFromHNSecs!"hours"(hnsecs); immutable newMinutes = splitUnitsFromHNSecs!"minutes"(hnsecs); immutable newSeconds = splitUnitsFromHNSecs!"seconds"(hnsecs); _hour = cast(ubyte)newHours; _minute = cast(ubyte)newMinutes; _second = cast(ubyte)newSeconds; return this; } unittest { version(testStdDateTime) { static void testTOD(TimeOfDay orig, int seconds, in TimeOfDay expected, size_t line = __LINE__) { orig.addSeconds(seconds); _assertPred!"=="(orig, expected, "", __FILE__, line); } testTOD(TimeOfDay(12, 30, 33), 0, TimeOfDay(12, 30, 33)); testTOD(TimeOfDay(12, 30, 33), 1, TimeOfDay(12, 30, 34)); testTOD(TimeOfDay(12, 30, 33), 2, TimeOfDay(12, 30, 35)); testTOD(TimeOfDay(12, 30, 33), 3, TimeOfDay(12, 30, 36)); testTOD(TimeOfDay(12, 30, 33), 4, TimeOfDay(12, 30, 37)); testTOD(TimeOfDay(12, 30, 33), 5, TimeOfDay(12, 30, 38)); testTOD(TimeOfDay(12, 30, 33), 10, TimeOfDay(12, 30, 43)); testTOD(TimeOfDay(12, 30, 33), 15, TimeOfDay(12, 30, 48)); testTOD(TimeOfDay(12, 30, 33), 26, TimeOfDay(12, 30, 59)); testTOD(TimeOfDay(12, 30, 33), 27, TimeOfDay(12, 31, 0)); testTOD(TimeOfDay(12, 30, 33), 30, TimeOfDay(12, 31, 3)); testTOD(TimeOfDay(12, 30, 33), 59, TimeOfDay(12, 31, 32)); testTOD(TimeOfDay(12, 30, 33), 60, TimeOfDay(12, 31, 33)); testTOD(TimeOfDay(12, 30, 33), 61, TimeOfDay(12, 31, 34)); testTOD(TimeOfDay(12, 30, 33), 1766, TimeOfDay(12, 59, 59)); testTOD(TimeOfDay(12, 30, 33), 1767, TimeOfDay(13, 0, 0)); testTOD(TimeOfDay(12, 30, 33), 1768, TimeOfDay(13, 0, 1)); testTOD(TimeOfDay(12, 30, 33), 2007, TimeOfDay(13, 4, 0)); testTOD(TimeOfDay(12, 30, 33), 3599, TimeOfDay(13, 30, 32)); testTOD(TimeOfDay(12, 30, 33), 3600, TimeOfDay(13, 30, 33)); testTOD(TimeOfDay(12, 30, 33), 3601, TimeOfDay(13, 30, 34)); testTOD(TimeOfDay(12, 30, 33), 7200, TimeOfDay(14, 30, 33)); testTOD(TimeOfDay(12, 30, 33), -1, TimeOfDay(12, 30, 32)); testTOD(TimeOfDay(12, 30, 33), -2, TimeOfDay(12, 30, 31)); testTOD(TimeOfDay(12, 30, 33), -3, TimeOfDay(12, 30, 30)); testTOD(TimeOfDay(12, 30, 33), -4, TimeOfDay(12, 30, 29)); testTOD(TimeOfDay(12, 30, 33), -5, TimeOfDay(12, 30, 28)); testTOD(TimeOfDay(12, 30, 33), -10, TimeOfDay(12, 30, 23)); testTOD(TimeOfDay(12, 30, 33), -15, TimeOfDay(12, 30, 18)); testTOD(TimeOfDay(12, 30, 33), -33, TimeOfDay(12, 30, 0)); testTOD(TimeOfDay(12, 30, 33), -34, TimeOfDay(12, 29, 59)); testTOD(TimeOfDay(12, 30, 33), -35, TimeOfDay(12, 29, 58)); testTOD(TimeOfDay(12, 30, 33), -59, TimeOfDay(12, 29, 34)); testTOD(TimeOfDay(12, 30, 33), -60, TimeOfDay(12, 29, 33)); testTOD(TimeOfDay(12, 30, 33), -61, TimeOfDay(12, 29, 32)); testTOD(TimeOfDay(12, 30, 33), -1833, TimeOfDay(12, 0, 0)); testTOD(TimeOfDay(12, 30, 33), -1834, TimeOfDay(11, 59, 59)); testTOD(TimeOfDay(12, 30, 33), -3600, TimeOfDay(11, 30, 33)); testTOD(TimeOfDay(12, 30, 33), -3601, TimeOfDay(11, 30, 32)); testTOD(TimeOfDay(12, 30, 33), -5134, TimeOfDay(11, 4, 59)); testTOD(TimeOfDay(12, 30, 33), -7200, TimeOfDay(10, 30, 33)); testTOD(TimeOfDay(12, 30, 0), 1, TimeOfDay(12, 30, 1)); testTOD(TimeOfDay(12, 30, 0), 0, TimeOfDay(12, 30, 0)); testTOD(TimeOfDay(12, 30, 0), -1, TimeOfDay(12, 29, 59)); testTOD(TimeOfDay(12, 0, 0), 1, TimeOfDay(12, 0, 1)); testTOD(TimeOfDay(12, 0, 0), 0, TimeOfDay(12, 0, 0)); testTOD(TimeOfDay(12, 0, 0), -1, TimeOfDay(11, 59, 59)); testTOD(TimeOfDay(0, 0, 0), 1, TimeOfDay(0, 0, 1)); testTOD(TimeOfDay(0, 0, 0), 0, TimeOfDay(0, 0, 0)); testTOD(TimeOfDay(0, 0, 0), -1, TimeOfDay(23, 59, 59)); testTOD(TimeOfDay(23, 59, 59), 1, TimeOfDay(0, 0, 0)); testTOD(TimeOfDay(23, 59, 59), 0, TimeOfDay(23, 59, 59)); testTOD(TimeOfDay(23, 59, 59), -1, TimeOfDay(23, 59, 58)); const ctod = TimeOfDay(0, 0, 0); immutable itod = TimeOfDay(0, 0, 0); static assert(!__traits(compiles, ctod.addSeconds(7))); static assert(!__traits(compiles, itod.addSeconds(7))); } } /+ Whether the given values form a valid $(D TimeOfDay). +/ static bool _valid(int hour, int minute, int second) pure nothrow { return valid!"hours"(hour) && valid!"minutes"(minute) && valid!"seconds"(second); } pure invariant() { assert(_valid(_hour, _minute, _second), "Invariant Failure: hour [" ~ numToString(_hour) ~ "] minute [" ~ numToString(_minute) ~ "] second [" ~ numToString(_second) ~ "]"); } ubyte _hour; ubyte _minute; ubyte _second; enum ubyte maxHour = 24 - 1; enum ubyte maxMinute = 60 - 1; enum ubyte maxSecond = 60 - 1; } /++ Combines the $(D Date) and $(D TimeOfDay) structs to give an object which holds both the date and the time. It is optimized for calendar-based operations and has no concept of time zone. For an object which is optimized for time operations based on the system time, use $(D SysTime). $(D SysTime) has a concept of time zone and has much higher precision (hnsecs). $(D DateTime) is intended primarily for calendar-based uses rather than precise time operations. +/ struct DateTime { public: /++ Params: date = The date portion of $(D DateTime). tod = The time portion of $(D DateTime). +/ this(in Date date, in TimeOfDay tod = TimeOfDay.init) pure nothrow { _date = date; _tod = tod; } unittest { version(testStdDateTime) { { auto dt = DateTime.init; _assertPred!"=="(dt._date, Date.init); _assertPred!"=="(dt._tod, TimeOfDay.init); } { auto dt = DateTime(Date(1999, 7 ,6)); _assertPred!"=="(dt._date, Date(1999, 7, 6)); _assertPred!"=="(dt._tod, TimeOfDay.init); } { auto dt = DateTime(Date(1999, 7 ,6), TimeOfDay(12, 30, 33)); _assertPred!"=="(dt._date, Date(1999, 7, 6)); _assertPred!"=="(dt._tod, TimeOfDay(12, 30, 33)); } } } /++ Params: year = The year portion of the date. month = The month portion of the date. day = The day portion of the date. hour = The hour portion of the time; minute = The minute portion of the time; second = The second portion of the time; +/ this(int year, int month, int day, int hour = 0, int minute = 0, int second = 0) pure { _date = Date(year, month, day); _tod = TimeOfDay(hour, minute, second); } unittest { version(testStdDateTime) { { auto dt = DateTime(1999, 7 ,6); _assertPred!"=="(dt._date, Date(1999, 7, 6)); _assertPred!"=="(dt._tod, TimeOfDay.init); } { auto dt = DateTime(1999, 7 ,6, 12, 30, 33); _assertPred!"=="(dt._date, Date(1999, 7, 6)); _assertPred!"=="(dt._tod, TimeOfDay(12, 30, 33)); } } } /++ Compares this $(D DateTime) with the given $(D DateTime.). Returns: $(BOOKTABLE, $(TR $(TD this &lt; rhs) $(TD &lt; 0)) $(TR $(TD this == rhs) $(TD 0)) $(TR $(TD this &gt; rhs) $(TD &gt; 0)) ) +/ int opCmp(in DateTime rhs) const pure nothrow { immutable dateResult = _date.opCmp(rhs._date); if(dateResult != 0) return dateResult; return _tod.opCmp(rhs._tod); } unittest { version(testStdDateTime) { //Test A.D. _assertPred!("opCmp", "==")(DateTime(Date.init, TimeOfDay.init), DateTime.init); _assertPred!("opCmp", "==")(DateTime(Date(1999, 1, 1)), DateTime(Date(1999, 1, 1))); _assertPred!("opCmp", "==")(DateTime(Date(1, 7, 1)), DateTime(Date(1, 7, 1))); _assertPred!("opCmp", "==")(DateTime(Date(1, 1, 6)), DateTime(Date(1, 1, 6))); _assertPred!("opCmp", "==")(DateTime(Date(1999, 7, 1)), DateTime(Date(1999, 7, 1))); _assertPred!("opCmp", "==")(DateTime(Date(1999, 7, 6)), DateTime(Date(1999, 7, 6))); _assertPred!("opCmp", "==")(DateTime(Date(1, 7, 6)), DateTime(Date(1, 7, 6))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6)), DateTime(Date(2000, 7, 6))); _assertPred!("opCmp", ">")(DateTime(Date(2000, 7, 6)), DateTime(Date(1999, 7, 6))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6)), DateTime(Date(1999, 8, 6))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 8, 6)), DateTime(Date(1999, 7, 6))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6)), DateTime(Date(1999, 7, 7))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 7, 7)), DateTime(Date(1999, 7, 6))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 8, 7)), DateTime(Date(2000, 7, 6))); _assertPred!("opCmp", ">")(DateTime(Date(2000, 8, 6)), DateTime(Date(1999, 7, 7))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 7)), DateTime(Date(2000, 7, 6))); _assertPred!("opCmp", ">")(DateTime(Date(2000, 7, 6)), DateTime(Date(1999, 7, 7))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 7)), DateTime(Date(1999, 8, 6))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 8, 6)), DateTime(Date(1999, 7, 7))); _assertPred!("opCmp", "==")(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 0)), DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 0))); _assertPred!("opCmp", "==")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 0)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 0))); _assertPred!("opCmp", "==")(DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 0)), DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 0))); _assertPred!("opCmp", "==")(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 33))); _assertPred!("opCmp", "==")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0))); _assertPred!("opCmp", "==")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "==")(DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33))); _assertPred!("opCmp", "==")(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 33))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)), DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33)), DateTime(Date(2000, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(2000, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)), DateTime(Date(2000, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(2000, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)), DateTime(Date(2000, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(2000, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33)), DateTime(Date(1999, 8, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 8, 6), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)), DateTime(Date(1999, 8, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 8, 6), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)), DateTime(Date(1999, 8, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 8, 6), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33)), DateTime(Date(1999, 7, 7), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 7, 7), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)), DateTime(Date(1999, 7, 7), TimeOfDay(12, 31, 33))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 7, 7), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "<")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)), DateTime(Date(1999, 7, 7), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 7, 7), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34))); //Test B.C. _assertPred!("opCmp", "==")(DateTime(Date(-1, 1, 1), TimeOfDay(12, 30, 33)), DateTime(Date(-1, 1, 1), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "==")(DateTime(Date(-1, 7, 1), TimeOfDay(12, 30, 33)), DateTime(Date(-1, 7, 1), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "==")(DateTime(Date(-1, 1, 6), TimeOfDay(12, 30, 33)), DateTime(Date(-1, 1, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "==")(DateTime(Date(-1999, 7, 1), TimeOfDay(12, 30, 33)), DateTime(Date(-1999, 7, 1), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "==")(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "==")(DateTime(Date(-1, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(-1, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "<")(DateTime(Date(-2000, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(-2000, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "<")(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(-1999, 8, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(-1999, 8, 6), TimeOfDay(12, 30, 33)), DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "<")(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33)), DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "<")(DateTime(Date(-2000, 8, 6), TimeOfDay(12, 30, 33)), DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(-1999, 8, 7), TimeOfDay(12, 30, 33)), DateTime(Date(-2000, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "<")(DateTime(Date(-2000, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33)), DateTime(Date(-2000, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "<")(DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33)), DateTime(Date(-1999, 8, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(-1999, 8, 6), TimeOfDay(12, 30, 33)), DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33))); //Test Both _assertPred!("opCmp", "<")(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "<")(DateTime(Date(-1999, 8, 6), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(-1999, 8, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "<")(DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(-1999, 7, 7), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "<")(DateTime(Date(-1999, 8, 7), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), DateTime(Date(-1999, 8, 7), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", "<")(DateTime(Date(-1999, 8, 6), TimeOfDay(12, 30, 33)), DateTime(Date(1999, 6, 6), TimeOfDay(12, 30, 33))); _assertPred!("opCmp", ">")(DateTime(Date(1999, 6, 8), TimeOfDay(12, 30, 33)), DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 33, 30)); const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 33, 30)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 33, 30)); static assert(__traits(compiles, dt.opCmp(dt))); static assert(__traits(compiles, dt.opCmp(cdt))); static assert(__traits(compiles, dt.opCmp(idt))); static assert(__traits(compiles, cdt.opCmp(dt))); static assert(__traits(compiles, cdt.opCmp(cdt))); static assert(__traits(compiles, cdt.opCmp(idt))); static assert(__traits(compiles, idt.opCmp(dt))); static assert(__traits(compiles, idt.opCmp(cdt))); static assert(__traits(compiles, idt.opCmp(idt))); } } /++ The date portion of $(D DateTime). +/ @property Date date() const pure nothrow { return _date; } unittest { version(testStdDateTime) { { auto dt = DateTime.init; _assertPred!"=="(dt.date, Date.init); } { auto dt = DateTime(Date(1999, 7, 6)); _assertPred!"=="(dt.date, Date(1999, 7, 6)); } const cdt = DateTime(1999, 7, 6); immutable idt = DateTime(1999, 7, 6); static assert(__traits(compiles, cdt.date == Date(2010, 1, 1))); static assert(__traits(compiles, idt.date == Date(2010, 1, 1))); } } /++ The date portion of $(D DateTime). Params: date = The Date to set this $(D DateTime)'s date portion to. +/ @property void date(in Date date) pure nothrow { _date = date; } unittest { version(testStdDateTime) { auto dt = DateTime.init; dt.date = Date(1999, 7, 6); _assertPred!"=="(dt._date, Date(1999, 7, 6)); _assertPred!"=="(dt._tod, TimeOfDay.init); const cdt = DateTime(1999, 7, 6); immutable idt = DateTime(1999, 7, 6); static assert(!__traits(compiles, cdt.date = Date(2010, 1, 1))); static assert(!__traits(compiles, idt.date = Date(2010, 1, 1))); } } /++ The time portion of $(D DateTime). +/ @property TimeOfDay timeOfDay() const pure nothrow { return _tod; } unittest { version(testStdDateTime) { { auto dt = DateTime.init; _assertPred!"=="(dt.timeOfDay, TimeOfDay.init); } { auto dt = DateTime(Date.init, TimeOfDay(12, 30, 33)); _assertPred!"=="(dt.timeOfDay, TimeOfDay(12, 30, 33)); } const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(__traits(compiles, cdt.timeOfDay == TimeOfDay(12, 30, 33))); static assert(__traits(compiles, idt.timeOfDay == TimeOfDay(12, 30, 33))); } } /++ The time portion of $(D DateTime). Params: tod = The $(D TimeOfDay) to set this $(D DateTime)'s time portion to. +/ @property void timeOfDay(in TimeOfDay tod) pure nothrow { _tod = tod; } unittest { version(testStdDateTime) { auto dt = DateTime.init; dt.timeOfDay = TimeOfDay(12, 30, 33); _assertPred!"=="(dt._date, date.init); _assertPred!"=="(dt._tod, TimeOfDay(12, 30, 33)); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(!__traits(compiles, cdt.timeOfDay = TimeOfDay(12, 30, 33))); static assert(!__traits(compiles, idt.timeOfDay = TimeOfDay(12, 30, 33))); } } /++ Year of the Gregorian Calendar. Positive numbers are A.D. Non-positive are B.C. +/ @property short year() const pure nothrow { return _date.year; } unittest { version(testStdDateTime) { _assertPred!"=="(Date.init.year, 1); _assertPred!"=="(Date(1999, 7, 6).year, 1999); _assertPred!"=="(Date(-1999, 7, 6).year, -1999); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(__traits(compiles, idt.year)); static assert(__traits(compiles, idt.year)); } } /++ Year of the Gregorian Calendar. Positive numbers are A.D. Non-positive are B.C. Params: year = The year to set this $(D DateTime)'s year to. Throws: $(D DateTimeException) if the new year is not a leap year and if the resulting date would be on February 29th. Examples: -------------------- assert(DateTime(Date(1999, 7, 6), TimeOfDay(9, 7, 5)).year == 1999); assert(DateTime(Date(2010, 10, 4), TimeOfDay(0, 0, 30)).year == 2010); assert(DateTime(Date(-7, 4, 5), TimeOfDay(7, 45, 2)).year == -7); -------------------- +/ @property void year(int year) pure { _date.year = year; } unittest { version(testStdDateTime) { static void testDT(DateTime dt, int year, in DateTime expected, size_t line = __LINE__) { dt.year = year; _assertPred!"=="(dt, expected, "", __FILE__, line); } testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)), 1999, DateTime(Date(1999, 1, 1), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)), 0, DateTime(Date(0, 1, 1), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)), -1999, DateTime(Date(-1999, 1, 1), TimeOfDay(12, 30, 33))); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(!__traits(compiles, cdt.year = 7)); static assert(!__traits(compiles, idt.year = 7)); //Verify Examples. assert(DateTime(Date(1999, 7, 6), TimeOfDay(9, 7, 5)).year == 1999); assert(DateTime(Date(2010, 10, 4), TimeOfDay(0, 0, 30)).year == 2010); assert(DateTime(Date(-7, 4, 5), TimeOfDay(7, 45, 2)).year == -7); } } /++ Year B.C. of the Gregorian Calendar counting year 0 as 1 B.C. Throws: $(D DateTimeException) if $(D isAD) is true. Examples: -------------------- assert(DateTime(Date(0, 1, 1), TimeOfDay(12, 30, 33)).yearBC == 1); assert(DateTime(Date(-1, 1, 1), TimeOfDay(10, 7, 2)).yearBC == 2); assert(DateTime(Date(-100, 1, 1), TimeOfDay(4, 59, 0)).yearBC == 101); -------------------- +/ @property short yearBC() const pure { return _date.yearBC; } unittest { version(testStdDateTime) { assertThrown!DateTimeException((in DateTime dt){dt.yearBC;}(DateTime(Date(1, 1, 1)))); auto dt = DateTime(1999, 7, 6, 12, 30, 33); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(__traits(compiles, dt.yearBC = 12)); static assert(!__traits(compiles, cdt.yearBC = 12)); static assert(!__traits(compiles, idt.yearBC = 12)); //Verify Examples. assert(DateTime(Date(0, 1, 1), TimeOfDay(12, 30, 33)).yearBC == 1); assert(DateTime(Date(-1, 1, 1), TimeOfDay(10, 7, 2)).yearBC == 2); assert(DateTime(Date(-100, 1, 1), TimeOfDay(4, 59, 0)).yearBC == 101); } } /++ Year B.C. of the Gregorian Calendar counting year 0 as 1 B.C. Params: year = The year B.C. to set this $(D DateTime)'s year to. Throws: $(D DateTimeException) if a non-positive value is given. Examples: -------------------- auto dt = DateTime(Date(2010, 1, 1), TimeOfDay(7, 30, 0)); dt.yearBC = 1; assert(dt == DateTime(Date(0, 1, 1), TimeOfDay(7, 30, 0))); dt.yearBC = 10; assert(dt == DateTime(Date(-9, 1, 1), TimeOfDay(7, 30, 0))); -------------------- +/ @property void yearBC(int year) pure { _date.yearBC = year; } unittest { version(testStdDateTime) { assertThrown!DateTimeException((DateTime dt){dt.yearBC = -1;}(DateTime(Date(1, 1, 1)))); { auto dt = DateTime(1999, 7, 6, 12, 30, 33); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(__traits(compiles, dt.yearBC = 12)); static assert(!__traits(compiles, cdt.yearBC = 12)); static assert(!__traits(compiles, idt.yearBC = 12)); } //Verify Examples. { auto dt = DateTime(Date(2010, 1, 1), TimeOfDay(7, 30, 0)); dt.yearBC = 1; assert(dt == DateTime(Date(0, 1, 1), TimeOfDay(7, 30, 0))); dt.yearBC = 10; assert(dt == DateTime(Date(-9, 1, 1), TimeOfDay(7, 30, 0))); } } } /++ Month of a Gregorian Year. Examples: -------------------- assert(DateTime(Date(1999, 7, 6), TimeOfDay(9, 7, 5)).month == 7); assert(DateTime(Date(2010, 10, 4), TimeOfDay(0, 0, 30)).month == 10); assert(DateTime(Date(-7, 4, 5), TimeOfDay(7, 45, 2)).month == 4); -------------------- +/ @property Month month() const pure nothrow { return _date.month; } unittest { version(testStdDateTime) { _assertPred!"=="(DateTime.init.month, 1); _assertPred!"=="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)).month, 7); _assertPred!"=="(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)).month, 7); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(__traits(compiles, cdt.month)); static assert(__traits(compiles, idt.month)); //Verify Examples. assert(DateTime(Date(1999, 7, 6), TimeOfDay(9, 7, 5)).month == 7); assert(DateTime(Date(2010, 10, 4), TimeOfDay(0, 0, 30)).month == 10); assert(DateTime(Date(-7, 4, 5), TimeOfDay(7, 45, 2)).month == 4); } } /++ Month of a Gregorian Year. Params: month = The month to set this $(D DateTime)'s month to. Throws: $(D DateTimeException) if the given month is not a valid month. +/ @property void month(Month month) pure { _date.month = month; } unittest { version(testStdDateTime) { static void testDT(DateTime dt, Month month, in DateTime expected = DateTime.init, size_t line = __LINE__) { dt.month = month; assert(expected != DateTime.init); _assertPred!"=="(dt, expected, "", __FILE__, line); } assertThrown!DateTimeException(testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)), cast(Month)0)); assertThrown!DateTimeException(testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)), cast(Month)13)); testDT(DateTime(Date(1, 1, 1), TimeOfDay(12, 30, 33)), cast(Month)7, DateTime(Date(1, 7, 1), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1, 1, 1), TimeOfDay(12, 30, 33)), cast(Month)7, DateTime(Date(-1, 7, 1), TimeOfDay(12, 30, 33))); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(!__traits(compiles, cdt.month = 12)); static assert(!__traits(compiles, idt.month = 12)); } } /++ Day of a Gregorian Month. Examples: -------------------- assert(DateTime(Date(1999, 7, 6), TimeOfDay(9, 7, 5)).day == 6); assert(DateTime(Date(2010, 10, 4), TimeOfDay(0, 0, 30)).day == 4); assert(DateTime(Date(-7, 4, 5), TimeOfDay(7, 45, 2)).day == 5); -------------------- +/ @property ubyte day() const pure nothrow { return _date.day; } //Verify Examples. version(testStdDateTime) unittest { assert(DateTime(Date(1999, 7, 6), TimeOfDay(9, 7, 5)).day == 6); assert(DateTime(Date(2010, 10, 4), TimeOfDay(0, 0, 30)).day == 4); assert(DateTime(Date(-7, 4, 5), TimeOfDay(7, 45, 2)).day == 5); } version(testStdDateTime) unittest { static void test(DateTime dateTime, int expected, size_t line = __LINE__) { _assertPred!"=="(dateTime.day, expected, format("Value given: %s", dateTime), __FILE__, line); } foreach(year; chain(testYearsBC, testYearsAD)) { foreach(md; testMonthDays) { foreach(tod; testTODs) test(DateTime(Date(year, md.month, md.day), tod), md.day); } } const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(__traits(compiles, cdt.day)); static assert(__traits(compiles, idt.day)); } /++ Day of a Gregorian Month. Params: day = The day of the month to set this $(D DateTime)'s day to. Throws: $(D DateTimeException) if the given day is not a valid day of the current month. +/ @property void day(int day) pure { _date.day = day; } unittest { version(testStdDateTime) { static void testDT(DateTime dt, int day) { dt.day = day; } //Test A.D. assertThrown!DateTimeException(testDT(DateTime(Date(1, 1, 1)), 0)); assertThrown!DateTimeException(testDT(DateTime(Date(1, 1, 1)), 32)); assertThrown!DateTimeException(testDT(DateTime(Date(1, 2, 1)), 29)); assertThrown!DateTimeException(testDT(DateTime(Date(4, 2, 1)), 30)); assertThrown!DateTimeException(testDT(DateTime(Date(1, 3, 1)), 32)); assertThrown!DateTimeException(testDT(DateTime(Date(1, 4, 1)), 31)); assertThrown!DateTimeException(testDT(DateTime(Date(1, 5, 1)), 32)); assertThrown!DateTimeException(testDT(DateTime(Date(1, 6, 1)), 31)); assertThrown!DateTimeException(testDT(DateTime(Date(1, 7, 1)), 32)); assertThrown!DateTimeException(testDT(DateTime(Date(1, 8, 1)), 32)); assertThrown!DateTimeException(testDT(DateTime(Date(1, 9, 1)), 31)); assertThrown!DateTimeException(testDT(DateTime(Date(1, 10, 1)), 32)); assertThrown!DateTimeException(testDT(DateTime(Date(1, 11, 1)), 31)); assertThrown!DateTimeException(testDT(DateTime(Date(1, 12, 1)), 32)); assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 1, 1)), 31)); assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 2, 1)), 28)); assertNotThrown!DateTimeException(testDT(DateTime(Date(4, 2, 1)), 29)); assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 3, 1)), 31)); assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 4, 1)), 30)); assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 5, 1)), 31)); assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 6, 1)), 30)); assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 7, 1)), 31)); assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 8, 1)), 31)); assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 9, 1)), 30)); assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 10, 1)), 31)); assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 11, 1)), 30)); assertNotThrown!DateTimeException(testDT(DateTime(Date(1, 12, 1)), 31)); { auto dt = DateTime(Date(1, 1, 1), TimeOfDay(7, 12, 22)); dt.day = 6; _assertPred!"=="(dt, DateTime(Date(1, 1, 6), TimeOfDay(7, 12, 22))); } //Test B.C. assertThrown!DateTimeException(testDT(DateTime(Date(-1, 1, 1)), 0)); assertThrown!DateTimeException(testDT(DateTime(Date(-1, 1, 1)), 32)); assertThrown!DateTimeException(testDT(DateTime(Date(-1, 2, 1)), 29)); assertThrown!DateTimeException(testDT(DateTime(Date(0, 2, 1)), 30)); assertThrown!DateTimeException(testDT(DateTime(Date(-1, 3, 1)), 32)); assertThrown!DateTimeException(testDT(DateTime(Date(-1, 4, 1)), 31)); assertThrown!DateTimeException(testDT(DateTime(Date(-1, 5, 1)), 32)); assertThrown!DateTimeException(testDT(DateTime(Date(-1, 6, 1)), 31)); assertThrown!DateTimeException(testDT(DateTime(Date(-1, 7, 1)), 32)); assertThrown!DateTimeException(testDT(DateTime(Date(-1, 8, 1)), 32)); assertThrown!DateTimeException(testDT(DateTime(Date(-1, 9, 1)), 31)); assertThrown!DateTimeException(testDT(DateTime(Date(-1, 10, 1)), 32)); assertThrown!DateTimeException(testDT(DateTime(Date(-1, 11, 1)), 31)); assertThrown!DateTimeException(testDT(DateTime(Date(-1, 12, 1)), 32)); assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 1, 1)), 31)); assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 2, 1)), 28)); assertNotThrown!DateTimeException(testDT(DateTime(Date(0, 2, 1)), 29)); assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 3, 1)), 31)); assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 4, 1)), 30)); assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 5, 1)), 31)); assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 6, 1)), 30)); assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 7, 1)), 31)); assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 8, 1)), 31)); assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 9, 1)), 30)); assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 10, 1)), 31)); assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 11, 1)), 30)); assertNotThrown!DateTimeException(testDT(DateTime(Date(-1, 12, 1)), 31)); auto dt = DateTime(Date(-1, 1, 1), TimeOfDay(7, 12, 22)); dt.day = 6; _assertPred!"=="(dt, DateTime(Date(-1, 1, 6), TimeOfDay(7, 12, 22))); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(!__traits(compiles, cdt.day = 27)); static assert(!__traits(compiles, idt.day = 27)); } } /++ Hours passed midnight. +/ @property ubyte hour() const pure nothrow { return _tod.hour; } unittest { version(testStdDateTime) { _assertPred!"=="(DateTime.init.hour, 0); _assertPred!"=="(DateTime(Date.init, TimeOfDay(12, 0, 0)).hour, 12); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(__traits(compiles, cdt.hour)); static assert(__traits(compiles, idt.hour)); } } /++ Hours passed midnight. Params: hour = The hour of the day to set this $(D DateTime)'s hour to. Throws: $(D DateTimeException) if the given hour would result in an invalid $(D DateTime). +/ @property void hour(int hour) pure { _tod.hour = hour; } unittest { version(testStdDateTime) { assertThrown!DateTimeException((){DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 0)).hour = 24;}()); auto dt = DateTime.init; dt.hour = 12; _assertPred!"=="(dt, DateTime(1, 1, 1, 12, 0, 0)); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(!__traits(compiles, cdt.hour = 27)); static assert(!__traits(compiles, idt.hour = 27)); } } /++ Minutes passed the hour. +/ @property ubyte minute() const pure nothrow { return _tod.minute; } unittest { version(testStdDateTime) { _assertPred!"=="(DateTime.init.minute, 0); _assertPred!"=="(DateTime(1, 1, 1, 0, 30, 0).minute, 30); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(__traits(compiles, cdt.minute)); static assert(__traits(compiles, idt.minute)); } } /++ Minutes passed the hour. Params: minute = The minute to set this $(D DateTime)'s minute to. Throws: $(D DateTimeException) if the given minute would result in an invalid $(D DateTime). +/ @property void minute(int minute) pure { _tod.minute = minute; } unittest { version(testStdDateTime) { assertThrown!DateTimeException((){DateTime.init.minute = 60;}()); auto dt = DateTime.init; dt.minute = 30; _assertPred!"=="(dt, DateTime(1, 1, 1, 0, 30, 0)); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(!__traits(compiles, cdt.minute = 27)); static assert(!__traits(compiles, idt.minute = 27)); } } /++ Seconds passed the minute. +/ @property ubyte second() const pure nothrow { return _tod.second; } unittest { version(testStdDateTime) { _assertPred!"=="(DateTime.init.second, 0); _assertPred!"=="(DateTime(1, 1, 1, 0, 0, 33).second, 33); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(__traits(compiles, cdt.second)); static assert(__traits(compiles, idt.second)); } } /++ Seconds passed the minute. Params: second = The second to set this $(D DateTime)'s second to. Throws: $(D DateTimeException) if the given seconds would result in an invalid $(D DateTime). +/ @property void second(int second) pure { _tod.second = second; } unittest { version(testStdDateTime) { assertThrown!DateTimeException((){DateTime.init.second = 60;}()); auto dt = DateTime.init; dt.second = 33; _assertPred!"=="(dt, DateTime(1, 1, 1, 0, 0, 33)); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(!__traits(compiles, cdt.second = 27)); static assert(!__traits(compiles, idt.second = 27)); } } /++ Adds the given number of years or months to this $(D DateTime). A negative number will subtract. Note that if day overflow is allowed, and the date with the adjusted year/month overflows the number of days in the new month, then the month will be incremented by one, and the day set to the number of days overflowed. (e.g. if the day were 31 and the new month were June, then the month would be incremented to July, and the new day would be 1). If day overflow is not allowed, then the day will be set to the last valid day in the month (e.g. June 31st would become June 30th). Params: units = The type of units to add ("years" or "months"). value = The number of months or years to add to this $(D DateTime). allowOverflow = Whether the days should be allowed to overflow, causing the month to increment. Examples: -------------------- auto dt1 = DateTime(2010, 1, 1, 12, 30, 33); dt1.add!"months"(11); assert(dt1 == DateTime(2010, 12, 1, 12, 30, 33)); auto dt2 = DateTime(2010, 1, 1, 12, 30, 33); dt2.add!"months"(-11); assert(dt2 == DateTime(2009, 2, 1, 12, 30, 33)); auto dt3 = DateTime(2000, 2, 29, 12, 30, 33); dt3.add!"years"(1); assert(dt3 == DateTime(2001, 3, 1, 12, 30, 33)); auto dt4 = DateTime(2000, 2, 29, 12, 30, 33); dt4.add!"years"(1, AllowDayOverflow.no); assert(dt4 == DateTime(2001, 2, 28, 12, 30, 33)); -------------------- +/ /+ref DateTime+/ void add(string units)(long value, AllowDayOverflow allowOverflow = AllowDayOverflow.yes) pure nothrow if(units == "years" || units == "months") { _date.add!units(value, allowOverflow); } //Verify Examples. unittest { version(testStdDateTime) { auto dt1 = DateTime(2010, 1, 1, 12, 30, 33); dt1.add!"months"(11); assert(dt1 == DateTime(2010, 12, 1, 12, 30, 33)); auto dt2 = DateTime(2010, 1, 1, 12, 30, 33); dt2.add!"months"(-11); assert(dt2 == DateTime(2009, 2, 1, 12, 30, 33)); auto dt3 = DateTime(2000, 2, 29, 12, 30, 33); dt3.add!"years"(1); assert(dt3 == DateTime(2001, 3, 1, 12, 30, 33)); auto dt4 = DateTime(2000, 2, 29, 12, 30, 33); dt4.add!"years"(1, AllowDayOverflow.no); assert(dt4 == DateTime(2001, 2, 28, 12, 30, 33)); } } unittest { version(testStdDateTime) { const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(!__traits(compiles, cdt.add!"years"(4))); static assert(!__traits(compiles, idt.add!"years"(4))); static assert(!__traits(compiles, cdt.add!"months"(4))); static assert(!__traits(compiles, idt.add!"months"(4))); } } /++ Adds the given number of years or months to this $(D DateTime). A negative number will subtract. The difference between rolling and adding is that rolling does not affect larger units. Rolling a $(D DateTime) 12 months gets the exact same $(D DateTime). However, the days can still be affected due to the differing number of days in each month. Because there are no units larger than years, there is no difference between adding and rolling years. Params: units = The type of units to add ("years" or "months"). value = The number of months or years to add to this $(D DateTime). allowOverflow = Whether the days should be allowed to overflow, causing the month to increment. Examples: -------------------- auto dt1 = DateTime(2010, 1, 1, 12, 33, 33); dt1.roll!"months"(1); assert(dt1 == DateTime(2010, 2, 1, 12, 33, 33)); auto dt2 = DateTime(2010, 1, 1, 12, 33, 33); dt2.roll!"months"(-1); assert(dt2 == DateTime(2010, 12, 1, 12, 33, 33)); auto dt3 = DateTime(1999, 1, 29, 12, 33, 33); dt3.roll!"months"(1); assert(dt3 == DateTime(1999, 3, 1, 12, 33, 33)); auto dt4 = DateTime(1999, 1, 29, 12, 33, 33); dt4.roll!"months"(1, AllowDayOverflow.no); assert(dt4 == DateTime(1999, 2, 28, 12, 33, 33)); auto dt5 = DateTime(2000, 2, 29, 12, 30, 33); dt5.roll!"years"(1); assert(dt5 == DateTime(2001, 3, 1, 12, 30, 33)); auto dt6 = DateTime(2000, 2, 29, 12, 30, 33); dt6.roll!"years"(1, AllowDayOverflow.no); assert(dt6 == DateTime(2001, 2, 28, 12, 30, 33)); -------------------- +/ /+ref DateTime+/ void roll(string units)(long value, AllowDayOverflow allowOverflow = AllowDayOverflow.yes) pure nothrow if(units == "years" || units == "months") { _date.roll!units(value, allowOverflow); } //Verify Examples. unittest { version(testdStdDateTime) { auto dt1 = DateTime(2010, 1, 1, 12, 33, 33); dt1.roll!"months"(1); assert(dt1 == DateTime(2010, 2, 1, 12, 33, 33)); auto dt2 = DateTime(2010, 1, 1, 12, 33, 33); dt2.roll!"months"(-1); assert(dt2 == DateTime(2010, 12, 1, 12, 33, 33)); auto dt3 = DateTime(1999, 1, 29, 12, 33, 33); dt3.roll!"months"(1); assert(dt3 == DateTime(1999, 3, 1, 12, 33, 33)); auto dt4 = DateTime(1999, 1, 29, 12, 33, 33); dt4.roll!"months"(1, AllowDayOverflow.no); assert(dt4 == DateTime(1999, 2, 28, 12, 33, 33)); auto dt5 = DateTime(2000, 2, 29, 12, 30, 33); dt5.roll!"years"(1); assert(dt5 == DateTime(2001, 3, 1, 12, 30, 33)); auto dt6 = DateTime(2000, 2, 29, 12, 30, 33); dt6.roll!"years"(1, AllowDayOverflow.no); assert(dt6 == DateTime(2001, 2, 28, 12, 30, 33)); } } unittest { version(testStdDateTime) { const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(!__traits(compiles, cdt.roll!"years"(4))); static assert(!__traits(compiles, idt.roll!"years"(4))); static assert(!__traits(compiles, cdt.roll!"months"(4))); static assert(!__traits(compiles, idt.roll!"months"(4))); static assert(!__traits(compiles, cdt.roll!"days"(4))); static assert(!__traits(compiles, idt.roll!"days"(4))); } } /++ Adds the given number of units to this $(D DateTime). A negative number will subtract. The difference between rolling and adding is that rolling does not affect larger units. For instance, rolling a $(D DateTime) one year's worth of days gets the exact same $(D DateTime). Accepted units are $(D "days"), $(D "minutes"), $(D "hours"), $(D "minutes"), and $(D "seconds"). Params: units = The units to add. value = The number of $(D_PARAM units) to add to this $(D DateTime). Examples: -------------------- auto dt1 = DateTime(2010, 1, 1, 11, 23, 12); dt1.roll!"days"(1); assert(dt1 == DateTime(2010, 1, 2, 11, 23, 12)); dt1.roll!"days"(365); assert(dt1 == DateTime(2010, 1, 26, 11, 23, 12)); dt1.roll!"days"(-32); assert(dt1 == DateTime(2010, 1, 25, 11, 23, 12)); auto dt2 = DateTime(2010, 7, 4, 12, 0, 0); dt2.roll!"hours"(1); assert(dt2 == DateTime(2010, 7, 4, 13, 0, 0)); auto dt3 = DateTime(2010, 1, 1, 0, 0, 0); dt3.roll!"seconds"(-1); assert(dt3 == DateTime(2010, 1, 1, 0, 0, 59)); -------------------- +/ /+ref DateTime+/ void roll(string units)(long days) pure nothrow if(units == "days") { _date.roll!"days"(days); } //Verify Examples. unittest { version(testStdDateTime) { auto dt1 = DateTime(2010, 1, 1, 11, 23, 12); dt1.roll!"days"(1); assert(dt1 == DateTime(2010, 1, 2, 11, 23, 12)); dt1.roll!"days"(365); assert(dt1 == DateTime(2010, 1, 26, 11, 23, 12)); dt1.roll!"days"(-32); assert(dt1 == DateTime(2010, 1, 25, 11, 23, 12)); auto dt2 = DateTime(2010, 7, 4, 12, 0, 0); dt2.roll!"hours"(1); assert(dt2 == DateTime(2010, 7, 4, 13, 0, 0)); auto dt3 = DateTime(2010, 1, 1, 0, 0, 0); dt3.roll!"seconds"(-1); assert(dt3 == DateTime(2010, 1, 1, 0, 0, 59)); } } unittest { version(testStdDateTime) { const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(!__traits(compiles, cdt.roll!"days"(4))); static assert(!__traits(compiles, idt.roll!"days"(4))); } } //Shares documentation with "days" version. /+ref DateTime+/ void roll(string units)(long value) pure nothrow if(units == "hours" || units == "minutes" || units == "seconds") { _tod.roll!units(value); } //Test roll!"hours"(). unittest { version(testStdDateTime) { static void testDT(DateTime orig, int hours, in DateTime expected, size_t line = __LINE__) { orig.roll!"hours"(hours); _assertPred!"=="(orig, expected, "", __FILE__, line); } //Test A.D. testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 0, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1, DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 2, DateTime(Date(1999, 7, 6), TimeOfDay(14, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 3, DateTime(Date(1999, 7, 6), TimeOfDay(15, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 4, DateTime(Date(1999, 7, 6), TimeOfDay(16, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 5, DateTime(Date(1999, 7, 6), TimeOfDay(17, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 6, DateTime(Date(1999, 7, 6), TimeOfDay(18, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 7, DateTime(Date(1999, 7, 6), TimeOfDay(19, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 8, DateTime(Date(1999, 7, 6), TimeOfDay(20, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 9, DateTime(Date(1999, 7, 6), TimeOfDay(21, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 10, DateTime(Date(1999, 7, 6), TimeOfDay(22, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 11, DateTime(Date(1999, 7, 6), TimeOfDay(23, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 12, DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 13, DateTime(Date(1999, 7, 6), TimeOfDay(1, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 14, DateTime(Date(1999, 7, 6), TimeOfDay(2, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 15, DateTime(Date(1999, 7, 6), TimeOfDay(3, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 16, DateTime(Date(1999, 7, 6), TimeOfDay(4, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 17, DateTime(Date(1999, 7, 6), TimeOfDay(5, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 18, DateTime(Date(1999, 7, 6), TimeOfDay(6, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 19, DateTime(Date(1999, 7, 6), TimeOfDay(7, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 20, DateTime(Date(1999, 7, 6), TimeOfDay(8, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 21, DateTime(Date(1999, 7, 6), TimeOfDay(9, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 22, DateTime(Date(1999, 7, 6), TimeOfDay(10, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 23, DateTime(Date(1999, 7, 6), TimeOfDay(11, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 24, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 25, DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -1, DateTime(Date(1999, 7, 6), TimeOfDay(11, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -2, DateTime(Date(1999, 7, 6), TimeOfDay(10, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -3, DateTime(Date(1999, 7, 6), TimeOfDay(9, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -4, DateTime(Date(1999, 7, 6), TimeOfDay(8, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -5, DateTime(Date(1999, 7, 6), TimeOfDay(7, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -6, DateTime(Date(1999, 7, 6), TimeOfDay(6, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -7, DateTime(Date(1999, 7, 6), TimeOfDay(5, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -8, DateTime(Date(1999, 7, 6), TimeOfDay(4, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -9, DateTime(Date(1999, 7, 6), TimeOfDay(3, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -10, DateTime(Date(1999, 7, 6), TimeOfDay(2, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -11, DateTime(Date(1999, 7, 6), TimeOfDay(1, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -12, DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -13, DateTime(Date(1999, 7, 6), TimeOfDay(23, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -14, DateTime(Date(1999, 7, 6), TimeOfDay(22, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -15, DateTime(Date(1999, 7, 6), TimeOfDay(21, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -16, DateTime(Date(1999, 7, 6), TimeOfDay(20, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -17, DateTime(Date(1999, 7, 6), TimeOfDay(19, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -18, DateTime(Date(1999, 7, 6), TimeOfDay(18, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -19, DateTime(Date(1999, 7, 6), TimeOfDay(17, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -20, DateTime(Date(1999, 7, 6), TimeOfDay(16, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -21, DateTime(Date(1999, 7, 6), TimeOfDay(15, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -22, DateTime(Date(1999, 7, 6), TimeOfDay(14, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -23, DateTime(Date(1999, 7, 6), TimeOfDay(13, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -24, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -25, DateTime(Date(1999, 7, 6), TimeOfDay(11, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33)), 1, DateTime(Date(1999, 7, 6), TimeOfDay(1, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33)), 0, DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33)), -1, DateTime(Date(1999, 7, 6), TimeOfDay(23, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(23, 30, 33)), 1, DateTime(Date(1999, 7, 6), TimeOfDay(0, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(23, 30, 33)), 0, DateTime(Date(1999, 7, 6), TimeOfDay(23, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(23, 30, 33)), -1, DateTime(Date(1999, 7, 6), TimeOfDay(22, 30, 33))); testDT(DateTime(Date(1999, 7, 31), TimeOfDay(23, 30, 33)), 1, DateTime(Date(1999, 7, 31), TimeOfDay(0, 30, 33))); testDT(DateTime(Date(1999, 8, 1), TimeOfDay(0, 30, 33)), -1, DateTime(Date(1999, 8, 1), TimeOfDay(23, 30, 33))); testDT(DateTime(Date(1999, 12, 31), TimeOfDay(23, 30, 33)), 1, DateTime(Date(1999, 12, 31), TimeOfDay(0, 30, 33))); testDT(DateTime(Date(2000, 1, 1), TimeOfDay(0, 30, 33)), -1, DateTime(Date(2000, 1, 1), TimeOfDay(23, 30, 33))); testDT(DateTime(Date(1999, 2, 28), TimeOfDay(23, 30, 33)), 25, DateTime(Date(1999, 2, 28), TimeOfDay(0, 30, 33))); testDT(DateTime(Date(1999, 3, 2), TimeOfDay(0, 30, 33)), -25, DateTime(Date(1999, 3, 2), TimeOfDay(23, 30, 33))); testDT(DateTime(Date(2000, 2, 28), TimeOfDay(23, 30, 33)), 25, DateTime(Date(2000, 2, 28), TimeOfDay(0, 30, 33))); testDT(DateTime(Date(2000, 3, 1), TimeOfDay(0, 30, 33)), -25, DateTime(Date(2000, 3, 1), TimeOfDay(23, 30, 33))); //Test B.C. testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 0, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1, DateTime(Date(-1999, 7, 6), TimeOfDay(13, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 2, DateTime(Date(-1999, 7, 6), TimeOfDay(14, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 3, DateTime(Date(-1999, 7, 6), TimeOfDay(15, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 4, DateTime(Date(-1999, 7, 6), TimeOfDay(16, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 5, DateTime(Date(-1999, 7, 6), TimeOfDay(17, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 6, DateTime(Date(-1999, 7, 6), TimeOfDay(18, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 7, DateTime(Date(-1999, 7, 6), TimeOfDay(19, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 8, DateTime(Date(-1999, 7, 6), TimeOfDay(20, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 9, DateTime(Date(-1999, 7, 6), TimeOfDay(21, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 10, DateTime(Date(-1999, 7, 6), TimeOfDay(22, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 11, DateTime(Date(-1999, 7, 6), TimeOfDay(23, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 12, DateTime(Date(-1999, 7, 6), TimeOfDay(0, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 13, DateTime(Date(-1999, 7, 6), TimeOfDay(1, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 14, DateTime(Date(-1999, 7, 6), TimeOfDay(2, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 15, DateTime(Date(-1999, 7, 6), TimeOfDay(3, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 16, DateTime(Date(-1999, 7, 6), TimeOfDay(4, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 17, DateTime(Date(-1999, 7, 6), TimeOfDay(5, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 18, DateTime(Date(-1999, 7, 6), TimeOfDay(6, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 19, DateTime(Date(-1999, 7, 6), TimeOfDay(7, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 20, DateTime(Date(-1999, 7, 6), TimeOfDay(8, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 21, DateTime(Date(-1999, 7, 6), TimeOfDay(9, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 22, DateTime(Date(-1999, 7, 6), TimeOfDay(10, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 23, DateTime(Date(-1999, 7, 6), TimeOfDay(11, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 24, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 25, DateTime(Date(-1999, 7, 6), TimeOfDay(13, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -1, DateTime(Date(-1999, 7, 6), TimeOfDay(11, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -2, DateTime(Date(-1999, 7, 6), TimeOfDay(10, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -3, DateTime(Date(-1999, 7, 6), TimeOfDay(9, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -4, DateTime(Date(-1999, 7, 6), TimeOfDay(8, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -5, DateTime(Date(-1999, 7, 6), TimeOfDay(7, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -6, DateTime(Date(-1999, 7, 6), TimeOfDay(6, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -7, DateTime(Date(-1999, 7, 6), TimeOfDay(5, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -8, DateTime(Date(-1999, 7, 6), TimeOfDay(4, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -9, DateTime(Date(-1999, 7, 6), TimeOfDay(3, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -10, DateTime(Date(-1999, 7, 6), TimeOfDay(2, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -11, DateTime(Date(-1999, 7, 6), TimeOfDay(1, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -12, DateTime(Date(-1999, 7, 6), TimeOfDay(0, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -13, DateTime(Date(-1999, 7, 6), TimeOfDay(23, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -14, DateTime(Date(-1999, 7, 6), TimeOfDay(22, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -15, DateTime(Date(-1999, 7, 6), TimeOfDay(21, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -16, DateTime(Date(-1999, 7, 6), TimeOfDay(20, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -17, DateTime(Date(-1999, 7, 6), TimeOfDay(19, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -18, DateTime(Date(-1999, 7, 6), TimeOfDay(18, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -19, DateTime(Date(-1999, 7, 6), TimeOfDay(17, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -20, DateTime(Date(-1999, 7, 6), TimeOfDay(16, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -21, DateTime(Date(-1999, 7, 6), TimeOfDay(15, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -22, DateTime(Date(-1999, 7, 6), TimeOfDay(14, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -23, DateTime(Date(-1999, 7, 6), TimeOfDay(13, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -24, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -25, DateTime(Date(-1999, 7, 6), TimeOfDay(11, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 30, 33)), 1, DateTime(Date(-1999, 7, 6), TimeOfDay(1, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 30, 33)), 0, DateTime(Date(-1999, 7, 6), TimeOfDay(0, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 30, 33)), -1, DateTime(Date(-1999, 7, 6), TimeOfDay(23, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(23, 30, 33)), 1, DateTime(Date(-1999, 7, 6), TimeOfDay(0, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(23, 30, 33)), 0, DateTime(Date(-1999, 7, 6), TimeOfDay(23, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(23, 30, 33)), -1, DateTime(Date(-1999, 7, 6), TimeOfDay(22, 30, 33))); testDT(DateTime(Date(-1999, 7, 31), TimeOfDay(23, 30, 33)), 1, DateTime(Date(-1999, 7, 31), TimeOfDay(0, 30, 33))); testDT(DateTime(Date(-1999, 8, 1), TimeOfDay(0, 30, 33)), -1, DateTime(Date(-1999, 8, 1), TimeOfDay(23, 30, 33))); testDT(DateTime(Date(-2001, 12, 31), TimeOfDay(23, 30, 33)), 1, DateTime(Date(-2001, 12, 31), TimeOfDay(0, 30, 33))); testDT(DateTime(Date(-2000, 1, 1), TimeOfDay(0, 30, 33)), -1, DateTime(Date(-2000, 1, 1), TimeOfDay(23, 30, 33))); testDT(DateTime(Date(-2001, 2, 28), TimeOfDay(23, 30, 33)), 25, DateTime(Date(-2001, 2, 28), TimeOfDay(0, 30, 33))); testDT(DateTime(Date(-2001, 3, 2), TimeOfDay(0, 30, 33)), -25, DateTime(Date(-2001, 3, 2), TimeOfDay(23, 30, 33))); testDT(DateTime(Date(-2000, 2, 28), TimeOfDay(23, 30, 33)), 25, DateTime(Date(-2000, 2, 28), TimeOfDay(0, 30, 33))); testDT(DateTime(Date(-2000, 3, 1), TimeOfDay(0, 30, 33)), -25, DateTime(Date(-2000, 3, 1), TimeOfDay(23, 30, 33))); //Test Both testDT(DateTime(Date(-1, 1, 1), TimeOfDay(11, 30, 33)), 17_546, DateTime(Date(-1, 1, 1), TimeOfDay(13, 30, 33))); testDT(DateTime(Date(1, 1, 1), TimeOfDay(13, 30, 33)), -17_546, DateTime(Date(1, 1, 1), TimeOfDay(11, 30, 33))); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(!__traits(compiles, cdt.roll!"hours"(4))); static assert(!__traits(compiles, idt.roll!"hours"(4))); //Verify Examples. auto dt1 = DateTime(Date(2010, 7, 4), TimeOfDay(12, 0, 0)); dt1.roll!"hours"(1); assert(dt1 == DateTime(Date(2010, 7, 4), TimeOfDay(13, 0, 0))); auto dt2 = DateTime(Date(2010, 2, 12), TimeOfDay(12, 0, 0)); dt2.roll!"hours"(-1); assert(dt2 == DateTime(Date(2010, 2, 12), TimeOfDay(11, 0, 0))); auto dt3 = DateTime(Date(2009, 12, 31), TimeOfDay(23, 0, 0)); dt3.roll!"hours"(1); assert(dt3 == DateTime(Date(2009, 12, 31), TimeOfDay(0, 0, 0))); auto dt4 = DateTime(Date(2010, 1, 1), TimeOfDay(0, 0, 0)); dt4.roll!"hours"(-1); assert(dt4 == DateTime(Date(2010, 1, 1), TimeOfDay(23, 0, 0))); } } //Test roll!"minutes"(). unittest { version(testStdDateTime) { static void testDT(DateTime orig, int minutes, in DateTime expected, size_t line = __LINE__) { orig.roll!"minutes"(minutes); _assertPred!"=="(orig, expected, "", __FILE__, line); } //Test A.D. testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 0, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1, DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 2, DateTime(Date(1999, 7, 6), TimeOfDay(12, 32, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 3, DateTime(Date(1999, 7, 6), TimeOfDay(12, 33, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 4, DateTime(Date(1999, 7, 6), TimeOfDay(12, 34, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 5, DateTime(Date(1999, 7, 6), TimeOfDay(12, 35, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 10, DateTime(Date(1999, 7, 6), TimeOfDay(12, 40, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 15, DateTime(Date(1999, 7, 6), TimeOfDay(12, 45, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 29, DateTime(Date(1999, 7, 6), TimeOfDay(12, 59, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 30, DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 45, DateTime(Date(1999, 7, 6), TimeOfDay(12, 15, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 60, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 75, DateTime(Date(1999, 7, 6), TimeOfDay(12, 45, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 90, DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 100, DateTime(Date(1999, 7, 6), TimeOfDay(12, 10, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 689, DateTime(Date(1999, 7, 6), TimeOfDay(12, 59, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 690, DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 691, DateTime(Date(1999, 7, 6), TimeOfDay(12, 1, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 960, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1439, DateTime(Date(1999, 7, 6), TimeOfDay(12, 29, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1440, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1441, DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 2880, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -1, DateTime(Date(1999, 7, 6), TimeOfDay(12, 29, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -2, DateTime(Date(1999, 7, 6), TimeOfDay(12, 28, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -3, DateTime(Date(1999, 7, 6), TimeOfDay(12, 27, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -4, DateTime(Date(1999, 7, 6), TimeOfDay(12, 26, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -5, DateTime(Date(1999, 7, 6), TimeOfDay(12, 25, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -10, DateTime(Date(1999, 7, 6), TimeOfDay(12, 20, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -15, DateTime(Date(1999, 7, 6), TimeOfDay(12, 15, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -29, DateTime(Date(1999, 7, 6), TimeOfDay(12, 1, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -30, DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -45, DateTime(Date(1999, 7, 6), TimeOfDay(12, 45, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -60, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -75, DateTime(Date(1999, 7, 6), TimeOfDay(12, 15, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -90, DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -100, DateTime(Date(1999, 7, 6), TimeOfDay(12, 50, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -749, DateTime(Date(1999, 7, 6), TimeOfDay(12, 1, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -750, DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -751, DateTime(Date(1999, 7, 6), TimeOfDay(12, 59, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -960, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -1439, DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -1440, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -1441, DateTime(Date(1999, 7, 6), TimeOfDay(12, 29, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -2880, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33)), 1, DateTime(Date(1999, 7, 6), TimeOfDay(12, 1, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33)), 0, DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 33)), -1, DateTime(Date(1999, 7, 6), TimeOfDay(12, 59, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(11, 59, 33)), 1, DateTime(Date(1999, 7, 6), TimeOfDay(11, 0, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(11, 59, 33)), 0, DateTime(Date(1999, 7, 6), TimeOfDay(11, 59, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(11, 59, 33)), -1, DateTime(Date(1999, 7, 6), TimeOfDay(11, 58, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 33)), 1, DateTime(Date(1999, 7, 6), TimeOfDay(0, 1, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 33)), 0, DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 33)), -1, DateTime(Date(1999, 7, 6), TimeOfDay(0, 59, 33))); testDT(DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 33)), 1, DateTime(Date(1999, 7, 5), TimeOfDay(23, 0, 33))); testDT(DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 33)), 0, DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 33))); testDT(DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 33)), -1, DateTime(Date(1999, 7, 5), TimeOfDay(23, 58, 33))); testDT(DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 33)), 1, DateTime(Date(1998, 12, 31), TimeOfDay(23, 0, 33))); testDT(DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 33)), 0, DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 33))); testDT(DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 33)), -1, DateTime(Date(1998, 12, 31), TimeOfDay(23, 58, 33))); //Test B.C. testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 0, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 31, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 2, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 32, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 3, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 33, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 4, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 34, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 5, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 35, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 10, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 40, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 15, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 45, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 29, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 59, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 30, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 45, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 15, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 60, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 75, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 45, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 90, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 100, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 10, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 689, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 59, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 690, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 691, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 1, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 960, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1439, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 29, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1440, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1441, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 31, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 2880, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -1, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 29, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -2, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 28, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -3, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 27, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -4, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 26, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -5, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 25, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -10, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 20, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -15, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 15, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -29, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 1, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -30, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -45, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 45, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -60, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -75, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 15, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -90, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -100, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 50, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -749, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 1, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -750, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -751, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 59, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -960, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -1439, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 31, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -1440, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -1441, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 29, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -2880, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33)), 1, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 1, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33)), 0, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 33)), -1, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 59, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(11, 59, 33)), 1, DateTime(Date(-1999, 7, 6), TimeOfDay(11, 0, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(11, 59, 33)), 0, DateTime(Date(-1999, 7, 6), TimeOfDay(11, 59, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(11, 59, 33)), -1, DateTime(Date(-1999, 7, 6), TimeOfDay(11, 58, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 33)), 1, DateTime(Date(-1999, 7, 6), TimeOfDay(0, 1, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 33)), 0, DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 33)), -1, DateTime(Date(-1999, 7, 6), TimeOfDay(0, 59, 33))); testDT(DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 33)), 1, DateTime(Date(-1999, 7, 5), TimeOfDay(23, 0, 33))); testDT(DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 33)), 0, DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 33))); testDT(DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 33)), -1, DateTime(Date(-1999, 7, 5), TimeOfDay(23, 58, 33))); testDT(DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 33)), 1, DateTime(Date(-2000, 12, 31), TimeOfDay(23, 0, 33))); testDT(DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 33)), 0, DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 33))); testDT(DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 33)), -1, DateTime(Date(-2000, 12, 31), TimeOfDay(23, 58, 33))); //Test Both testDT(DateTime(Date(1, 1, 1), TimeOfDay(0, 0, 0)), -1, DateTime(Date(1, 1, 1), TimeOfDay(0, 59, 0))); testDT(DateTime(Date(0, 12, 31), TimeOfDay(23, 59, 0)), 1, DateTime(Date(0, 12, 31), TimeOfDay(23, 0, 0))); testDT(DateTime(Date(0, 1, 1), TimeOfDay(0, 0, 0)), -1, DateTime(Date(0, 1, 1), TimeOfDay(0, 59, 0))); testDT(DateTime(Date(-1, 12, 31), TimeOfDay(23, 59, 0)), 1, DateTime(Date(-1, 12, 31), TimeOfDay(23, 0, 0))); testDT(DateTime(Date(-1, 1, 1), TimeOfDay(11, 30, 33)), 1_052_760, DateTime(Date(-1, 1, 1), TimeOfDay(11, 30, 33))); testDT(DateTime(Date(1, 1, 1), TimeOfDay(13, 30, 33)), -1_052_760, DateTime(Date(1, 1, 1), TimeOfDay(13, 30, 33))); testDT(DateTime(Date(-1, 1, 1), TimeOfDay(11, 30, 33)), 1_052_782, DateTime(Date(-1, 1, 1), TimeOfDay(11, 52, 33))); testDT(DateTime(Date(1, 1, 1), TimeOfDay(13, 52, 33)), -1_052_782, DateTime(Date(1, 1, 1), TimeOfDay(13, 30, 33))); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(!__traits(compiles, cdt.roll!"minutes"(4))); static assert(!__traits(compiles, idt.roll!"minutes"(4))); } } //Test roll!"seconds"(). unittest { version(testStdDateTime) { static void testDT(DateTime orig, int seconds, in DateTime expected, size_t line = __LINE__) { orig.roll!"seconds"(seconds); _assertPred!"=="(orig, expected, "", __FILE__, line); } //Test A.D. testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 0, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 2, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 35))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 3, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 36))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 4, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 37))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 5, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 38))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 10, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 43))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 15, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 48))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 26, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 59))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 27, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 30, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 3))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 59, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 32))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 60, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 61, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1766, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 59))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1767, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 1768, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 1))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 2007, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 3599, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 32))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 3600, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 3601, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), 7200, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -1, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 32))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -2, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 31))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -3, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 30))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -4, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 29))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -5, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 28))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -10, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 23))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -15, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 18))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -33, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -34, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 59))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -35, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 58))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -59, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -60, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), -61, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 32))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0)), 1, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 1))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0)), 0, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 0)), -1, DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 59))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 0)), 1, DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 1))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 0)), 0, DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 0))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 0)), -1, DateTime(Date(1999, 7, 6), TimeOfDay(12, 0, 59))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 0)), 1, DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 1))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 0)), 0, DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 0))); testDT(DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 0)), -1, DateTime(Date(1999, 7, 6), TimeOfDay(0, 0, 59))); testDT(DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 59)), 1, DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 0))); testDT(DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 59)), 0, DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 59))); testDT(DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 59)), -1, DateTime(Date(1999, 7, 5), TimeOfDay(23, 59, 58))); testDT(DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 59)), 1, DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 0))); testDT(DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 59)), 0, DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 59))); testDT(DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 59)), -1, DateTime(Date(1998, 12, 31), TimeOfDay(23, 59, 58))); //Test B.C. testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 0, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 34))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 2, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 35))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 3, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 36))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 4, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 37))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 5, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 38))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 10, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 43))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 15, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 48))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 26, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 59))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 27, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 0))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 30, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 3))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 59, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 32))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 60, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 61, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 34))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1766, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 59))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1767, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 0))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 1768, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 1))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 2007, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 0))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 3599, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 32))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 3600, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 3601, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 34))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), 7200, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -1, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 32))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -2, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 31))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -3, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 30))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -4, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 29))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -5, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 28))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -10, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 23))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -15, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 18))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -33, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 0))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -34, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 59))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -35, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 58))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -59, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 34))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -60, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33)), -61, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 32))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 0)), 1, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 1))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 0)), 0, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 0))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 0)), -1, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 59))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 0)), 1, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 1))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 0)), 0, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 0))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 0)), -1, DateTime(Date(-1999, 7, 6), TimeOfDay(12, 0, 59))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 0)), 1, DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 1))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 0)), 0, DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 0))); testDT(DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 0)), -1, DateTime(Date(-1999, 7, 6), TimeOfDay(0, 0, 59))); testDT(DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 59)), 1, DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 0))); testDT(DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 59)), 0, DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 59))); testDT(DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 59)), -1, DateTime(Date(-1999, 7, 5), TimeOfDay(23, 59, 58))); testDT(DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 59)), 1, DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 0))); testDT(DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 59)), 0, DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 59))); testDT(DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 59)), -1, DateTime(Date(-2000, 12, 31), TimeOfDay(23, 59, 58))); //Test Both testDT(DateTime(Date(1, 1, 1), TimeOfDay(0, 0, 0)), -1, DateTime(Date(1, 1, 1), TimeOfDay(0, 0, 59))); testDT(DateTime(Date(0, 12, 31), TimeOfDay(23, 59, 59)), 1, DateTime(Date(0, 12, 31), TimeOfDay(23, 59, 0))); testDT(DateTime(Date(0, 1, 1), TimeOfDay(0, 0, 0)), -1, DateTime(Date(0, 1, 1), TimeOfDay(0, 0, 59))); testDT(DateTime(Date(-1, 12, 31), TimeOfDay(23, 59, 59)), 1, DateTime(Date(-1, 12, 31), TimeOfDay(23, 59, 0))); testDT(DateTime(Date(-1, 1, 1), TimeOfDay(11, 30, 33)), 63_165_600L, DateTime(Date(-1, 1, 1), TimeOfDay(11, 30, 33))); testDT(DateTime(Date(1, 1, 1), TimeOfDay(13, 30, 33)), -63_165_600L, DateTime(Date(1, 1, 1), TimeOfDay(13, 30, 33))); testDT(DateTime(Date(-1, 1, 1), TimeOfDay(11, 30, 33)), 63_165_617L, DateTime(Date(-1, 1, 1), TimeOfDay(11, 30, 50))); testDT(DateTime(Date(1, 1, 1), TimeOfDay(13, 30, 50)), -63_165_617L, DateTime(Date(1, 1, 1), TimeOfDay(13, 30, 33))); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(!__traits(compiles, cdt.roll!"seconds"(4))); static assert(!__traits(compiles, idt.roll!"seconds"(4))); } } /++ Gives the result of adding or subtracting a duration from this $(D DateTime). The legal types of arithmetic for $(D DateTime) using this operator are $(BOOKTABLE, $(TR $(TD DateTime) $(TD +) $(TD duration) $(TD -->) $(TD DateTime)) $(TR $(TD DateTime) $(TD -) $(TD duration) $(TD -->) $(TD DateTime)) ) Params: duration = The duration to add to or subtract from this $(D DateTime). +/ DateTime opBinary(string op, D)(in D duration) const pure nothrow if((op == "+" || op == "-") && (is(Unqual!D == Duration) || is(Unqual!D == TickDuration))) { DateTime retval = this; static if(is(Unqual!D == Duration)) immutable hnsecs = duration.total!"hnsecs"; else static if(is(Unqual!D == TickDuration)) immutable hnsecs = duration.hnsecs; //Ideally, this would just be //return retval.addSeconds(convert!("hnsecs", "seconds")(unaryFun!(op ~ "a")(hnsecs))); //But there isn't currently a pure version of unaryFun!(). static if(op == "+") immutable signedHNSecs = hnsecs; else static if(op == "-") immutable signedHNSecs = -hnsecs; else static assert(0); return retval.addSeconds(convert!("hnsecs", "seconds")(signedHNSecs)); } unittest { version(testStdDateTime) { auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); _assertPred!"=="(dt + dur!"weeks"(7), DateTime(Date(1999, 8, 24), TimeOfDay(12, 30, 33))); _assertPred!"=="(dt + dur!"weeks"(-7), DateTime(Date(1999, 5, 18), TimeOfDay(12, 30, 33))); _assertPred!"=="(dt + dur!"days"(7), DateTime(Date(1999, 7, 13), TimeOfDay(12, 30, 33))); _assertPred!"=="(dt + dur!"days"(-7), DateTime(Date(1999, 6, 29), TimeOfDay(12, 30, 33))); _assertPred!"=="(dt + dur!"hours"(7), DateTime(Date(1999, 7, 6), TimeOfDay(19, 30, 33))); _assertPred!"=="(dt + dur!"hours"(-7), DateTime(Date(1999, 7, 6), TimeOfDay(5, 30, 33))); _assertPred!"=="(dt + dur!"minutes"(7), DateTime(Date(1999, 7, 6), TimeOfDay(12, 37, 33))); _assertPred!"=="(dt + dur!"minutes"(-7), DateTime(Date(1999, 7, 6), TimeOfDay(12, 23, 33))); _assertPred!"=="(dt + dur!"seconds"(7), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"=="(dt + dur!"seconds"(-7), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); _assertPred!"=="(dt + dur!"msecs"(7_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"=="(dt + dur!"msecs"(-7_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); _assertPred!"=="(dt + dur!"usecs"(7_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"=="(dt + dur!"usecs"(-7_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); _assertPred!"=="(dt + dur!"hnsecs"(70_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"=="(dt + dur!"hnsecs"(-70_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); //This probably only runs in cases where gettimeofday() is used, but it's //hard to do this test correctly with variable ticksPerSec. if(TickDuration.ticksPerSec == 1_000_000) { _assertPred!"=="(dt + TickDuration.from!"usecs"(7_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"=="(dt + TickDuration.from!"usecs"(-7_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); } _assertPred!"=="(dt - dur!"weeks"(-7), DateTime(Date(1999, 8, 24), TimeOfDay(12, 30, 33))); _assertPred!"=="(dt - dur!"weeks"(7), DateTime(Date(1999, 5, 18), TimeOfDay(12, 30, 33))); _assertPred!"=="(dt - dur!"days"(-7), DateTime(Date(1999, 7, 13), TimeOfDay(12, 30, 33))); _assertPred!"=="(dt - dur!"days"(7), DateTime(Date(1999, 6, 29), TimeOfDay(12, 30, 33))); _assertPred!"=="(dt - dur!"hours"(-7), DateTime(Date(1999, 7, 6), TimeOfDay(19, 30, 33))); _assertPred!"=="(dt - dur!"hours"(7), DateTime(Date(1999, 7, 6), TimeOfDay(5, 30, 33))); _assertPred!"=="(dt - dur!"minutes"(-7), DateTime(Date(1999, 7, 6), TimeOfDay(12, 37, 33))); _assertPred!"=="(dt - dur!"minutes"(7), DateTime(Date(1999, 7, 6), TimeOfDay(12, 23, 33))); _assertPred!"=="(dt - dur!"seconds"(-7), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"=="(dt - dur!"seconds"(7), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); _assertPred!"=="(dt - dur!"msecs"(-7_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"=="(dt - dur!"msecs"(7_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); _assertPred!"=="(dt - dur!"usecs"(-7_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"=="(dt - dur!"usecs"(7_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); _assertPred!"=="(dt - dur!"hnsecs"(-70_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"=="(dt - dur!"hnsecs"(70_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); //This probably only runs in cases where gettimeofday() is used, but it's //hard to do this test correctly with variable ticksPerSec. if(TickDuration.ticksPerSec == 1_000_000) { _assertPred!"=="(dt - TickDuration.from!"usecs"(-7_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"=="(dt - TickDuration.from!"usecs"(7_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); } auto duration = dur!"seconds"(12); const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); static assert(__traits(compiles, cdt + duration)); static assert(__traits(compiles, idt + duration)); static assert(__traits(compiles, cdt - duration)); static assert(__traits(compiles, idt - duration)); } } /++ Gives the result of adding or subtracting a duration from this $(D DateTime), as well as assigning the result to this $(D DateTime). The legal types of arithmetic for $(D DateTime) using this operator are $(BOOKTABLE, $(TR $(TD DateTime) $(TD +) $(TD duration) $(TD -->) $(TD DateTime)) $(TR $(TD DateTime) $(TD -) $(TD duration) $(TD -->) $(TD DateTime)) ) Params: duration = The duration to add to or subtract from this $(D DateTime). +/ /+ref+/ DateTime opOpAssign(string op, D)(in D duration) pure nothrow if((op == "+" || op == "-") && (is(Unqual!D == Duration) || is(Unqual!D == TickDuration))) { DateTime retval = this; static if(is(Unqual!D == Duration)) immutable hnsecs = duration.total!"hnsecs"; else static if(is(Unqual!D == TickDuration)) immutable hnsecs = duration.hnsecs; //Ideally, this would just be //return addSeconds(convert!("hnsecs", "seconds")(unaryFun!(op ~ "a")(hnsecs))); //But there isn't currently a pure version of unaryFun!(). static if(op == "+") immutable signedHNSecs = hnsecs; else static if(op == "-") immutable signedHNSecs = -hnsecs; else static assert(0); return addSeconds(convert!("hnsecs", "seconds")(signedHNSecs)); } unittest { version(testStdDateTime) { _assertPred!"+="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"weeks"(7), DateTime(Date(1999, 8, 24), TimeOfDay(12, 30, 33))); _assertPred!"+="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"weeks"(-7), DateTime(Date(1999, 5, 18), TimeOfDay(12, 30, 33))); _assertPred!"+="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"days"(7), DateTime(Date(1999, 7, 13), TimeOfDay(12, 30, 33))); _assertPred!"+="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"days"(-7), DateTime(Date(1999, 6, 29), TimeOfDay(12, 30, 33))); _assertPred!"+="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"hours"(7), DateTime(Date(1999, 7, 6), TimeOfDay(19, 30, 33))); _assertPred!"+="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"hours"(-7), DateTime(Date(1999, 7, 6), TimeOfDay(5, 30, 33))); _assertPred!"+="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"minutes"(7), DateTime(Date(1999, 7, 6), TimeOfDay(12, 37, 33))); _assertPred!"+="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"minutes"(-7), DateTime(Date(1999, 7, 6), TimeOfDay(12, 23, 33))); _assertPred!"+="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"seconds"(7), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"+="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"seconds"(-7), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); _assertPred!"+="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"msecs"(7_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"+="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"msecs"(-7_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); _assertPred!"+="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"usecs"(7_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"+="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"usecs"(-7_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); _assertPred!"+="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"hnsecs"(70_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"+="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"hnsecs"(-70_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); _assertPred!"-="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"weeks"(-7), DateTime(Date(1999, 8, 24), TimeOfDay(12, 30, 33))); _assertPred!"-="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"weeks"(7), DateTime(Date(1999, 5, 18), TimeOfDay(12, 30, 33))); _assertPred!"-="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"days"(-7), DateTime(Date(1999, 7, 13), TimeOfDay(12, 30, 33))); _assertPred!"-="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"days"(7), DateTime(Date(1999, 6, 29), TimeOfDay(12, 30, 33))); _assertPred!"-="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"hours"(-7), DateTime(Date(1999, 7, 6), TimeOfDay(19, 30, 33))); _assertPred!"-="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"hours"(7), DateTime(Date(1999, 7, 6), TimeOfDay(5, 30, 33))); _assertPred!"-="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"minutes"(-7), DateTime(Date(1999, 7, 6), TimeOfDay(12, 37, 33))); _assertPred!"-="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"minutes"(7), DateTime(Date(1999, 7, 6), TimeOfDay(12, 23, 33))); _assertPred!"-="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"seconds"(-7), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"-="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"seconds"(7), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); _assertPred!"-="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"msecs"(-7_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"-="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"msecs"(7_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); _assertPred!"-="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"usecs"(-7_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"-="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"usecs"(7_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); _assertPred!"-="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"hnsecs"(-70_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); _assertPred!"-="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"hnsecs"(70_000_000), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); auto duration = dur!"seconds"(12); const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); static assert(!__traits(compiles, cdt += duration)); static assert(!__traits(compiles, idt += duration)); static assert(!__traits(compiles, cdt -= duration)); static assert(!__traits(compiles, idt -= duration)); } } /++ Gives the difference between two $(D DateTime)s. The legal types of arithmetic for $(D DateTime) using this operator are $(BOOKTABLE, $(TR $(TD DateTime) $(TD -) $(TD DateTime) $(TD -->) $(TD duration)) ) +/ Duration opBinary(string op)(in DateTime rhs) const pure nothrow if(op == "-") { immutable dateResult = _date - rhs.date; immutable todResult = _tod - rhs._tod; return dur!"hnsecs"(dateResult.total!"hnsecs" + todResult.total!"hnsecs"); } unittest { version(testStdDateTime) { auto dt = DateTime(1999, 7, 6, 12, 30, 33); _assertPred!"=="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - DateTime(Date(1998, 7, 6), TimeOfDay(12, 30, 33)), dur!"seconds"(31_536_000)); _assertPred!"=="(DateTime(Date(1998, 7, 6), TimeOfDay(12, 30, 33)) - DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"seconds"(-31_536_000)); _assertPred!"=="(DateTime(Date(1999, 8, 6), TimeOfDay(12, 30, 33)) - DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"seconds"(26_78_400)); _assertPred!"=="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - DateTime(Date(1999, 8, 6), TimeOfDay(12, 30, 33)), dur!"seconds"(-26_78_400)); _assertPred!"=="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - DateTime(Date(1999, 7, 5), TimeOfDay(12, 30, 33)), dur!"seconds"(86_400)); _assertPred!"=="(DateTime(Date(1999, 7, 5), TimeOfDay(12, 30, 33)) - DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"seconds"(-86_400)); _assertPred!"=="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - DateTime(Date(1999, 7, 6), TimeOfDay(11, 30, 33)), dur!"seconds"(3600)); _assertPred!"=="(DateTime(Date(1999, 7, 6), TimeOfDay(11, 30, 33)) - DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"seconds"(-3600)); _assertPred!"=="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)) - DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"seconds"(60)); _assertPred!"=="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - DateTime(Date(1999, 7, 6), TimeOfDay(12, 31, 33)), dur!"seconds"(-60)); _assertPred!"=="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)) - DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)), dur!"seconds"(1)); _assertPred!"=="(DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)) - DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 34)), dur!"seconds"(-1)); _assertPred!"=="(DateTime(1, 1, 1, 12, 30, 33) - DateTime(1, 1, 1, 0, 0, 0), dur!"seconds"(45033)); _assertPred!"=="(DateTime(1, 1, 1, 0, 0, 0) - DateTime(1, 1, 1, 12, 30, 33), dur!"seconds"(-45033)); _assertPred!"=="(DateTime(0, 12, 31, 12, 30, 33) - DateTime(1, 1, 1, 0, 0, 0), dur!"seconds"(-41367)); _assertPred!"=="(DateTime(1, 1, 1, 0, 0, 0) - DateTime(0, 12, 31, 12, 30, 33), dur!"seconds"(41367)); const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); static assert(__traits(compiles, dt - dt)); static assert(__traits(compiles, cdt - dt)); static assert(__traits(compiles, idt - dt)); static assert(__traits(compiles, dt - cdt)); static assert(__traits(compiles, cdt - cdt)); static assert(__traits(compiles, idt - cdt)); static assert(__traits(compiles, dt - idt)); static assert(__traits(compiles, cdt - idt)); static assert(__traits(compiles, idt - idt)); } } /++ Returns the difference between the two $(D DateTime)s in months. To get the difference in years, subtract the year property of two $(D SysTime)s. To get the difference in days or weeks, subtract the $(D SysTime)s themselves and use the $(D Duration) that results. Because converting between months and smaller units requires a specific date (which $(D Duration)s don't have), getting the difference in months requires some math using both the year and month properties, so this is a convenience function for getting the difference in months. Note that the number of days in the months or how far into the month either date is is irrelevant. It is the difference in the month property combined with the difference in years * 12. So, for instance, December 31st and January 1st are one month apart just as December 1st and January 31st are one month apart. Params: rhs = The $(D DateTime) to subtract from this one. Examples: -------------------- assert(DateTime(1999, 2, 1, 12, 2, 3).diffMonths( DateTime(1999, 1, 31, 23, 59, 59)) == 1); assert(DateTime(1999, 1, 31, 0, 0, 0).diffMonths( DateTime(1999, 2, 1, 12, 3, 42)) == -1); assert(DateTime(1999, 3, 1, 5, 30, 0).diffMonths( DateTime(1999, 1, 1, 2, 4, 7)) == 2); assert(DateTime(1999, 1, 1, 7, 2, 4).diffMonths( DateTime(1999, 3, 31, 0, 30, 58)) == -2); -------------------- +/ int diffMonths(in DateTime rhs) const pure nothrow { return _date.diffMonths(rhs._date); } unittest { version(testStdDateTime) { auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); static assert(__traits(compiles, dt.diffMonths(dt))); static assert(__traits(compiles, cdt.diffMonths(dt))); static assert(__traits(compiles, idt.diffMonths(dt))); static assert(__traits(compiles, dt.diffMonths(cdt))); static assert(__traits(compiles, cdt.diffMonths(cdt))); static assert(__traits(compiles, idt.diffMonths(cdt))); static assert(__traits(compiles, dt.diffMonths(idt))); static assert(__traits(compiles, cdt.diffMonths(idt))); static assert(__traits(compiles, idt.diffMonths(idt))); //Verify Examples. assert(DateTime(1999, 2, 1, 12, 2, 3).diffMonths(DateTime(1999, 1, 31, 23, 59, 59)) == 1); assert(DateTime(1999, 1, 31, 0, 0, 0).diffMonths(DateTime(1999, 2, 1, 12, 3, 42)) == -1); assert(DateTime(1999, 3, 1, 5, 30, 0).diffMonths(DateTime(1999, 1, 1, 2, 4, 7)) == 2); assert(DateTime(1999, 1, 1, 7, 2, 4).diffMonths(DateTime(1999, 3, 31, 0, 30, 58)) == -2); } } /++ Whether this $(D DateTime) is in a leap year. +/ @property bool isLeapYear() const pure nothrow { return _date.isLeapYear; } unittest { version(testStdDateTime) { auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); static assert(__traits(compiles, dt.isLeapYear)); static assert(__traits(compiles, cdt.isLeapYear)); static assert(__traits(compiles, idt.isLeapYear)); } } /++ Day of the week this $(D DateTime) is on. +/ @property DayOfWeek dayOfWeek() const pure nothrow { return _date.dayOfWeek; } unittest { version(testStdDateTime) { auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); static assert(__traits(compiles, dt.dayOfWeek)); static assert(__traits(compiles, cdt.dayOfWeek)); static assert(__traits(compiles, idt.dayOfWeek)); } } /++ Day of the year this $(D DateTime) is on. Examples: -------------------- assert(DateTime(Date(1999, 1, 1), TimeOfDay(12, 22, 7)).dayOfYear == 1); assert(DateTime(Date(1999, 12, 31), TimeOfDay(7, 2, 59)).dayOfYear == 365); assert(DateTime(Date(2000, 12, 31), TimeOfDay(21, 20, 0)).dayOfYear == 366); -------------------- +/ @property ushort dayOfYear() const pure nothrow { return _date.dayOfYear; } unittest { version(testStdDateTime) { auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); static assert(__traits(compiles, dt.dayOfYear)); static assert(__traits(compiles, cdt.dayOfYear)); static assert(__traits(compiles, idt.dayOfYear)); //Verify Examples. assert(DateTime(Date(1999, 1, 1), TimeOfDay(12, 22, 7)).dayOfYear == 1); assert(DateTime(Date(1999, 12, 31), TimeOfDay(7, 2, 59)).dayOfYear == 365); assert(DateTime(Date(2000, 12, 31), TimeOfDay(21, 20, 0)).dayOfYear == 366); } } /++ Day of the year. Params: day = The day of the year to set which day of the year this $(D DateTime) is on. +/ @property void dayOfYear(int day) pure { _date.dayOfYear = day; } unittest { version(testStdDateTime) { auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); static assert(__traits(compiles, dt.dayOfYear = 12)); static assert(!__traits(compiles, cdt.dayOfYear = 12)); static assert(!__traits(compiles, idt.dayOfYear = 12)); } } /++ The Xth day of the Gregorian Calendar that this $(D DateTime) is on. Examples: -------------------- assert(DateTime(Date(1, 1, 1), TimeOfDay(0, 0, 0)).dayOfGregorianCal == 1); assert(DateTime(Date(1, 12, 31), TimeOfDay(23, 59, 59)).dayOfGregorianCal == 365); assert(DateTime(Date(2, 1, 1), TimeOfDay(2, 2, 2)).dayOfGregorianCal == 366); assert(DateTime(Date(0, 12, 31), TimeOfDay(7, 7, 7)).dayOfGregorianCal == 0); assert(DateTime(Date(0, 1, 1), TimeOfDay(19, 30, 0)).dayOfGregorianCal == -365); assert(DateTime(Date(-1, 12, 31), TimeOfDay(4, 7, 0)).dayOfGregorianCal == -366); assert(DateTime(Date(2000, 1, 1), TimeOfDay(9, 30, 20)).dayOfGregorianCal == 730_120); assert(DateTime(Date(2010, 12, 31), TimeOfDay(15, 45, 50)).dayOfGregorianCal == 734_137); -------------------- +/ @property int dayOfGregorianCal() const pure nothrow { return _date.dayOfGregorianCal; } unittest { version(testStdDateTime) { const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); static assert(__traits(compiles, cdt.dayOfGregorianCal)); static assert(__traits(compiles, idt.dayOfGregorianCal)); //Verify Examples. assert(DateTime(Date(1, 1, 1), TimeOfDay(0, 0, 0)).dayOfGregorianCal == 1); assert(DateTime(Date(1, 12, 31), TimeOfDay(23, 59, 59)).dayOfGregorianCal == 365); assert(DateTime(Date(2, 1, 1), TimeOfDay(2, 2, 2)).dayOfGregorianCal == 366); assert(DateTime(Date(0, 12, 31), TimeOfDay(7, 7, 7)).dayOfGregorianCal == 0); assert(DateTime(Date(0, 1, 1), TimeOfDay(19, 30, 0)).dayOfGregorianCal == -365); assert(DateTime(Date(-1, 12, 31), TimeOfDay(4, 7, 0)).dayOfGregorianCal == -366); assert(DateTime(Date(2000, 1, 1), TimeOfDay(9, 30, 20)).dayOfGregorianCal == 730_120); assert(DateTime(Date(2010, 12, 31), TimeOfDay(15, 45, 50)).dayOfGregorianCal == 734_137); } } /++ The Xth day of the Gregorian Calendar that this $(D DateTime) is on. Setting this property does not affect the time portion of $(D DateTime). Params: days = The day of the Gregorian Calendar to set this $(D DateTime) to. Examples: -------------------- auto dt = DateTime(Date.init, TimeOfDay(12, 0, 0)); dt.dayOfGregorianCal = 1; assert(dt == DateTime(Date(1, 1, 1), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = 365; assert(dt == DateTime(Date(1, 12, 31), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = 366; assert(dt == DateTime(Date(2, 1, 1), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = 0; assert(dt == DateTime(Date(0, 12, 31), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = -365; assert(dt == DateTime(Date(-0, 1, 1), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = -366; assert(dt == DateTime(Date(-1, 12, 31), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = 730_120; assert(dt == DateTime(Date(2000, 1, 1), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = 734_137; assert(dt == DateTime(Date(2010, 12, 31), TimeOfDay(12, 0, 0))); -------------------- +/ @property void dayOfGregorianCal(int days) pure nothrow { _date.dayOfGregorianCal = days; } unittest { version(testStdDateTime) { const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); static assert(!__traits(compiles, cdt.dayOfGregorianCal = 7)); static assert(!__traits(compiles, idt.dayOfGregorianCal = 7)); //Verify Examples. auto dt = DateTime(Date.init, TimeOfDay(12, 0, 0)); dt.dayOfGregorianCal = 1; assert(dt == DateTime(Date(1, 1, 1), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = 365; assert(dt == DateTime(Date(1, 12, 31), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = 366; assert(dt == DateTime(Date(2, 1, 1), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = 0; assert(dt == DateTime(Date(0, 12, 31), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = -365; assert(dt == DateTime(Date(-0, 1, 1), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = -366; assert(dt == DateTime(Date(-1, 12, 31), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = 730_120; assert(dt == DateTime(Date(2000, 1, 1), TimeOfDay(12, 0, 0))); dt.dayOfGregorianCal = 734_137; assert(dt == DateTime(Date(2010, 12, 31), TimeOfDay(12, 0, 0))); } } /++ The ISO 8601 week of the year that this $(D DateTime) is in. See_Also: $(WEB en.wikipedia.org/wiki/ISO_week_date, ISO Week Date) +/ @property ubyte isoWeek() const pure nothrow { return _date.isoWeek; } unittest { version(testStdDateTime) { auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); static assert(__traits(compiles, dt.isoWeek)); static assert(__traits(compiles, cdt.isoWeek)); static assert(__traits(compiles, idt.isoWeek)); } } /++ $(D DateTime) for the last day in the month that this $(D DateTime) is in. The time portion of endOfMonth is always 23:59:59. Examples: -------------------- assert(DateTime(Date(1999, 1, 6), TimeOfDay(0, 0, 0)).endOfMonth == DateTime(Date(1999, 1, 31), TimeOfDay(23, 59, 59))); assert(DateTime(Date(1999, 2, 7), TimeOfDay(19, 30, 0)).endOfMonth == DateTime(Date(1999, 2, 28), TimeOfDay(23, 59, 59))); assert(DateTime(Date(2000, 2, 7), TimeOfDay(5, 12, 27)).endOfMonth == DateTime(Date(2000, 2, 29), TimeOfDay(23, 59, 59))); assert(DateTime(Date(2000, 6, 4), TimeOfDay(12, 22, 9)).endOfMonth == DateTime(Date(2000, 6, 30), TimeOfDay(23, 59, 59))); -------------------- +/ @property DateTime endOfMonth() const pure nothrow { try return DateTime(_date.endOfMonth, TimeOfDay(23, 59, 59)); catch(Exception e) assert(0, "DateTime constructor threw."); } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(DateTime(1999, 1, 1, 0, 13, 26).endOfMonth, DateTime(1999, 1, 31, 23, 59, 59)); _assertPred!"=="(DateTime(1999, 2, 1, 1, 14, 27).endOfMonth, DateTime(1999, 2, 28, 23, 59, 59)); _assertPred!"=="(DateTime(2000, 2, 1, 2, 15, 28).endOfMonth, DateTime(2000, 2, 29, 23, 59, 59)); _assertPred!"=="(DateTime(1999, 3, 1, 3, 16, 29).endOfMonth, DateTime(1999, 3, 31, 23, 59, 59)); _assertPred!"=="(DateTime(1999, 4, 1, 4, 17, 30).endOfMonth, DateTime(1999, 4, 30, 23, 59, 59)); _assertPred!"=="(DateTime(1999, 5, 1, 5, 18, 31).endOfMonth, DateTime(1999, 5, 31, 23, 59, 59)); _assertPred!"=="(DateTime(1999, 6, 1, 6, 19, 32).endOfMonth, DateTime(1999, 6, 30, 23, 59, 59)); _assertPred!"=="(DateTime(1999, 7, 1, 7, 20, 33).endOfMonth, DateTime(1999, 7, 31, 23, 59, 59)); _assertPred!"=="(DateTime(1999, 8, 1, 8, 21, 34).endOfMonth, DateTime(1999, 8, 31, 23, 59, 59)); _assertPred!"=="(DateTime(1999, 9, 1, 9, 22, 35).endOfMonth, DateTime(1999, 9, 30, 23, 59, 59)); _assertPred!"=="(DateTime(1999, 10, 1, 10, 23, 36).endOfMonth, DateTime(1999, 10, 31, 23, 59, 59)); _assertPred!"=="(DateTime(1999, 11, 1, 11, 24, 37).endOfMonth, DateTime(1999, 11, 30, 23, 59, 59)); _assertPred!"=="(DateTime(1999, 12, 1, 12, 25, 38).endOfMonth, DateTime(1999, 12, 31, 23, 59, 59)); //Test B.C. _assertPred!"=="(DateTime(-1999, 1, 1, 0, 13, 26).endOfMonth, DateTime(-1999, 1, 31, 23, 59, 59)); _assertPred!"=="(DateTime(-1999, 2, 1, 1, 14, 27).endOfMonth, DateTime(-1999, 2, 28, 23, 59, 59)); _assertPred!"=="(DateTime(-2000, 2, 1, 2, 15, 28).endOfMonth, DateTime(-2000, 2, 29, 23, 59, 59)); _assertPred!"=="(DateTime(-1999, 3, 1, 3, 16, 29).endOfMonth, DateTime(-1999, 3, 31, 23, 59, 59)); _assertPred!"=="(DateTime(-1999, 4, 1, 4, 17, 30).endOfMonth, DateTime(-1999, 4, 30, 23, 59, 59)); _assertPred!"=="(DateTime(-1999, 5, 1, 5, 18, 31).endOfMonth, DateTime(-1999, 5, 31, 23, 59, 59)); _assertPred!"=="(DateTime(-1999, 6, 1, 6, 19, 32).endOfMonth, DateTime(-1999, 6, 30, 23, 59, 59)); _assertPred!"=="(DateTime(-1999, 7, 1, 7, 20, 33).endOfMonth, DateTime(-1999, 7, 31, 23, 59, 59)); _assertPred!"=="(DateTime(-1999, 8, 1, 8, 21, 34).endOfMonth, DateTime(-1999, 8, 31, 23, 59, 59)); _assertPred!"=="(DateTime(-1999, 9, 1, 9, 22, 35).endOfMonth, DateTime(-1999, 9, 30, 23, 59, 59)); _assertPred!"=="(DateTime(-1999, 10, 1, 10, 23, 36).endOfMonth, DateTime(-1999, 10, 31, 23, 59, 59)); _assertPred!"=="(DateTime(-1999, 11, 1, 11, 24, 37).endOfMonth, DateTime(-1999, 11, 30, 23, 59, 59)); _assertPred!"=="(DateTime(-1999, 12, 1, 12, 25, 38).endOfMonth, DateTime(-1999, 12, 31, 23, 59, 59)); const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); static assert(__traits(compiles, cdt.endOfMonth)); static assert(__traits(compiles, idt.endOfMonth)); //Verify Examples. assert(DateTime(Date(1999, 1, 6), TimeOfDay(0, 0, 0)).endOfMonth == DateTime(Date(1999, 1, 31), TimeOfDay(23, 59, 59))); assert(DateTime(Date(1999, 2, 7), TimeOfDay(19, 30, 0)).endOfMonth == DateTime(Date(1999, 2, 28), TimeOfDay(23, 59, 59))); assert(DateTime(Date(2000, 2, 7), TimeOfDay(5, 12, 27)).endOfMonth == DateTime(Date(2000, 2, 29), TimeOfDay(23, 59, 59))); assert(DateTime(Date(2000, 6, 4), TimeOfDay(12, 22, 9)).endOfMonth == DateTime(Date(2000, 6, 30), TimeOfDay(23, 59, 59))); } } /++ The last day in the month that this $(D DateTime) is in. Examples: -------------------- assert(DateTime(Date(1999, 1, 6), TimeOfDay(0, 0, 0)).daysInMonth == 31); assert(DateTime(Date(1999, 2, 7), TimeOfDay(19, 30, 0)).daysInMonth == 28); assert(DateTime(Date(2000, 2, 7), TimeOfDay(5, 12, 27)).daysInMonth == 29); assert(DateTime(Date(2000, 6, 4), TimeOfDay(12, 22, 9)).daysInMonth == 30); -------------------- +/ @property ubyte daysInMonth() const pure nothrow { return _date.daysInMonth; } //Explicitly undocumented. Do not use. To be removed in March 2013. deprecated("Please use daysInMonth instead.") @property ubyte endOfMonthDay() const nothrow { return _date.daysInMonth; } unittest { version(testStdDateTime) { const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); static assert(__traits(compiles, cdt.daysInMonth)); static assert(__traits(compiles, idt.daysInMonth)); //Verify Examples. assert(DateTime(Date(1999, 1, 6), TimeOfDay(0, 0, 0)).daysInMonth == 31); assert(DateTime(Date(1999, 2, 7), TimeOfDay(19, 30, 0)).daysInMonth == 28); assert(DateTime(Date(2000, 2, 7), TimeOfDay(5, 12, 27)).daysInMonth == 29); assert(DateTime(Date(2000, 6, 4), TimeOfDay(12, 22, 9)).daysInMonth == 30); } } /++ Whether the current year is a date in A.D. Examples: -------------------- assert(DateTime(Date(1, 1, 1), TimeOfDay(12, 7, 0)).isAD); assert(DateTime(Date(2010, 12, 31), TimeOfDay(0, 0, 0)).isAD); assert(!DateTime(Date(0, 12, 31), TimeOfDay(23, 59, 59)).isAD); assert(!DateTime(Date(-2010, 1, 1), TimeOfDay(2, 2, 2)).isAD); -------------------- +/ @property bool isAD() const pure nothrow { return _date.isAD; } unittest { version(testStdDateTime) { const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); static assert(__traits(compiles, cdt.isAD)); static assert(__traits(compiles, idt.isAD)); //Verify Examples. assert(DateTime(Date(1, 1, 1), TimeOfDay(12, 7, 0)).isAD); assert(DateTime(Date(2010, 12, 31), TimeOfDay(0, 0, 0)).isAD); assert(!DateTime(Date(0, 12, 31), TimeOfDay(23, 59, 59)).isAD); assert(!DateTime(Date(-2010, 1, 1), TimeOfDay(2, 2, 2)).isAD); } } /++ The julian day for this $(D DateTime) at the given time. For example, prior to noon, 1996-03-31 would be the julian day number 2_450_173, so this function returns 2_450_173, while from noon onward, the julian day number would be 2_450_174, so this function returns 2_450_174. +/ @property long julianDay() const pure nothrow { if(_tod._hour < 12) return _date.julianDay - 1; else return _date.julianDay; } unittest { version(testStdDateTime) { _assertPred!"=="(DateTime(Date(-4713, 11, 24), TimeOfDay(0, 0, 0)).julianDay, -1); _assertPred!"=="(DateTime(Date(-4713, 11, 24), TimeOfDay(12, 0, 0)).julianDay, 0); _assertPred!"=="(DateTime(Date(0, 12, 31), TimeOfDay(0, 0, 0)).julianDay, 1_721_424); _assertPred!"=="(DateTime(Date(0, 12, 31), TimeOfDay(12, 0, 0)).julianDay, 1_721_425); _assertPred!"=="(DateTime(Date(1, 1, 1), TimeOfDay(0, 0, 0)).julianDay, 1_721_425); _assertPred!"=="(DateTime(Date(1, 1, 1), TimeOfDay(12, 0, 0)).julianDay, 1_721_426); _assertPred!"=="(DateTime(Date(1582, 10, 15), TimeOfDay(0, 0, 0)).julianDay, 2_299_160); _assertPred!"=="(DateTime(Date(1582, 10, 15), TimeOfDay(12, 0, 0)).julianDay, 2_299_161); _assertPred!"=="(DateTime(Date(1858, 11, 17), TimeOfDay(0, 0, 0)).julianDay, 2_400_000); _assertPred!"=="(DateTime(Date(1858, 11, 17), TimeOfDay(12, 0, 0)).julianDay, 2_400_001); _assertPred!"=="(DateTime(Date(1982, 1, 4), TimeOfDay(0, 0, 0)).julianDay, 2_444_973); _assertPred!"=="(DateTime(Date(1982, 1, 4), TimeOfDay(12, 0, 0)).julianDay, 2_444_974); _assertPred!"=="(DateTime(Date(1996, 3, 31), TimeOfDay(0, 0, 0)).julianDay, 2_450_173); _assertPred!"=="(DateTime(Date(1996, 3, 31), TimeOfDay(12, 0, 0)).julianDay, 2_450_174); _assertPred!"=="(DateTime(Date(2010, 8, 24), TimeOfDay(0, 0, 0)).julianDay, 2_455_432); _assertPred!"=="(DateTime(Date(2010, 8, 24), TimeOfDay(12, 0, 0)).julianDay, 2_455_433); const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); static assert(__traits(compiles, cdt.julianDay)); static assert(__traits(compiles, idt.julianDay)); } } /++ The modified julian day for any time on this date (since, the modified julian day changes at midnight). +/ @property long modJulianDay() const pure nothrow { return _date.modJulianDay; } unittest { version(testStdDateTime) { _assertPred!"=="(DateTime(Date(1858, 11, 17), TimeOfDay(0, 0, 0)).modJulianDay, 0); _assertPred!"=="(DateTime(Date(1858, 11, 17), TimeOfDay(12, 0, 0)).modJulianDay, 0); _assertPred!"=="(DateTime(Date(2010, 8, 24), TimeOfDay(0, 0, 0)).modJulianDay, 55_432); _assertPred!"=="(DateTime(Date(2010, 8, 24), TimeOfDay(12, 0, 0)).modJulianDay, 55_432); const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); static assert(__traits(compiles, cdt.modJulianDay)); static assert(__traits(compiles, idt.modJulianDay)); } } /++ Converts this $(D DateTime) to a string with the format YYYYMMDDTHHMMSS. Examples: -------------------- assert(DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)).toISOString() == "20100704T070612"); assert(DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)).toISOString() == "19981225T021500"); assert(DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)).toISOString() == "00000105T230959"); assert(DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)).toISOString() == "-00040105T000002"); -------------------- +/ string toISOString() const nothrow { try return format("%sT%s", _date.toISOString(), _tod.toISOString()); catch(Exception e) assert(0, "format() threw."); } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(DateTime(Date(9, 12, 4), TimeOfDay(0, 0, 0)).toISOString(), "00091204T000000"); _assertPred!"=="(DateTime(Date(99, 12, 4), TimeOfDay(5, 6, 12)).toISOString(), "00991204T050612"); _assertPred!"=="(DateTime(Date(999, 12, 4), TimeOfDay(13, 44, 59)).toISOString(), "09991204T134459"); _assertPred!"=="(DateTime(Date(9999, 7, 4), TimeOfDay(23, 59, 59)).toISOString(), "99990704T235959"); _assertPred!"=="(DateTime(Date(10000, 10, 20), TimeOfDay(1, 1, 1)).toISOString(), "+100001020T010101"); //Test B.C. _assertPred!"=="(DateTime(Date(0, 12, 4), TimeOfDay(0, 12, 4)).toISOString(), "00001204T001204"); _assertPred!"=="(DateTime(Date(-9, 12, 4), TimeOfDay(0, 0, 0)).toISOString(), "-00091204T000000"); _assertPred!"=="(DateTime(Date(-99, 12, 4), TimeOfDay(5, 6, 12)).toISOString(), "-00991204T050612"); _assertPred!"=="(DateTime(Date(-999, 12, 4), TimeOfDay(13, 44, 59)).toISOString(), "-09991204T134459"); _assertPred!"=="(DateTime(Date(-9999, 7, 4), TimeOfDay(23, 59, 59)).toISOString(), "-99990704T235959"); _assertPred!"=="(DateTime(Date(-10000, 10, 20), TimeOfDay(1, 1, 1)).toISOString(), "-100001020T010101"); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(__traits(compiles, cdt.toISOString())); static assert(__traits(compiles, idt.toISOString())); //Verify Examples. assert(DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)).toISOString() == "20100704T070612"); assert(DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)).toISOString() == "19981225T021500"); assert(DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)).toISOString() == "00000105T230959"); assert(DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)).toISOString() == "-00040105T000002"); } } /++ Converts this $(D DateTime) to a string with the format YYYY-MM-DDTHH:MM:SS. Examples: -------------------- assert(DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)).toISOExtString() == "2010-07-04T07:06:12"); assert(DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)).toISOExtString() == "1998-12-25T02:15:00"); assert(DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)).toISOExtString() == "0000-01-05T23:09:59"); assert(DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)).toISOExtString() == "-0004-01-05T00:00:02"); -------------------- +/ string toISOExtString() const nothrow { try return format("%sT%s", _date.toISOExtString(), _tod.toISOExtString()); catch(Exception e) assert(0, "format() threw."); } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(DateTime(Date(9, 12, 4), TimeOfDay(0, 0, 0)).toISOExtString(), "0009-12-04T00:00:00"); _assertPred!"=="(DateTime(Date(99, 12, 4), TimeOfDay(5, 6, 12)).toISOExtString(), "0099-12-04T05:06:12"); _assertPred!"=="(DateTime(Date(999, 12, 4), TimeOfDay(13, 44, 59)).toISOExtString(), "0999-12-04T13:44:59"); _assertPred!"=="(DateTime(Date(9999, 7, 4), TimeOfDay(23, 59, 59)).toISOExtString(), "9999-07-04T23:59:59"); _assertPred!"=="(DateTime(Date(10000, 10, 20), TimeOfDay(1, 1, 1)).toISOExtString(), "+10000-10-20T01:01:01"); //Test B.C. _assertPred!"=="(DateTime(Date(0, 12, 4), TimeOfDay(0, 12, 4)).toISOExtString(), "0000-12-04T00:12:04"); _assertPred!"=="(DateTime(Date(-9, 12, 4), TimeOfDay(0, 0, 0)).toISOExtString(), "-0009-12-04T00:00:00"); _assertPred!"=="(DateTime(Date(-99, 12, 4), TimeOfDay(5, 6, 12)).toISOExtString(), "-0099-12-04T05:06:12"); _assertPred!"=="(DateTime(Date(-999, 12, 4), TimeOfDay(13, 44, 59)).toISOExtString(), "-0999-12-04T13:44:59"); _assertPred!"=="(DateTime(Date(-9999, 7, 4), TimeOfDay(23, 59, 59)).toISOExtString(), "-9999-07-04T23:59:59"); _assertPred!"=="(DateTime(Date(-10000, 10, 20), TimeOfDay(1, 1, 1)).toISOExtString(), "-10000-10-20T01:01:01"); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(__traits(compiles, cdt.toISOExtString())); static assert(__traits(compiles, idt.toISOExtString())); //Verify Examples. assert(DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)).toISOExtString() == "2010-07-04T07:06:12"); assert(DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)).toISOExtString() == "1998-12-25T02:15:00"); assert(DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)).toISOExtString() == "0000-01-05T23:09:59"); assert(DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)).toISOExtString() == "-0004-01-05T00:00:02"); } } /++ Converts this $(D DateTime) to a string with the format YYYY-Mon-DD HH:MM:SS. Examples: -------------------- assert(DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)).toSimpleString() == "2010-Jul-04 07:06:12"); assert(DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)).toSimpleString() == "1998-Dec-25 02:15:00"); assert(DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)).toSimpleString() == "0000-Jan-05 23:09:59"); assert(DateTime(Dte(-4, 1, 5), TimeOfDay(0, 0, 2)).toSimpleString() == "-0004-Jan-05 00:00:02"); -------------------- +/ string toSimpleString() const nothrow { try return format("%s %s", _date.toSimpleString(), _tod.toString()); catch(Exception e) assert(0, "format() threw."); } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(DateTime(Date(9, 12, 4), TimeOfDay(0, 0, 0)).toSimpleString(), "0009-Dec-04 00:00:00"); _assertPred!"=="(DateTime(Date(99, 12, 4), TimeOfDay(5, 6, 12)).toSimpleString(), "0099-Dec-04 05:06:12"); _assertPred!"=="(DateTime(Date(999, 12, 4), TimeOfDay(13, 44, 59)).toSimpleString(), "0999-Dec-04 13:44:59"); _assertPred!"=="(DateTime(Date(9999, 7, 4), TimeOfDay(23, 59, 59)).toSimpleString(), "9999-Jul-04 23:59:59"); _assertPred!"=="(DateTime(Date(10000, 10, 20), TimeOfDay(1, 1, 1)).toSimpleString(), "+10000-Oct-20 01:01:01"); //Test B.C. _assertPred!"=="(DateTime(Date(0, 12, 4), TimeOfDay(0, 12, 4)).toSimpleString(), "0000-Dec-04 00:12:04"); _assertPred!"=="(DateTime(Date(-9, 12, 4), TimeOfDay(0, 0, 0)).toSimpleString(), "-0009-Dec-04 00:00:00"); _assertPred!"=="(DateTime(Date(-99, 12, 4), TimeOfDay(5, 6, 12)).toSimpleString(), "-0099-Dec-04 05:06:12"); _assertPred!"=="(DateTime(Date(-999, 12, 4), TimeOfDay(13, 44, 59)).toSimpleString(), "-0999-Dec-04 13:44:59"); _assertPred!"=="(DateTime(Date(-9999, 7, 4), TimeOfDay(23, 59, 59)).toSimpleString(), "-9999-Jul-04 23:59:59"); _assertPred!"=="(DateTime(Date(-10000, 10, 20), TimeOfDay(1, 1, 1)).toSimpleString(), "-10000-Oct-20 01:01:01"); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(__traits(compiles, cdt.toSimpleString())); static assert(__traits(compiles, idt.toSimpleString())); //Verify Examples. assert(DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)).toSimpleString() == "2010-Jul-04 07:06:12"); assert(DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0)).toSimpleString() == "1998-Dec-25 02:15:00"); assert(DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59)).toSimpleString() == "0000-Jan-05 23:09:59"); assert(DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2)).toSimpleString() == "-0004-Jan-05 00:00:02"); } } /+ Converts this $(D DateTime) to a string. +/ //Due to bug http://d.puremagic.com/issues/show_bug.cgi?id=3715 , we can't //have versions of toString() with extra modifiers, so we define one version //with modifiers and one without. string toString() { return toSimpleString(); } /++ Converts this $(D DateTime) to a string. +/ //Due to bug http://d.puremagic.com/issues/show_bug.cgi?id=3715 , we can't //have versions of toString() with extra modifiers, so we define one version //with modifiers and one without. string toString() const nothrow { return toSimpleString(); } unittest { version(testStdDateTime) { auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); const cdt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); immutable idt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); static assert(__traits(compiles, dt.toString())); static assert(__traits(compiles, cdt.toString())); static assert(__traits(compiles, idt.toString())); } } /++ Creates a $(D DateTime) from a string with the format YYYYMMDDTHHMMSS. Whitespace is stripped from the given string. Params: isoString = A string formatted in the ISO format for dates and times. Throws: $(D DateTimeException) if the given string is not in the ISO format or if the resulting $(D DateTime) would not be valid. Examples: -------------------- assert(DateTime.fromISOString("20100704T070612") == DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12))); assert(DateTime.fromISOString("19981225T021500") == DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0))); assert(DateTime.fromISOString("00000105T230959") == DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59))); assert(DateTime.fromISOString("-00040105T000002") == DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2))); assert(DateTime.fromISOString(" 20100704T070612 ") == DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12))); -------------------- +/ static DateTime fromISOString(S)(in S isoString) if(isSomeString!S) { immutable dstr = to!dstring(strip(isoString)); enforce(dstr.length >= 15, new DateTimeException(format("Invalid ISO String: %s", isoString))); auto t = dstr.stds_indexOf('T'); enforce(t != -1, new DateTimeException(format("Invalid ISO String: %s", isoString))); immutable date = Date.fromISOString(dstr[0..t]); immutable tod = TimeOfDay.fromISOString(dstr[t+1 .. $]); return DateTime(date, tod); } unittest { version(testStdDateTime) { assertThrown!DateTimeException(DateTime.fromISOString("")); assertThrown!DateTimeException(DateTime.fromISOString("20100704000000")); assertThrown!DateTimeException(DateTime.fromISOString("20100704 000000")); assertThrown!DateTimeException(DateTime.fromISOString("20100704t000000")); assertThrown!DateTimeException(DateTime.fromISOString("20100704T000000.")); assertThrown!DateTimeException(DateTime.fromISOString("20100704T000000.0")); assertThrown!DateTimeException(DateTime.fromISOString("2010-07-0400:00:00")); assertThrown!DateTimeException(DateTime.fromISOString("2010-07-04 00:00:00")); assertThrown!DateTimeException(DateTime.fromISOString("2010-07-04t00:00:00")); assertThrown!DateTimeException(DateTime.fromISOString("2010-07-04T00:00:00.")); assertThrown!DateTimeException(DateTime.fromISOString("2010-07-04T00:00:00.0")); assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-0400:00:00")); assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04 00:00:00")); assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04t00:00:00")); assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04T00:00:00")); assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04 00:00:00.")); assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04 00:00:00.0")); assertThrown!DateTimeException(DateTime.fromISOString("2010-12-22T172201")); assertThrown!DateTimeException(DateTime.fromISOString("2010-Dec-22 17:22:01")); _assertPred!"=="(DateTime.fromISOString("20101222T172201"), DateTime(Date(2010, 12, 22), TimeOfDay(17, 22, 01))); _assertPred!"=="(DateTime.fromISOString("19990706T123033"), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!"=="(DateTime.fromISOString("-19990706T123033"), DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!"=="(DateTime.fromISOString("+019990706T123033"), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!"=="(DateTime.fromISOString("19990706T123033 "), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!"=="(DateTime.fromISOString(" 19990706T123033"), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!"=="(DateTime.fromISOString(" 19990706T123033 "), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); //Verify Examples. assert(DateTime.fromISOString("20100704T070612") == DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12))); assert(DateTime.fromISOString("19981225T021500") == DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0))); assert(DateTime.fromISOString("00000105T230959") == DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59))); assert(DateTime.fromISOString("-00040105T000002") == DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2))); assert(DateTime.fromISOString(" 20100704T070612 ") == DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12))); } } /++ Creates a $(D DateTime) from a string with the format YYYY-MM-DDTHH:MM:SS. Whitespace is stripped from the given string. Params: isoString = A string formatted in the ISO Extended format for dates and times. Throws: $(D DateTimeException) if the given string is not in the ISO Extended format or if the resulting $(D DateTime) would not be valid. Examples: -------------------- assert(DateTime.fromISOExtString("2010-07-04T07:06:12") == DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12))); assert(DateTime.fromISOExtString("1998-12-25T02:15:00") == DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0))); assert(DateTime.fromISOExtString("0000-01-05T23:09:59") == DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59))); assert(DateTime.fromISOExtString("-0004-01-05T00:00:02") == DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2))); assert(DateTime.fromISOExtString(" 2010-07-04T07:06:12 ") == DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12))); -------------------- +/ static DateTime fromISOExtString(S)(in S isoExtString) if(isSomeString!(S)) { immutable dstr = to!dstring(strip(isoExtString)); enforce(dstr.length >= 15, new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); auto t = dstr.stds_indexOf('T'); enforce(t != -1, new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); immutable date = Date.fromISOExtString(dstr[0..t]); immutable tod = TimeOfDay.fromISOExtString(dstr[t+1 .. $]); return DateTime(date, tod); } unittest { version(testStdDateTime) { assertThrown!DateTimeException(DateTime.fromISOExtString("")); assertThrown!DateTimeException(DateTime.fromISOExtString("20100704000000")); assertThrown!DateTimeException(DateTime.fromISOExtString("20100704 000000")); assertThrown!DateTimeException(DateTime.fromISOExtString("20100704t000000")); assertThrown!DateTimeException(DateTime.fromISOExtString("20100704T000000.")); assertThrown!DateTimeException(DateTime.fromISOExtString("20100704T000000.0")); assertThrown!DateTimeException(DateTime.fromISOExtString("2010-07:0400:00:00")); assertThrown!DateTimeException(DateTime.fromISOExtString("2010-07-04 00:00:00")); assertThrown!DateTimeException(DateTime.fromISOExtString("2010-07-04 00:00:00")); assertThrown!DateTimeException(DateTime.fromISOExtString("2010-07-04t00:00:00")); assertThrown!DateTimeException(DateTime.fromISOExtString("2010-07-04T00:00:00.")); assertThrown!DateTimeException(DateTime.fromISOExtString("2010-07-04T00:00:00.0")); assertThrown!DateTimeException(DateTime.fromISOExtString("2010-Jul-0400:00:00")); assertThrown!DateTimeException(DateTime.fromISOExtString("2010-Jul-04t00:00:00")); assertThrown!DateTimeException(DateTime.fromISOExtString("2010-Jul-04 00:00:00.")); assertThrown!DateTimeException(DateTime.fromISOExtString("2010-Jul-04 00:00:00.0")); assertThrown!DateTimeException(DateTime.fromISOExtString("20101222T172201")); assertThrown!DateTimeException(DateTime.fromISOExtString("2010-Dec-22 17:22:01")); _assertPred!"=="(DateTime.fromISOExtString("2010-12-22T17:22:01"), DateTime(Date(2010, 12, 22), TimeOfDay(17, 22, 01))); _assertPred!"=="(DateTime.fromISOExtString("1999-07-06T12:30:33"), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!"=="(DateTime.fromISOExtString("-1999-07-06T12:30:33"), DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!"=="(DateTime.fromISOExtString("+01999-07-06T12:30:33"), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!"=="(DateTime.fromISOExtString("1999-07-06T12:30:33 "), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!"=="(DateTime.fromISOExtString(" 1999-07-06T12:30:33"), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!"=="(DateTime.fromISOExtString(" 1999-07-06T12:30:33 "), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); //Verify Examples. assert(DateTime.fromISOExtString("2010-07-04T07:06:12") == DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12))); assert(DateTime.fromISOExtString("1998-12-25T02:15:00") == DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0))); assert(DateTime.fromISOExtString("0000-01-05T23:09:59") == DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59))); assert(DateTime.fromISOExtString("-0004-01-05T00:00:02") == DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2))); assert(DateTime.fromISOExtString(" 2010-07-04T07:06:12 ") == DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12))); } } /++ Creates a $(D DateTime) from a string with the format YYYY-Mon-DD HH:MM:SS. Whitespace is stripped from the given string. Params: simpleString = A string formatted in the way that toSimpleString formats dates and times. Throws: $(D DateTimeException) if the given string is not in the correct format or if the resulting $(D DateTime) would not be valid. Examples: -------------------- assert(DateTime.fromSimpleString("2010-Jul-04 07:06:12") == DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12))); assert(DateTime.fromSimpleString("1998-Dec-25 02:15:00") == DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0))); assert(DateTime.fromSimpleString("0000-Jan-05 23:09:59") == DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59))); assert(DateTime.fromSimpleString("-0004-Jan-05 00:00:02") == DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2))); assert(DateTime.fromSimpleString(" 2010-Jul-04 07:06:12 ") == DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12))); -------------------- +/ static DateTime fromSimpleString(S)(in S simpleString) if(isSomeString!(S)) { immutable dstr = to!dstring(strip(simpleString)); enforce(dstr.length >= 15, new DateTimeException(format("Invalid string format: %s", simpleString))); auto t = dstr.stds_indexOf(' '); enforce(t != -1, new DateTimeException(format("Invalid string format: %s", simpleString))); immutable date = Date.fromSimpleString(dstr[0..t]); immutable tod = TimeOfDay.fromISOExtString(dstr[t+1 .. $]); return DateTime(date, tod); } unittest { version(testStdDateTime) { assertThrown!DateTimeException(DateTime.fromISOString("")); assertThrown!DateTimeException(DateTime.fromISOString("20100704000000")); assertThrown!DateTimeException(DateTime.fromISOString("20100704 000000")); assertThrown!DateTimeException(DateTime.fromISOString("20100704t000000")); assertThrown!DateTimeException(DateTime.fromISOString("20100704T000000.")); assertThrown!DateTimeException(DateTime.fromISOString("20100704T000000.0")); assertThrown!DateTimeException(DateTime.fromISOString("2010-07-0400:00:00")); assertThrown!DateTimeException(DateTime.fromISOString("2010-07-04 00:00:00")); assertThrown!DateTimeException(DateTime.fromISOString("2010-07-04t00:00:00")); assertThrown!DateTimeException(DateTime.fromISOString("2010-07-04T00:00:00.")); assertThrown!DateTimeException(DateTime.fromISOString("2010-07-04T00:00:00.0")); assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-0400:00:00")); assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04 00:00:00")); assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04t00:00:00")); assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04T00:00:00")); assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04 00:00:00.")); assertThrown!DateTimeException(DateTime.fromISOString("2010-Jul-04 00:00:00.0")); assertThrown!DateTimeException(DateTime.fromSimpleString("20101222T172201")); assertThrown!DateTimeException(DateTime.fromSimpleString("2010-12-22T172201")); _assertPred!"=="(DateTime.fromSimpleString("2010-Dec-22 17:22:01"), DateTime(Date(2010, 12, 22), TimeOfDay(17, 22, 01))); _assertPred!"=="(DateTime.fromSimpleString("1999-Jul-06 12:30:33"), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!"=="(DateTime.fromSimpleString("-1999-Jul-06 12:30:33"), DateTime(Date(-1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!"=="(DateTime.fromSimpleString("+01999-Jul-06 12:30:33"), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!"=="(DateTime.fromSimpleString("1999-Jul-06 12:30:33 "), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!"=="(DateTime.fromSimpleString(" 1999-Jul-06 12:30:33"), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); _assertPred!"=="(DateTime.fromSimpleString(" 1999-Jul-06 12:30:33 "), DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33))); //Verify Examples. assert(DateTime.fromSimpleString("2010-Jul-04 07:06:12") == DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12))); assert(DateTime.fromSimpleString("1998-Dec-25 02:15:00") == DateTime(Date(1998, 12, 25), TimeOfDay(2, 15, 0))); assert(DateTime.fromSimpleString("0000-Jan-05 23:09:59") == DateTime(Date(0, 1, 5), TimeOfDay(23, 9, 59))); assert(DateTime.fromSimpleString("-0004-Jan-05 00:00:02") == DateTime(Date(-4, 1, 5), TimeOfDay(0, 0, 2))); assert(DateTime.fromSimpleString(" 2010-Jul-04 07:06:12 ") == DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12))); } } //TODO Add function which takes a user-specified time format and produces a DateTime //TODO Add function which takes pretty much any time-string and produces a DateTime // Obviously, it will be less efficient, and it probably won't manage _every_ // possible date format, but a smart conversion function would be nice. /++ Returns the $(D DateTime) farthest in the past which is representable by $(D DateTime). +/ @property static DateTime min() pure nothrow out(result) { assert(result._date == Date.min); assert(result._tod == TimeOfDay.min); } body { auto dt = DateTime.init; dt._date._year = short.min; dt._date._month = Month.jan; dt._date._day = 1; return dt; } unittest { version(testStdDateTime) { assert(DateTime.min.year < 0); assert(DateTime.min < DateTime.max); } } /++ Returns the $(D DateTime) farthest in the future which is representable by $(D DateTime). +/ @property static DateTime max() pure nothrow out(result) { assert(result._date == Date.max); assert(result._tod == TimeOfDay.max); } body { auto dt = DateTime.init; dt._date._year = short.max; dt._date._month = Month.dec; dt._date._day = 31; dt._tod._hour = TimeOfDay.maxHour; dt._tod._minute = TimeOfDay.maxMinute; dt._tod._second = TimeOfDay.maxSecond; return dt; } unittest { version(testStdDateTime) { assert(DateTime.max.year > 0); assert(DateTime.max > DateTime.min); } } private: /+ Add seconds to the time of day. Negative values will subtract. If the number of seconds overflows (or underflows), then the seconds will wrap, increasing (or decreasing) the number of minutes accordingly. The same goes for any larger units. Params: seconds = The number of seconds to add to this $(D DateTime). +/ ref DateTime addSeconds(long seconds) pure nothrow { long hnsecs = convert!("seconds", "hnsecs")(seconds); hnsecs += convert!("hours", "hnsecs")(_tod._hour); hnsecs += convert!("minutes", "hnsecs")(_tod._minute); hnsecs += convert!("seconds", "hnsecs")(_tod._second); auto days = splitUnitsFromHNSecs!"days"(hnsecs); if(hnsecs < 0) { hnsecs += convert!("days", "hnsecs")(1); --days; } _date.addDays(days); immutable newHours = splitUnitsFromHNSecs!"hours"(hnsecs); immutable newMinutes = splitUnitsFromHNSecs!"minutes"(hnsecs); immutable newSeconds = splitUnitsFromHNSecs!"seconds"(hnsecs); _tod._hour = cast(ubyte)newHours; _tod._minute = cast(ubyte)newMinutes; _tod._second = cast(ubyte)newSeconds; return this; } unittest { version(testStdDateTime) { static void testDT(DateTime orig, int seconds, in DateTime expected, size_t line = __LINE__) { orig.addSeconds(seconds); _assertPred!"=="(orig, expected, "", __FILE__, line); } //Test A.D. testDT(DateTime(1999, 7, 6, 12, 30, 33), 0, DateTime(1999, 7, 6, 12, 30, 33)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 1, DateTime(1999, 7, 6, 12, 30, 34)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 2, DateTime(1999, 7, 6, 12, 30, 35)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 3, DateTime(1999, 7, 6, 12, 30, 36)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 4, DateTime(1999, 7, 6, 12, 30, 37)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 5, DateTime(1999, 7, 6, 12, 30, 38)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 10, DateTime(1999, 7, 6, 12, 30, 43)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 15, DateTime(1999, 7, 6, 12, 30, 48)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 26, DateTime(1999, 7, 6, 12, 30, 59)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 27, DateTime(1999, 7, 6, 12, 31, 0)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 30, DateTime(1999, 7, 6, 12, 31, 3)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 59, DateTime(1999, 7, 6, 12, 31, 32)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 60, DateTime(1999, 7, 6, 12, 31, 33)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 61, DateTime(1999, 7, 6, 12, 31, 34)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 1766, DateTime(1999, 7, 6, 12, 59, 59)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 1767, DateTime(1999, 7, 6, 13, 0, 0)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 1768, DateTime(1999, 7, 6, 13, 0, 1)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 2007, DateTime(1999, 7, 6, 13, 4, 0)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 3599, DateTime(1999, 7, 6, 13, 30, 32)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 3600, DateTime(1999, 7, 6, 13, 30, 33)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 3601, DateTime(1999, 7, 6, 13, 30, 34)); testDT(DateTime(1999, 7, 6, 12, 30, 33), 7200, DateTime(1999, 7, 6, 14, 30, 33)); testDT(DateTime(1999, 7, 6, 23, 0, 0), 432_123, DateTime(1999, 7, 11, 23, 2, 3)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -1, DateTime(1999, 7, 6, 12, 30, 32)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -2, DateTime(1999, 7, 6, 12, 30, 31)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -3, DateTime(1999, 7, 6, 12, 30, 30)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -4, DateTime(1999, 7, 6, 12, 30, 29)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -5, DateTime(1999, 7, 6, 12, 30, 28)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -10, DateTime(1999, 7, 6, 12, 30, 23)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -15, DateTime(1999, 7, 6, 12, 30, 18)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -33, DateTime(1999, 7, 6, 12, 30, 0)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -34, DateTime(1999, 7, 6, 12, 29, 59)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -35, DateTime(1999, 7, 6, 12, 29, 58)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -59, DateTime(1999, 7, 6, 12, 29, 34)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -60, DateTime(1999, 7, 6, 12, 29, 33)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -61, DateTime(1999, 7, 6, 12, 29, 32)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -1833, DateTime(1999, 7, 6, 12, 0, 0)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -1834, DateTime(1999, 7, 6, 11, 59, 59)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -3600, DateTime(1999, 7, 6, 11, 30, 33)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -3601, DateTime(1999, 7, 6, 11, 30, 32)); testDT(DateTime(1999, 7, 6, 12, 30, 33), -5134, DateTime(1999, 7, 6, 11, 4, 59)); testDT(DateTime(1999, 7, 6, 23, 0, 0), -432_123, DateTime(1999, 7, 1, 22, 57, 57)); testDT(DateTime(1999, 7, 6, 12, 30, 0), 1, DateTime(1999, 7, 6, 12, 30, 1)); testDT(DateTime(1999, 7, 6, 12, 30, 0), 0, DateTime(1999, 7, 6, 12, 30, 0)); testDT(DateTime(1999, 7, 6, 12, 30, 0), -1, DateTime(1999, 7, 6, 12, 29, 59)); testDT(DateTime(1999, 7, 6, 12, 0, 0), 1, DateTime(1999, 7, 6, 12, 0, 1)); testDT(DateTime(1999, 7, 6, 12, 0, 0), 0, DateTime(1999, 7, 6, 12, 0, 0)); testDT(DateTime(1999, 7, 6, 12, 0, 0), -1, DateTime(1999, 7, 6, 11, 59, 59)); testDT(DateTime(1999, 7, 6, 0, 0, 0), 1, DateTime(1999, 7, 6, 0, 0, 1)); testDT(DateTime(1999, 7, 6, 0, 0, 0), 0, DateTime(1999, 7, 6, 0, 0, 0)); testDT(DateTime(1999, 7, 6, 0, 0, 0), -1, DateTime(1999, 7, 5, 23, 59, 59)); testDT(DateTime(1999, 7, 5, 23, 59, 59), 1, DateTime(1999, 7, 6, 0, 0, 0)); testDT(DateTime(1999, 7, 5, 23, 59, 59), 0, DateTime(1999, 7, 5, 23, 59, 59)); testDT(DateTime(1999, 7, 5, 23, 59, 59), -1, DateTime(1999, 7, 5, 23, 59, 58)); testDT(DateTime(1998, 12, 31, 23, 59, 59), 1, DateTime(1999, 1, 1, 0, 0, 0)); testDT(DateTime(1998, 12, 31, 23, 59, 59), 0, DateTime(1998, 12, 31, 23, 59, 59)); testDT(DateTime(1998, 12, 31, 23, 59, 59), -1, DateTime(1998, 12, 31, 23, 59, 58)); testDT(DateTime(1998, 1, 1, 0, 0, 0), 1, DateTime(1998, 1, 1, 0, 0, 1)); testDT(DateTime(1998, 1, 1, 0, 0, 0), 0, DateTime(1998, 1, 1, 0, 0, 0)); testDT(DateTime(1998, 1, 1, 0, 0, 0), -1, DateTime(1997, 12, 31, 23, 59, 59)); //Test B.C. testDT(DateTime(-1999, 7, 6, 12, 30, 33), 0, DateTime(-1999, 7, 6, 12, 30, 33)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 1, DateTime(-1999, 7, 6, 12, 30, 34)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 2, DateTime(-1999, 7, 6, 12, 30, 35)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 3, DateTime(-1999, 7, 6, 12, 30, 36)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 4, DateTime(-1999, 7, 6, 12, 30, 37)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 5, DateTime(-1999, 7, 6, 12, 30, 38)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 10, DateTime(-1999, 7, 6, 12, 30, 43)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 15, DateTime(-1999, 7, 6, 12, 30, 48)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 26, DateTime(-1999, 7, 6, 12, 30, 59)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 27, DateTime(-1999, 7, 6, 12, 31, 0)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 30, DateTime(-1999, 7, 6, 12, 31, 3)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 59, DateTime(-1999, 7, 6, 12, 31, 32)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 60, DateTime(-1999, 7, 6, 12, 31, 33)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 61, DateTime(-1999, 7, 6, 12, 31, 34)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 1766, DateTime(-1999, 7, 6, 12, 59, 59)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 1767, DateTime(-1999, 7, 6, 13, 0, 0)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 1768, DateTime(-1999, 7, 6, 13, 0, 1)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 2007, DateTime(-1999, 7, 6, 13, 4, 0)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 3599, DateTime(-1999, 7, 6, 13, 30, 32)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 3600, DateTime(-1999, 7, 6, 13, 30, 33)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 3601, DateTime(-1999, 7, 6, 13, 30, 34)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), 7200, DateTime(-1999, 7, 6, 14, 30, 33)); testDT(DateTime(-1999, 7, 6, 23, 0, 0), 432_123, DateTime(-1999, 7, 11, 23, 2, 3)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -1, DateTime(-1999, 7, 6, 12, 30, 32)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -2, DateTime(-1999, 7, 6, 12, 30, 31)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -3, DateTime(-1999, 7, 6, 12, 30, 30)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -4, DateTime(-1999, 7, 6, 12, 30, 29)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -5, DateTime(-1999, 7, 6, 12, 30, 28)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -10, DateTime(-1999, 7, 6, 12, 30, 23)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -15, DateTime(-1999, 7, 6, 12, 30, 18)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -33, DateTime(-1999, 7, 6, 12, 30, 0)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -34, DateTime(-1999, 7, 6, 12, 29, 59)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -35, DateTime(-1999, 7, 6, 12, 29, 58)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -59, DateTime(-1999, 7, 6, 12, 29, 34)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -60, DateTime(-1999, 7, 6, 12, 29, 33)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -61, DateTime(-1999, 7, 6, 12, 29, 32)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -1833, DateTime(-1999, 7, 6, 12, 0, 0)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -1834, DateTime(-1999, 7, 6, 11, 59, 59)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -3600, DateTime(-1999, 7, 6, 11, 30, 33)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -3601, DateTime(-1999, 7, 6, 11, 30, 32)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -5134, DateTime(-1999, 7, 6, 11, 4, 59)); testDT(DateTime(-1999, 7, 6, 12, 30, 33), -7200, DateTime(-1999, 7, 6, 10, 30, 33)); testDT(DateTime(-1999, 7, 6, 23, 0, 0), -432_123, DateTime(-1999, 7, 1, 22, 57, 57)); testDT(DateTime(-1999, 7, 6, 12, 30, 0), 1, DateTime(-1999, 7, 6, 12, 30, 1)); testDT(DateTime(-1999, 7, 6, 12, 30, 0), 0, DateTime(-1999, 7, 6, 12, 30, 0)); testDT(DateTime(-1999, 7, 6, 12, 30, 0), -1, DateTime(-1999, 7, 6, 12, 29, 59)); testDT(DateTime(-1999, 7, 6, 12, 0, 0), 1, DateTime(-1999, 7, 6, 12, 0, 1)); testDT(DateTime(-1999, 7, 6, 12, 0, 0), 0, DateTime(-1999, 7, 6, 12, 0, 0)); testDT(DateTime(-1999, 7, 6, 12, 0, 0), -1, DateTime(-1999, 7, 6, 11, 59, 59)); testDT(DateTime(-1999, 7, 6, 0, 0, 0), 1, DateTime(-1999, 7, 6, 0, 0, 1)); testDT(DateTime(-1999, 7, 6, 0, 0, 0), 0, DateTime(-1999, 7, 6, 0, 0, 0)); testDT(DateTime(-1999, 7, 6, 0, 0, 0), -1, DateTime(-1999, 7, 5, 23, 59, 59)); testDT(DateTime(-1999, 7, 5, 23, 59, 59), 1, DateTime(-1999, 7, 6, 0, 0, 0)); testDT(DateTime(-1999, 7, 5, 23, 59, 59), 0, DateTime(-1999, 7, 5, 23, 59, 59)); testDT(DateTime(-1999, 7, 5, 23, 59, 59), -1, DateTime(-1999, 7, 5, 23, 59, 58)); testDT(DateTime(-2000, 12, 31, 23, 59, 59), 1, DateTime(-1999, 1, 1, 0, 0, 0)); testDT(DateTime(-2000, 12, 31, 23, 59, 59), 0, DateTime(-2000, 12, 31, 23, 59, 59)); testDT(DateTime(-2000, 12, 31, 23, 59, 59), -1, DateTime(-2000, 12, 31, 23, 59, 58)); testDT(DateTime(-2000, 1, 1, 0, 0, 0), 1, DateTime(-2000, 1, 1, 0, 0, 1)); testDT(DateTime(-2000, 1, 1, 0, 0, 0), 0, DateTime(-2000, 1, 1, 0, 0, 0)); testDT(DateTime(-2000, 1, 1, 0, 0, 0), -1, DateTime(-2001, 12, 31, 23, 59, 59)); //Test Both testDT(DateTime(1, 1, 1, 0, 0, 0), -1, DateTime(0, 12, 31, 23, 59, 59)); testDT(DateTime(0, 12, 31, 23, 59, 59), 1, DateTime(1, 1, 1, 0, 0, 0)); testDT(DateTime(0, 1, 1, 0, 0, 0), -1, DateTime(-1, 12, 31, 23, 59, 59)); testDT(DateTime(-1, 12, 31, 23, 59, 59), 1, DateTime(0, 1, 1, 0, 0, 0)); testDT(DateTime(-1, 1, 1, 11, 30, 33), 63_165_600L, DateTime(1, 1, 1, 13, 30, 33)); testDT(DateTime(1, 1, 1, 13, 30, 33), -63_165_600L, DateTime(-1, 1, 1, 11, 30, 33)); testDT(DateTime(-1, 1, 1, 11, 30, 33), 63_165_617L, DateTime(1, 1, 1, 13, 30, 50)); testDT(DateTime(1, 1, 1, 13, 30, 50), -63_165_617L, DateTime(-1, 1, 1, 11, 30, 33)); const cdt = DateTime(1999, 7, 6, 12, 30, 33); immutable idt = DateTime(1999, 7, 6, 12, 30, 33); static assert(!__traits(compiles, cdt.addSeconds(4))); static assert(!__traits(compiles, idt.addSeconds(4))); } } Date _date; TimeOfDay _tod; } //============================================================================== // Section with intervals. //============================================================================== /++ Represents an interval of time. An $(D Interval) has a starting point and an end point. The interval of time is therefore the time starting at the starting point up to, but not including, the end point. e.g. $(BOOKTABLE, $(TR $(TD [January 5th, 2010 - March 10th, 2010$(RPAREN))) $(TR $(TD [05:00:30 - 12:00:00$(RPAREN))) $(TR $(TD [1982-01-04T08:59:00 - 2010-07-04T12:00:00$(RPAREN))) ) A range can be obtained from an $(D Interval), allowing iteration over that interval, with the exact time points which are iterated over depending on the function which generates the range. +/ struct Interval(TP) { public: /++ Params: begin = The time point which begins the interval. end = The time point which ends (but is not included in) the interval. Throws: $(D DateTimeException) if $(D_PARAM end) is before $(D_PARAM begin). Examples: -------------------- Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)); -------------------- +/ this(U)(in TP begin, in U end) pure if(is(Unqual!TP == Unqual!U)) { if(!_valid(begin, end)) throw new DateTimeException("Arguments would result in an invalid Interval."); _begin = cast(TP)begin; _end = cast(TP)end; } /++ Params: begin = The time point which begins the interval. duration = The duration from the starting point to the end point. Throws: $(D DateTimeException) if the resulting $(D end) is before $(D begin). Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), dur!"years"(3)) == Interval!Date(Date(1996, 1, 2), Date(1999, 1, 2))); -------------------- +/ this(D)(in TP begin, in D duration) pure if(__traits(compiles, begin + duration)) { _begin = cast(TP)begin; _end = begin + duration; if(!_valid(_begin, _end)) throw new DateTimeException("Arguments would result in an invalid Interval."); } /++ Params: rhs = The $(D Interval) to assign to this one. +/ /+ref+/ Interval opAssign(const ref Interval rhs) pure nothrow { _begin = cast(TP)rhs._begin; _end = cast(TP)rhs._end; return this; } /++ Params: rhs = The $(D Interval) to assign to this one. +/ /+ref+/ Interval opAssign(Interval rhs) pure nothrow { _begin = cast(TP)rhs._begin; _end = cast(TP)rhs._end; return this; } /++ The starting point of the interval. It is included in the interval. Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).begin == Date(1996, 1, 2)); -------------------- +/ @property TP begin() const pure nothrow { return cast(TP)_begin; } /++ The starting point of the interval. It is included in the interval. Params: timePoint = The time point to set $(D begin) to. Throws: $(D DateTimeException) if the resulting interval would be invalid. +/ @property void begin(TP timePoint) pure { if(!_valid(timePoint, _end)) throw new DateTimeException("Arguments would result in an invalid Interval."); _begin = timePoint; } /++ The end point of the interval. It is excluded from the interval. Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).end == Date(2012, 3, 1)); -------------------- +/ @property TP end() const pure nothrow { return cast(TP)_end; } /++ The end point of the interval. It is excluded from the interval. Params: timePoint = The time point to set end to. Throws: $(D DateTimeException) if the resulting interval would be invalid. +/ @property void end(TP timePoint) pure { if(!_valid(_begin, timePoint)) throw new DateTimeException("Arguments would result in an invalid Interval."); _end = timePoint; } /++ Returns the duration between $(D begin) and $(D end). Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).length == dur!"days"(5903)); -------------------- +/ @property typeof(end - begin) length() const pure nothrow { return _end - _begin; } /++ Whether the interval's length is 0, that is, whether $(D begin == end). Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(1996, 1, 2)).empty); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).empty); -------------------- +/ @property bool empty() const pure nothrow { return _begin == _end; } /++ Whether the given time point is within this interval. Params: timePoint = The time point to check for inclusion in this interval. Throws: $(D DateTimeException) if this interval is empty. Examples: -------------------- assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains( Date(1994, 12, 24))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains( Date(2000, 1, 5))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains( Date(2012, 3, 1))); -------------------- +/ bool contains(in TP timePoint) const pure { _enforceNotEmpty(); return timePoint >= _begin && timePoint < _end; } /++ Whether the given interval is completely within this interval. Params: interval = The interval to check for inclusion in this interval. Throws: $(D DateTimeException) if either interval is empty. Examples: -------------------- assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains( Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains( Interval!Date(Date(1998, 2, 28), Date(2013, 5, 1)))); -------------------- +/ bool contains(in Interval interval) const pure { _enforceNotEmpty(); interval._enforceNotEmpty(); return interval._begin >= _begin && interval._begin < _end && interval._end <= _end; } /++ Whether the given interval is completely within this interval. Always returns false (unless this interval is empty), because an interval going to positive infinity can never be contained in a finite interval. Params: interval = The interval to check for inclusion in this interval. Throws: $(D DateTimeException) if this interval is empty. Examples: -------------------- assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains( PosInfInterval!Date(Date(1999, 5, 4)))); -------------------- +/ bool contains(in PosInfInterval!TP interval) const pure { _enforceNotEmpty(); return false; } /++ Whether the given interval is completely within this interval. Always returns false (unless this interval is empty), because an interval beginning at negative infinity can never be contained in a finite interval. Params: interval = The interval to check for inclusion in this interval. Throws: $(D DateTimeException) if this interval is empty. Examples: -------------------- assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains( NegInfInterval!Date(Date(1996, 5, 4)))); -------------------- +/ bool contains(in NegInfInterval!TP interval) const pure { _enforceNotEmpty(); return false; } /++ Whether this interval is before the given time point. Params: timePoint = The time point to check whether this interval is before it. Throws: $(D DateTimeException) if this interval is empty. Examples: -------------------- assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore( Date(1994, 12, 24))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore( Date(2000, 1, 5))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore( Date(2012, 3, 1))); -------------------- +/ bool isBefore(in TP timePoint) const pure { _enforceNotEmpty(); return _end <= timePoint; } /++ Whether this interval is before the given interval and does not intersect with it. Params: interval = The interval to check for against this interval. Throws: $(D DateTimeException) if either interval is empty. Examples: -------------------- assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore( Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore( Interval!Date(Date(2012, 3, 1), Date(2013, 5, 1)))); -------------------- +/ bool isBefore(in Interval interval) const pure { _enforceNotEmpty(); interval._enforceNotEmpty(); return _end <= interval._begin; } /++ Whether this interval is before the given interval and does not intersect with it. Params: interval = The interval to check for against this interval. Throws: $(D DateTimeException) if this interval is empty. Examples: -------------------- assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore( PosInfInterval!Date(Date(1999, 5, 4)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore( PosInfInterval!Date(Date(2013, 3, 7)))); -------------------- +/ bool isBefore(in PosInfInterval!TP interval) const pure { _enforceNotEmpty(); return _end <= interval._begin; } /++ Whether this interval is before the given interval and does not intersect with it. Always returns false (unless this interval is empty) because a finite interval can never be before an interval beginning at negative infinity. Params: interval = The interval to check for against this interval. Throws: $(D DateTimeException) if this interval is empty. Examples: -------------------- assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore( NegInfInterval!Date(Date(1996, 5, 4)))); -------------------- +/ bool isBefore(in NegInfInterval!TP interval) const pure { _enforceNotEmpty(); return false; } /++ Whether this interval is after the given time point. Params: timePoint = The time point to check whether this interval is after it. Throws: $(D DateTimeException) if this interval is empty. Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( Date(1994, 12, 24))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( Date(2000, 1, 5))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( Date(2012, 3, 1))); -------------------- +/ bool isAfter(in TP timePoint) const pure { _enforceNotEmpty(); return timePoint < _begin; } /++ Whether this interval is after the given interval and does not intersect it. Params: interval = The interval to check against this interval. Throws: $(D DateTimeException) if either interval is empty. Examples: -------------------- assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2)))); -------------------- +/ bool isAfter(in Interval interval) const pure { _enforceNotEmpty(); interval._enforceNotEmpty(); return _begin >= interval._end; } /++ Whether this interval is after the given interval and does not intersect it. Always returns false (unless this interval is empty) because a finite interval can never be after an interval going to positive infinity. Params: interval = The interval to check against this interval. Throws: $(D DateTimeException) if this interval is empty. Examples: -------------------- assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( PosInfInterval!Date(Date(1999, 5, 4)))); -------------------- +/ bool isAfter(in PosInfInterval!TP interval) const pure { _enforceNotEmpty(); return false; } /++ Whether this interval is after the given interval and does not intersect it. Params: interval = The interval to check against this interval. Throws: $(D DateTimeException) if this interval is empty. Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( NegInfInterval!Date(Date(1996, 1, 2)))); -------------------- +/ bool isAfter(in NegInfInterval!TP interval) const pure { _enforceNotEmpty(); return _begin >= interval._end; } /++ Whether the given interval overlaps this interval. Params: interval = The interval to check for intersection with this interval. Throws: $(D DateTimeException) if either interval is empty. Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2)))); -------------------- +/ bool intersects(in Interval interval) const pure { _enforceNotEmpty(); interval._enforceNotEmpty(); return interval._begin < _end && interval._end > _begin; } /++ Whether the given interval overlaps this interval. Params: interval = The interval to check for intersection with this interval. Throws: $(D DateTimeException) if this interval is empty. Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( PosInfInterval!Date(Date(1999, 5, 4)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( PosInfInterval!Date(Date(2012, 3, 1)))); -------------------- +/ bool intersects(in PosInfInterval!TP interval) const pure { _enforceNotEmpty(); return _end > interval._begin; } /++ Whether the given interval overlaps this interval. Params: interval = The interval to check for intersection with this interval. Throws: $(D DateTimeException) if this interval is empty. Examples: -------------------- assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( NegInfInterval!Date(Date(1996, 1, 2)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( NegInfInterval!Date(Date(2000, 1, 2)))); -------------------- +/ bool intersects(in NegInfInterval!TP interval) const pure { _enforceNotEmpty(); return _begin < interval._end; } /++ Returns the intersection of two intervals Params: interval = The interval to intersect with this interval. Throws: $(D DateTimeException) if the two intervals do not intersect or if either interval is empty. Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == Interval!Date(Date(1996, 1 , 2), Date(2000, 8, 2))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))) == Interval!Date(Date(1999, 1 , 12), Date(2011, 9, 17))); -------------------- +/ Interval intersection(in Interval interval) const { enforce(this.intersects(interval), new DateTimeException(format("%s and %s do not intersect.", this, interval))); auto begin = _begin > interval._begin ? _begin : interval._begin; auto end = _end < interval._end ? _end : interval._end; return Interval(begin, end); } /++ Returns the intersection of two intervals Params: interval = The interval to intersect with this interval. Throws: $(D DateTimeException) if the two intervals do not intersect or if this interval is empty. Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( PosInfInterval!Date(Date(1990, 7, 6))) == Interval!Date(Date(1996, 1 , 2), Date(2012, 3, 1))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( PosInfInterval!Date(Date(1999, 1, 12))) == Interval!Date(Date(1999, 1 , 12), Date(2012, 3, 1))); -------------------- +/ Interval intersection(in PosInfInterval!TP interval) const { enforce(this.intersects(interval), new DateTimeException(format("%s and %s do not intersect.", this, interval))); return Interval(_begin > interval._begin ? _begin : interval._begin, _end); } /++ Returns the intersection of two intervals Params: interval = The interval to intersect with this interval. Throws: $(D DateTimeException) if the two intervals do not intersect or if this interval is empty. Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( NegInfInterval!Date(Date(1999, 7, 6))) == Interval!Date(Date(1996, 1 , 2), Date(1999, 7, 6))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( NegInfInterval!Date(Date(2013, 1, 12))) == Interval!Date(Date(1996, 1 , 2), Date(2012, 3, 1))); -------------------- +/ Interval intersection(in NegInfInterval!TP interval) const { enforce(this.intersects(interval), new DateTimeException(format("%s and %s do not intersect.", this, interval))); return Interval(_begin, _end < interval._end ? _end : interval._end); } /++ Whether the given interval is adjacent to this interval. Params: interval = The interval to check whether its adjecent to this interval. Throws: $(D DateTimeException) if either interval is empty. Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent( Interval!Date(Date(1990, 7, 6), Date(1996, 1, 2)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent( Interval!Date(Date(2012, 3, 1), Date(2013, 9, 17)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent( Interval!Date(Date(1989, 3, 1), Date(2012, 3, 1)))); -------------------- +/ bool isAdjacent(in Interval interval) const pure { _enforceNotEmpty(); interval._enforceNotEmpty(); return _begin == interval._end || _end == interval._begin; } /++ Whether the given interval is adjacent to this interval. Params: interval = The interval to check whether its adjecent to this interval. Throws: $(D DateTimeException) if this interval is empty. Examples: -------------------- assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent( PosInfInterval!Date(Date(1999, 5, 4)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent( PosInfInterval!Date(Date(2012, 3, 1)))); -------------------- +/ bool isAdjacent(in PosInfInterval!TP interval) const pure { _enforceNotEmpty(); return _end == interval._begin; } /++ Whether the given interval is adjacent to this interval. Params: interval = The interval to check whether its adjecent to this interval. Throws: $(D DateTimeException) if this interval is empty. Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent( NegInfInterval!Date(Date(1996, 1, 2)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent( NegInfInterval!Date(Date(2000, 1, 2)))); -------------------- +/ bool isAdjacent(in NegInfInterval!TP interval) const pure { _enforceNotEmpty(); return _begin == interval._end; } /++ Returns the union of two intervals Params: interval = The interval to merge with this interval. Throws: $(D DateTimeException) if the two intervals do not intersect and are not adjacent or if either interval is empty. Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == Interval!Date(Date(1990, 7 , 6), Date(2012, 3, 1))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge( Interval!Date(Date(2012, 3, 1), Date(2013, 5, 7))) == Interval!Date(Date(1996, 1 , 2), Date(2013, 5, 7))); -------------------- +/ Interval merge(in Interval interval) const { enforce(this.isAdjacent(interval) || this.intersects(interval), new DateTimeException(format("%s and %s are not adjacent and do not intersect.", this, interval))); auto begin = _begin < interval._begin ? _begin : interval._begin; auto end = _end > interval._end ? _end : interval._end; return Interval(begin, end); } /++ Returns the union of two intervals Params: interval = The interval to merge with this interval. Throws: $(D DateTimeException) if the two intervals do not intersect and are not adjacent or if this interval is empty. Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge( PosInfInterval!Date(Date(1990, 7, 6))) == PosInfInterval!Date(Date(1990, 7 , 6))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge( PosInfInterval!Date(Date(2012, 3, 1))) == PosInfInterval!Date(Date(1996, 1 , 2))); -------------------- +/ PosInfInterval!TP merge(in PosInfInterval!TP interval) const { enforce(this.isAdjacent(interval) || this.intersects(interval), new DateTimeException(format("%s and %s are not adjacent and do not intersect.", this, interval))); return PosInfInterval!TP(_begin < interval._begin ? _begin : interval._begin); } /++ Returns the union of two intervals Params: interval = The interval to merge with this interval. Throws: $(D DateTimeException) if the two intervals do not intersect and are not adjacent or if this interval is empty. Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge( NegInfInterval!Date(Date(1996, 1, 2))) == NegInfInterval!Date(Date(2012, 3 , 1))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge( NegInfInterval!Date(Date(2013, 1, 12))) == NegInfInterval!Date(Date(2013, 1 , 12))); -------------------- +/ NegInfInterval!TP merge(in NegInfInterval!TP interval) const { enforce(this.isAdjacent(interval) || this.intersects(interval), new DateTimeException(format("%s and %s are not adjacent and do not intersect.", this, interval))); return NegInfInterval!TP(_end > interval._end ? _end : interval._end); } /++ Returns an interval that covers from the earliest time point of two intervals up to (but not including) the latest time point of two intervals. Params: interval = The interval to create a span together with this interval. Throws: $(D DateTimeException) if either interval is empty. Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span( Interval!Date(Date(1990, 7, 6), Date(1991, 1, 8))) == Interval!Date(Date(1990, 7 , 6), Date(2012, 3, 1))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span( Interval!Date(Date(2012, 3, 1), Date(2013, 5, 7))) == Interval!Date(Date(1996, 1 , 2), Date(2013, 5, 7))); -------------------- +/ Interval span(in Interval interval) const pure { _enforceNotEmpty(); interval._enforceNotEmpty(); auto begin = _begin < interval._begin ? _begin : interval._begin; auto end = _end > interval._end ? _end : interval._end; return Interval(begin, end); } /++ Returns an interval that covers from the earliest time point of two intervals up to (but not including) the latest time point of two intervals. Params: interval = The interval to create a span together with this interval. Throws: $(D DateTimeException) if this interval is empty. Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span( PosInfInterval!Date(Date(1990, 7, 6))) == PosInfInterval!Date(Date(1990, 7 , 6))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span( PosInfInterval!Date(Date(2050, 1, 1))) == PosInfInterval!Date(Date(1996, 1 , 2))); -------------------- +/ PosInfInterval!TP span(in PosInfInterval!TP interval) const pure { _enforceNotEmpty(); return PosInfInterval!TP(_begin < interval._begin ? _begin : interval._begin); } /++ Returns an interval that covers from the earliest time point of two intervals up to (but not including) the latest time point of two intervals. Params: interval = The interval to create a span together with this interval. Throws: $(D DateTimeException) if this interval is empty. Examples: -------------------- assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span( NegInfInterval!Date(Date(1602, 5, 21))) == NegInfInterval!Date(Date(2012, 3 , 1))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span( NegInfInterval!Date(Date(2013, 1, 12))) == NegInfInterval!Date(Date(2013, 1 , 12))); -------------------- +/ NegInfInterval!TP span(in NegInfInterval!TP interval) const pure { _enforceNotEmpty(); return NegInfInterval!TP(_end > interval._end ? _end : interval._end); } /++ Shifts the interval forward or backwards in time by the given duration (a positive duration shifts the interval forward; a negative duration shifts it backward). Effectively, it does $(D begin += duration) and $(D end += duration). Params: duration = The duration to shift the interval by. Throws: $(D DateTimeException) this interval is empty or if the resulting interval would be invalid. Examples: -------------------- auto interval1 = Interval!Date(Date(1996, 1, 2), Date(2012, 4, 5)); auto interval2 = Interval!Date(Date(1996, 1, 2), Date(2012, 4, 5)); interval1.shift(dur!"days"(50)); assert(interval1 == Interval!Date(Date(1996, 2, 21), Date(2012, 5, 25))); interval2.shift(dur!"days"(-50)); assert(interval2 == Interval!Date(Date(1995, 11, 13), Date(2012, 2, 15))); -------------------- +/ void shift(D)(D duration) pure if(__traits(compiles, begin + duration)) { _enforceNotEmpty(); auto begin = _begin + duration; auto end = _end + duration; if(!_valid(begin, end)) throw new DateTimeException("Argument would result in an invalid Interval."); _begin = begin; _end = end; } static if(__traits(compiles, begin.add!"months"(1)) && __traits(compiles, begin.add!"years"(1))) { /++ Shifts the interval forward or backwards in time by the given number of years and/or months (a positive number of years and months shifts the interval forward; a negative number shifts it backward). It adds the years the given years and months to both begin and end. It effectively calls $(D add!"years"()) and then $(D add!"months"()) on begin and end with the given number of years and months. Params: years = The number of years to shift the interval by. months = The number of months to shift the interval by. allowOverflow = Whether the days should be allowed to overflow on $(D begin) and $(D end), causing their month to increment. Throws: $(D DateTimeException) if this interval is empty or if the resulting interval would be invalid. Examples: -------------------- auto interval1 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)); auto interval2 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)); interval1.shift(2); assert(interval1 == Interval!Date(Date(1998, 1, 2), Date(2014, 3, 1))); interval2.shift(-2); assert(interval2 == Interval!Date(Date(1994, 1, 2), Date(2010, 3, 1))); -------------------- +/ void shift(T)(T years, T months = 0, AllowDayOverflow allowOverflow = AllowDayOverflow.yes) if(isIntegral!T) { _enforceNotEmpty(); auto begin = _begin; auto end = _end; begin.add!"years"(years, allowOverflow); begin.add!"months"(months, allowOverflow); end.add!"years"(years, allowOverflow); end.add!"months"(months, allowOverflow); enforce(_valid(begin, end), new DateTimeException("Argument would result in an invalid Interval.")); _begin = begin; _end = end; } } /++ Expands the interval forwards and/or backwards in time. Effectively, it does $(D begin -= duration) and/or $(D end += duration). Whether it expands forwards and/or backwards in time is determined by $(D_PARAM dir). Params: duration = The duration to expand the interval by. dir = The direction in time to expand the interval. Throws: $(D DateTimeException) this interval is empty or if the resulting interval would be invalid. Examples: -------------------- auto interval1 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)); auto interval2 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)); interval1.expand(2); assert(interval1 == Interval!Date(Date(1994, 1, 2), Date(2014, 3, 1))); interval2.expand(-2); assert(interval2 == Interval!Date(Date(1998, 1, 2), Date(2010, 3, 1))); -------------------- +/ void expand(D)(D duration, Direction dir = Direction.both) pure if(__traits(compiles, begin + duration)) { _enforceNotEmpty(); switch(dir) { case Direction.both: { auto begin = _begin - duration; auto end = _end + duration; if(!_valid(begin, end)) throw new DateTimeException("Argument would result in an invalid Interval."); _begin = begin; _end = end; return; } case Direction.fwd: { auto end = _end + duration; if(!_valid(_begin, end)) throw new DateTimeException("Argument would result in an invalid Interval."); _end = end; return; } case Direction.bwd: { auto begin = _begin - duration; if(!_valid(begin, _end)) throw new DateTimeException("Argument would result in an invalid Interval."); _begin = begin; return; } default: assert(0, "Invalid Direction."); } } static if(__traits(compiles, begin.add!"months"(1)) && __traits(compiles, begin.add!"years"(1))) { /++ Expands the interval forwards and/or backwards in time. Effectively, it subtracts the given number of months/years from $(D begin) and adds them to $(D end). Whether it expands forwards and/or backwards in time is determined by $(D_PARAM dir). Params: years = The number of years to expand the interval by. months = The number of months to expand the interval by. allowOverflow = Whether the days should be allowed to overflow on $(D begin) and $(D end), causing their month to increment. Throws: $(D DateTimeException) if this interval is empty or if the resulting interval would be invalid. Examples: -------------------- auto interval1 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)); auto interval2 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)); interval1.expand(2); assert(interval1 == Interval!Date(Date(1994, 1, 2), Date(2014, 3, 1))); interval2.expand(-2); assert(interval2 == Interval!Date(Date(1998, 1, 2), Date(2010, 3, 1))); -------------------- +/ void expand(T)(T years, T months = 0, AllowDayOverflow allowOverflow = AllowDayOverflow.yes, Direction dir = Direction.both) if(isIntegral!T) { _enforceNotEmpty(); switch(dir) { case Direction.both: { auto begin = _begin; auto end = _end; begin.add!"years"(-years, allowOverflow); begin.add!"months"(-months, allowOverflow); end.add!"years"(years, allowOverflow); end.add!"months"(months, allowOverflow); enforce(_valid(begin, end), new DateTimeException("Argument would result in an invalid Interval.")); _begin = begin; _end = end; return; } case Direction.fwd: { auto end = _end; end.add!"years"(years, allowOverflow); end.add!"months"(months, allowOverflow); enforce(_valid(_begin, end), new DateTimeException("Argument would result in an invalid Interval.")); _end = end; return; } case Direction.bwd: { auto begin = _begin; begin.add!"years"(-years, allowOverflow); begin.add!"months"(-months, allowOverflow); enforce(_valid(begin, _end), new DateTimeException("Argument would result in an invalid Interval.")); _begin = begin; return; } default: assert(0, "Invalid Direction."); } } } /++ Returns a range which iterates forward over the interval, starting at $(D begin), using $(D_PARAM func) to generate each successive time point. The range's $(D front) is the interval's $(D begin). $(D_PARAM func) is used to generate the next $(D front) when $(D popFront) is called. If $(D_PARAM popFirst) is $(D PopFirst.yes), then $(D popFront) is called before the range is returned (so that $(D front) is a time point which $(D_PARAM func) would generate). If $(D_PARAM func) ever generates a time point less than or equal to the current $(D front) of the range, then a $(D DateTimeException) will be thrown. The range will be empty and iteration complete when $(D_PARAM func) generates a time point equal to or beyond the $(D end) of the interval. There are helper functions in this module which generate common delegates to pass to $(D fwdRange). Their documentation starts with "Range-generating function," making them easily searchable. Params: func = The function used to generate the time points of the range over the interval. popFirst = Whether $(D popFront) should be called on the range before returning it. Throws: $(D DateTimeException) if this interval is empty. Warning: $(D_PARAM func) must be logically pure. Ideally, $(D_PARAM func) would be a function pointer to a pure function, but forcing $(D_PARAM func) to be pure is far too restrictive to be useful, and in order to have the ease of use of having functions which generate functions to pass to $(D fwdRange), $(D_PARAM func) must be a delegate. If $(D_PARAM func) retains state which changes as it is called, then some algorithms will not work correctly, because the range's $(D save) will have failed to have really saved the range's state. To avoid such bugs, don't pass a delegate which is not logically pure to $(D fwdRange). If $(D_PARAM func) is given the same time point with two different calls, it must return the same result both times. Of course, none of the functions in this module have this problem, so it's only relevant if when creating a custom delegate. Examples: -------------------- auto interval = Interval!Date(Date(2010, 9, 1), Date(2010, 9, 9)); auto func = (in Date date) //For iterating over even-numbered days. { if((date.day & 1) == 0) return date + dur!"days"(2); return date + dur!"days"(1); }; auto range = interval.fwdRange(func); //An odd day. Using PopFirst.yes would have made this Date(2010, 9, 2). assert(range.front == Date(2010, 9, 1)); range.popFront(); assert(range.front == Date(2010, 9, 2)); range.popFront(); assert(range.front == Date(2010, 9, 4)); range.popFront(); assert(range.front == Date(2010, 9, 6)); range.popFront(); assert(range.front == Date(2010, 9, 8)); range.popFront(); assert(range.empty); -------------------- +/ IntervalRange!(TP, Direction.fwd) fwdRange(TP delegate(in TP) func, PopFirst popFirst = PopFirst.no) const { _enforceNotEmpty(); auto range = IntervalRange!(TP, Direction.fwd)(this, func); if(popFirst == PopFirst.yes) range.popFront(); return range; } /++ Returns a range which iterates backwards over the interval, starting at $(D end), using $(D_PARAM func) to generate each successive time point. The range's $(D front) is the interval's $(D end). $(D_PARAM func) is used to generate the next $(D front) when $(D popFront) is called. If $(D_PARAM popFirst) is $(D PopFirst.yes), then $(D popFront) is called before the range is returned (so that $(D front) is a time point which $(D_PARAM func) would generate). If $(D_PARAM func) ever generates a time point greater than or equal to the current $(D front) of the range, then a $(D DateTimeException) will be thrown. The range will be empty and iteration complete when $(D_PARAM func) generates a time point equal to or less than the $(D begin) of the interval. There are helper functions in this module which generate common delegates to pass to $(D bwdRange). Their documentation starts with "Range-generating function," making them easily searchable. Params: func = The function used to generate the time points of the range over the interval. popFirst = Whether $(D popFront) should be called on the range before returning it. Throws: $(D DateTimeException) if this interval is empty. Warning: $(D_PARAM func) must be logically pure. Ideally, $(D_PARAM func) would be a function pointer to a pure function, but forcing $(D_PARAM func) to be pure is far too restrictive to be useful, and in order to have the ease of use of having functions which generate functions to pass to $(D fwdRange), $(D_PARAM func) must be a delegate. If $(D_PARAM func) retains state which changes as it is called, then some algorithms will not work correctly, because the range's $(D save) will have failed to have really saved the range's state. To avoid such bugs, don't pass a delegate which is not logically pure to $(D fwdRange). If $(D_PARAM func) is given the same time point with two different calls, it must return the same result both times. Of course, none of the functions in this module have this problem, so it's only relevant for custom delegates. Examples: -------------------- auto interval = Interval!Date(Date(2010, 9, 1), Date(2010, 9, 9)); auto func = (in Date date) //For iterating over even-numbered days. { if((date.day & 1) == 0) return date - dur!"days"(2); return date - dur!"days"(1); }; auto range = interval.bwdRange(func); //An odd day. Using PopFirst.yes would have made this Date(2010, 9, 8). assert(range.front == Date(2010, 9, 9)); range.popFront(); assert(range.front == Date(2010, 9, 8)); range.popFront(); assert(range.front == Date(2010, 9, 6)); range.popFront(); assert(range.front == Date(2010, 9, 4)); range.popFront(); assert(range.front == Date(2010, 9, 2)); range.popFront(); assert(range.empty); -------------------- +/ IntervalRange!(TP, Direction.bwd) bwdRange(TP delegate(in TP) func, PopFirst popFirst = PopFirst.no) const { _enforceNotEmpty(); auto range = IntervalRange!(TP, Direction.bwd)(this, func); if(popFirst == PopFirst.yes) range.popFront(); return range; } /+ Converts this interval to a string. +/ //Due to bug http://d.puremagic.com/issues/show_bug.cgi?id=3715 , we can't //have versions of toString() with extra modifiers, so we define one version //with modifiers and one without. string toString() { return _toStringImpl(); } /++ Converts this interval to a string. +/ //Due to bug http://d.puremagic.com/issues/show_bug.cgi?id=3715 , we can't //have versions of toString() with extra modifiers, so we define one version //with modifiers and one without. string toString() const nothrow { return _toStringImpl(); } private: /+ Since we have two versions of toString, we have _toStringImpl so that they can share implementations. +/ string _toStringImpl() const nothrow { try return format("[%s - %s)", _begin, _end); catch(Exception e) assert(0, "format() threw."); } /+ Throws: $(D DateTimeException) if this interval is empty. +/ void _enforceNotEmpty(size_t line = __LINE__) const pure { if(empty) throw new DateTimeException("Invalid operation for an empty Interval.", __FILE__, line); } /+ Whether the given values form a valid time interval. Params: begin = The starting point of the interval. end = The end point of the interval. +/ static bool _valid(in TP begin, in TP end) pure nothrow { return begin <= end; } pure invariant() { assert(_valid(_begin, _end), "Invariant Failure: begin is not before or equal to end."); } TP _begin; TP _end; } //Test Interval's constructors. unittest { version(testStdDateTime) { assertThrown!DateTimeException(Interval!Date(Date(2010, 1, 1), Date(1, 1, 1))); Interval!Date(Date.init, Date.init); Interval!TimeOfDay(TimeOfDay.init, TimeOfDay.init); Interval!DateTime(DateTime.init, DateTime.init); Interval!SysTime(SysTime(0), SysTime(0)); Interval!DateTime(DateTime.init, dur!"days"(7)); //Verify Examples. Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)); assert(Interval!Date(Date(1996, 1, 2), dur!"weeks"(3)) == Interval!Date(Date(1996, 1, 2), Date(1996, 1, 23))); assert(Interval!Date(Date(1996, 1, 2), dur!"days"(3)) == Interval!Date(Date(1996, 1, 2), Date(1996, 1, 5))); assert(Interval!DateTime(DateTime(1996, 1, 2, 12, 0, 0), dur!"hours"(3)) == Interval!DateTime(DateTime(1996, 1, 2, 12, 0, 0), DateTime(1996, 1, 2, 15, 0, 0))); assert(Interval!DateTime(DateTime(1996, 1, 2, 12, 0, 0), dur!"minutes"(3)) == Interval!DateTime(DateTime(1996, 1, 2, 12, 0, 0), DateTime(1996, 1, 2, 12, 3, 0))); assert(Interval!DateTime(DateTime(1996, 1, 2, 12, 0, 0), dur!"seconds"(3)) == Interval!DateTime(DateTime(1996, 1, 2, 12, 0, 0), DateTime(1996, 1, 2, 12, 0, 3))); assert(Interval!DateTime(DateTime(1996, 1, 2, 12, 0, 0), dur!"msecs"(3000)) == Interval!DateTime(DateTime(1996, 1, 2, 12, 0, 0), DateTime(1996, 1, 2, 12, 0, 3))); } } //Test Interval's begin. unittest { version(testStdDateTime) { _assertPred!"=="(Interval!Date(Date(1, 1, 1), Date(2010, 1, 1)).begin, Date(1, 1, 1)); _assertPred!"=="(Interval!Date(Date(2010, 1, 1), Date(2010, 1, 1)).begin, Date(2010, 1, 1)); _assertPred!"=="(Interval!Date(Date(1997, 12, 31), Date(1998, 1, 1)).begin, Date(1997, 12, 31)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static assert(__traits(compiles, cInterval.begin)); static assert(__traits(compiles, iInterval.begin)); //Verify Examples. assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).begin == Date(1996, 1, 2)); } } //Test Interval's end. unittest { version(testStdDateTime) { _assertPred!"=="(Interval!Date(Date(1, 1, 1), Date(2010, 1, 1)).end, Date(2010, 1, 1)); _assertPred!"=="(Interval!Date(Date(2010, 1, 1), Date(2010, 1, 1)).end, Date(2010, 1, 1)); _assertPred!"=="(Interval!Date(Date(1997, 12, 31), Date(1998, 1, 1)).end, Date(1998, 1, 1)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static assert(__traits(compiles, cInterval.end)); static assert(__traits(compiles, iInterval.end)); //Verify Examples. assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).end == Date(2012, 3, 1)); } } //Test Interval's length. unittest { version(testStdDateTime) { _assertPred!"=="(Interval!Date(Date(2010, 1, 1), Date(2010, 1, 1)).length, dur!"days"(0)); _assertPred!"=="(Interval!Date(Date(2010, 1, 1), Date(2010, 4, 1)).length, dur!"days"(90)); _assertPred!"=="(Interval!TimeOfDay(TimeOfDay(0, 30, 0), TimeOfDay(12, 22, 7)).length, dur!"seconds"(42_727)); _assertPred!"=="(Interval!DateTime(DateTime(2010, 1, 1, 0, 30, 0), DateTime(2010, 1, 2, 12, 22, 7)).length, dur!"seconds"(129_127)); _assertPred!"=="(Interval!SysTime(SysTime(DateTime(2010, 1, 1, 0, 30, 0)), SysTime(DateTime(2010, 1, 2, 12, 22, 7))).length, dur!"seconds"(129_127)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static assert(__traits(compiles, cInterval.length)); static assert(__traits(compiles, iInterval.length)); //Verify Examples. assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).length == dur!"days"(5903)); } } //Test Interval's empty. unittest { version(testStdDateTime) { assert(Interval!Date(Date(2010, 1, 1), Date(2010, 1, 1)).empty); assert(!Interval!Date(Date(2010, 1, 1), Date(2010, 4, 1)).empty); assert(!Interval!TimeOfDay(TimeOfDay(0, 30, 0), TimeOfDay(12, 22, 7)).empty); assert(!Interval!DateTime(DateTime(2010, 1, 1, 0, 30, 0), DateTime(2010, 1, 2, 12, 22, 7)).empty); assert(!Interval!SysTime(SysTime(DateTime(2010, 1, 1, 0, 30, 0)), SysTime(DateTime(2010, 1, 2, 12, 22, 7))).empty); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static assert(__traits(compiles, cInterval.empty)); static assert(__traits(compiles, iInterval.empty)); //Verify Examples. assert(Interval!Date(Date(1996, 1, 2), Date(1996, 1, 2)).empty); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).empty); } } //Test Interval's contains(time point). unittest { version(testStdDateTime) { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); assertThrown!DateTimeException(Interval!Date(Date(2010, 7, 4), dur!"days"(0)).contains(Date(2010, 7, 4))); assert(!interval.contains(Date(2009, 7, 4))); assert(!interval.contains(Date(2010, 7, 3))); assert(interval.contains(Date(2010, 7, 4))); assert(interval.contains(Date(2010, 7, 5))); assert(interval.contains(Date(2011, 7, 1))); assert(interval.contains(Date(2012, 1, 6))); assert(!interval.contains(Date(2012, 1, 7))); assert(!interval.contains(Date(2012, 1, 8))); assert(!interval.contains(Date(2013, 1, 7))); const cdate = Date(2010, 7, 6); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static assert(__traits(compiles, interval.contains(cdate))); static assert(__traits(compiles, cInterval.contains(cdate))); static assert(__traits(compiles, iInterval.contains(cdate))); //Verify Examples. assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains(Date(1994, 12, 24))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains(Date(2000, 1, 5))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains(Date(2012, 3, 1))); } } //Test Interval's contains(Interval). unittest { version(testStdDateTime) { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); assertThrown!DateTimeException(interval.contains(Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assertThrown!DateTimeException(Interval!Date(Date(2010, 7, 4), dur!"days"(0)).contains(interval)); assertThrown!DateTimeException(Interval!Date(Date(2010, 7, 4), dur!"days"(0)).contains(Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assert(interval.contains(interval)); assert(!interval.contains(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assert(!interval.contains(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)))); assert(!interval.contains(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)))); assert(!interval.contains(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)))); assert(!interval.contains(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)))); assert(!interval.contains(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)))); assert(interval.contains(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)))); assert(interval.contains(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)))); assert(interval.contains(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)))); assert(!interval.contains(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)))); assert(!interval.contains(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)))); assert(!interval.contains(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assert(!Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)).contains(interval)); assert(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)).contains(interval)); assert(!Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)).contains(interval)); assert(!Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)).contains(interval)); assert(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)).contains(interval)); assert(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)).contains(interval)); assert(!Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)).contains(interval)); assert(!Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)).contains(interval)); assert(!Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)).contains(interval)); assert(!Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)).contains(interval)); assert(!Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)).contains(interval)); assert(!Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)).contains(interval)); assert(!interval.contains(PosInfInterval!Date(Date(2010, 7, 3)))); assert(!interval.contains(PosInfInterval!Date(Date(2010, 7, 4)))); assert(!interval.contains(PosInfInterval!Date(Date(2010, 7, 5)))); assert(!interval.contains(PosInfInterval!Date(Date(2012, 1, 6)))); assert(!interval.contains(PosInfInterval!Date(Date(2012, 1, 7)))); assert(!interval.contains(PosInfInterval!Date(Date(2012, 1, 8)))); assert(!interval.contains(NegInfInterval!Date(Date(2010, 7, 3)))); assert(!interval.contains(NegInfInterval!Date(Date(2010, 7, 4)))); assert(!interval.contains(NegInfInterval!Date(Date(2010, 7, 5)))); assert(!interval.contains(NegInfInterval!Date(Date(2012, 1, 6)))); assert(!interval.contains(NegInfInterval!Date(Date(2012, 1, 7)))); assert(!interval.contains(NegInfInterval!Date(Date(2012, 1, 8)))); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, interval.contains(interval))); static assert(__traits(compiles, interval.contains(cInterval))); static assert(__traits(compiles, interval.contains(iInterval))); static assert(__traits(compiles, interval.contains(posInfInterval))); static assert(__traits(compiles, interval.contains(cPosInfInterval))); static assert(__traits(compiles, interval.contains(iPosInfInterval))); static assert(__traits(compiles, interval.contains(negInfInterval))); static assert(__traits(compiles, interval.contains(cNegInfInterval))); static assert(__traits(compiles, interval.contains(iNegInfInterval))); static assert(__traits(compiles, cInterval.contains(interval))); static assert(__traits(compiles, cInterval.contains(cInterval))); static assert(__traits(compiles, cInterval.contains(iInterval))); static assert(__traits(compiles, cInterval.contains(posInfInterval))); static assert(__traits(compiles, cInterval.contains(cPosInfInterval))); static assert(__traits(compiles, cInterval.contains(iPosInfInterval))); static assert(__traits(compiles, cInterval.contains(negInfInterval))); static assert(__traits(compiles, cInterval.contains(cNegInfInterval))); static assert(__traits(compiles, cInterval.contains(iNegInfInterval))); static assert(__traits(compiles, iInterval.contains(interval))); static assert(__traits(compiles, iInterval.contains(cInterval))); static assert(__traits(compiles, iInterval.contains(iInterval))); static assert(__traits(compiles, iInterval.contains(posInfInterval))); static assert(__traits(compiles, iInterval.contains(cPosInfInterval))); static assert(__traits(compiles, iInterval.contains(iPosInfInterval))); static assert(__traits(compiles, iInterval.contains(negInfInterval))); static assert(__traits(compiles, iInterval.contains(cNegInfInterval))); static assert(__traits(compiles, iInterval.contains(iNegInfInterval))); //Verify Examples. assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains(Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains(Interval!Date(Date(1998, 2, 28), Date(2013, 5, 1)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains(PosInfInterval!Date(Date(1999, 5, 4)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).contains(NegInfInterval!Date(Date(1996, 5, 4)))); } } //Test Interval's isBefore(time point). unittest { version(testStdDateTime) { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); assertThrown!DateTimeException(Interval!Date(Date(2010, 7, 4), dur!"days"(0)).isBefore(Date(2010, 7, 4))); assert(!interval.isBefore(Date(2009, 7, 3))); assert(!interval.isBefore(Date(2010, 7, 3))); assert(!interval.isBefore(Date(2010, 7, 4))); assert(!interval.isBefore(Date(2010, 7, 5))); assert(!interval.isBefore(Date(2011, 7, 1))); assert(!interval.isBefore(Date(2012, 1, 6))); assert(interval.isBefore(Date(2012, 1, 7))); assert(interval.isBefore(Date(2012, 1, 8))); assert(interval.isBefore(Date(2013, 1, 7))); const cdate = Date(2010, 7, 6); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static assert(__traits(compiles, interval.isBefore(cdate))); static assert(__traits(compiles, cInterval.isBefore(cdate))); static assert(__traits(compiles, iInterval.isBefore(cdate))); //Verify Examples. assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(Date(1994, 12, 24))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(Date(2000, 1, 5))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(Date(2012, 3, 1))); } } //Test Interval's isBefore(Interval). unittest { version(testStdDateTime) { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); assertThrown!DateTimeException(interval.isBefore(Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assertThrown!DateTimeException(Interval!Date(Date(2010, 7, 4), dur!"days"(0)).isBefore(interval)); assertThrown!DateTimeException(Interval!Date(Date(2010, 7, 4), dur!"days"(0)).isBefore(Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assert(!interval.isBefore(interval)); assert(!interval.isBefore(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assert(!interval.isBefore(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)))); assert(!interval.isBefore(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)))); assert(!interval.isBefore(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)))); assert(!interval.isBefore(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)))); assert(!interval.isBefore(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)))); assert(!interval.isBefore(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)))); assert(!interval.isBefore(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)))); assert(!interval.isBefore(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)))); assert(!interval.isBefore(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)))); assert(interval.isBefore(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)))); assert(interval.isBefore(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assert(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)).isBefore(interval)); assert(!Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)).isBefore(interval)); assert(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)).isBefore(interval)); assert(!Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)).isBefore(interval)); assert(!Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)).isBefore(interval)); assert(!Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)).isBefore(interval)); assert(!Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)).isBefore(interval)); assert(!Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)).isBefore(interval)); assert(!Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)).isBefore(interval)); assert(!Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)).isBefore(interval)); assert(!Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)).isBefore(interval)); assert(!Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)).isBefore(interval)); assert(!interval.isBefore(PosInfInterval!Date(Date(2010, 7, 3)))); assert(!interval.isBefore(PosInfInterval!Date(Date(2010, 7, 4)))); assert(!interval.isBefore(PosInfInterval!Date(Date(2010, 7, 5)))); assert(!interval.isBefore(PosInfInterval!Date(Date(2012, 1, 6)))); assert(interval.isBefore(PosInfInterval!Date(Date(2012, 1, 7)))); assert(interval.isBefore(PosInfInterval!Date(Date(2012, 1, 8)))); assert(!interval.isBefore(NegInfInterval!Date(Date(2010, 7, 3)))); assert(!interval.isBefore(NegInfInterval!Date(Date(2010, 7, 4)))); assert(!interval.isBefore(NegInfInterval!Date(Date(2010, 7, 5)))); assert(!interval.isBefore(NegInfInterval!Date(Date(2012, 1, 6)))); assert(!interval.isBefore(NegInfInterval!Date(Date(2012, 1, 7)))); assert(!interval.isBefore(NegInfInterval!Date(Date(2012, 1, 8)))); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, interval.isBefore(interval))); static assert(__traits(compiles, interval.isBefore(cInterval))); static assert(__traits(compiles, interval.isBefore(iInterval))); static assert(__traits(compiles, interval.isBefore(posInfInterval))); static assert(__traits(compiles, interval.isBefore(cPosInfInterval))); static assert(__traits(compiles, interval.isBefore(iPosInfInterval))); static assert(__traits(compiles, interval.isBefore(negInfInterval))); static assert(__traits(compiles, interval.isBefore(cNegInfInterval))); static assert(__traits(compiles, interval.isBefore(iNegInfInterval))); static assert(__traits(compiles, cInterval.isBefore(interval))); static assert(__traits(compiles, cInterval.isBefore(cInterval))); static assert(__traits(compiles, cInterval.isBefore(iInterval))); static assert(__traits(compiles, cInterval.isBefore(posInfInterval))); static assert(__traits(compiles, cInterval.isBefore(cPosInfInterval))); static assert(__traits(compiles, cInterval.isBefore(iPosInfInterval))); static assert(__traits(compiles, cInterval.isBefore(negInfInterval))); static assert(__traits(compiles, cInterval.isBefore(cNegInfInterval))); static assert(__traits(compiles, cInterval.isBefore(iNegInfInterval))); static assert(__traits(compiles, iInterval.isBefore(interval))); static assert(__traits(compiles, iInterval.isBefore(cInterval))); static assert(__traits(compiles, iInterval.isBefore(iInterval))); static assert(__traits(compiles, iInterval.isBefore(posInfInterval))); static assert(__traits(compiles, iInterval.isBefore(cPosInfInterval))); static assert(__traits(compiles, iInterval.isBefore(iPosInfInterval))); static assert(__traits(compiles, iInterval.isBefore(negInfInterval))); static assert(__traits(compiles, iInterval.isBefore(cNegInfInterval))); static assert(__traits(compiles, iInterval.isBefore(iNegInfInterval))); //Verify Examples. assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(Interval!Date(Date(2012, 3, 1), Date(2013, 5, 1)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(PosInfInterval!Date(Date(1999, 5, 4)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(PosInfInterval!Date(Date(2013, 3, 7)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isBefore(NegInfInterval!Date(Date(1996, 5, 4)))); } } //Test Interval's isAfter(time point). unittest { version(testStdDateTime) { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); assertThrown!DateTimeException(Interval!Date(Date(2010, 7, 4), dur!"days"(0)).isAfter(Date(2010, 7, 4))); assert(interval.isAfter(Date(2009, 7, 4))); assert(interval.isAfter(Date(2010, 7, 3))); assert(!interval.isAfter(Date(2010, 7, 4))); assert(!interval.isAfter(Date(2010, 7, 5))); assert(!interval.isAfter(Date(2011, 7, 1))); assert(!interval.isAfter(Date(2012, 1, 6))); assert(!interval.isAfter(Date(2012, 1, 7))); assert(!interval.isAfter(Date(2012, 1, 8))); assert(!interval.isAfter(Date(2013, 1, 7))); const cdate = Date(2010, 7, 6); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static assert(__traits(compiles, interval.isAfter(cdate))); static assert(__traits(compiles, cInterval.isAfter(cdate))); static assert(__traits(compiles, iInterval.isAfter(cdate))); //Verify Examples. assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter(Date(1994, 12, 24))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter(Date(2000, 1, 5))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter(Date(2012, 3, 1))); } } //Test Interval's isAfter(Interval). unittest { version(testStdDateTime) { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); assertThrown!DateTimeException(interval.isAfter(Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assertThrown!DateTimeException(Interval!Date(Date(2010, 7, 4), dur!"days"(0)).isAfter(interval)); assertThrown!DateTimeException(Interval!Date(Date(2010, 7, 4), dur!"days"(0)).isAfter(Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assert(!interval.isAfter(interval)); assert(interval.isAfter(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assert(!interval.isAfter(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)))); assert(interval.isAfter(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)))); assert(!interval.isAfter(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)))); assert(!interval.isAfter(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)))); assert(!interval.isAfter(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)))); assert(!interval.isAfter(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)))); assert(!interval.isAfter(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)))); assert(!interval.isAfter(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)))); assert(!interval.isAfter(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)))); assert(!interval.isAfter(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)))); assert(!interval.isAfter(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assert(!Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)).isAfter(interval)); assert(!Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)).isAfter(interval)); assert(!Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)).isAfter(interval)); assert(!Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)).isAfter(interval)); assert(!Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)).isAfter(interval)); assert(!Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)).isAfter(interval)); assert(!Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)).isAfter(interval)); assert(!Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)).isAfter(interval)); assert(!Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)).isAfter(interval)); assert(!Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)).isAfter(interval)); assert(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)).isAfter(interval)); assert(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)).isAfter(interval)); assert(!interval.isAfter(PosInfInterval!Date(Date(2010, 7, 3)))); assert(!interval.isAfter(PosInfInterval!Date(Date(2010, 7, 4)))); assert(!interval.isAfter(PosInfInterval!Date(Date(2010, 7, 5)))); assert(!interval.isAfter(PosInfInterval!Date(Date(2012, 1, 6)))); assert(!interval.isAfter(PosInfInterval!Date(Date(2012, 1, 7)))); assert(!interval.isAfter(PosInfInterval!Date(Date(2012, 1, 8)))); assert(interval.isAfter(NegInfInterval!Date(Date(2010, 7, 3)))); assert(interval.isAfter(NegInfInterval!Date(Date(2010, 7, 4)))); assert(!interval.isAfter(NegInfInterval!Date(Date(2010, 7, 5)))); assert(!interval.isAfter(NegInfInterval!Date(Date(2012, 1, 6)))); assert(!interval.isAfter(NegInfInterval!Date(Date(2012, 1, 7)))); assert(!interval.isAfter(NegInfInterval!Date(Date(2012, 1, 8)))); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, interval.isAfter(interval))); static assert(__traits(compiles, interval.isAfter(cInterval))); static assert(__traits(compiles, interval.isAfter(iInterval))); static assert(__traits(compiles, interval.isAfter(posInfInterval))); static assert(__traits(compiles, interval.isAfter(cPosInfInterval))); static assert(__traits(compiles, interval.isAfter(iPosInfInterval))); static assert(__traits(compiles, interval.isAfter(negInfInterval))); static assert(__traits(compiles, interval.isAfter(cNegInfInterval))); static assert(__traits(compiles, interval.isAfter(iNegInfInterval))); static assert(__traits(compiles, cInterval.isAfter(interval))); static assert(__traits(compiles, cInterval.isAfter(cInterval))); static assert(__traits(compiles, cInterval.isAfter(iInterval))); static assert(__traits(compiles, cInterval.isAfter(posInfInterval))); static assert(__traits(compiles, cInterval.isAfter(cPosInfInterval))); static assert(__traits(compiles, cInterval.isAfter(iPosInfInterval))); static assert(__traits(compiles, cInterval.isAfter(negInfInterval))); static assert(__traits(compiles, cInterval.isAfter(cNegInfInterval))); static assert(__traits(compiles, cInterval.isAfter(iNegInfInterval))); static assert(__traits(compiles, iInterval.isAfter(interval))); static assert(__traits(compiles, iInterval.isAfter(cInterval))); static assert(__traits(compiles, iInterval.isAfter(iInterval))); static assert(__traits(compiles, iInterval.isAfter(posInfInterval))); static assert(__traits(compiles, iInterval.isAfter(cPosInfInterval))); static assert(__traits(compiles, iInterval.isAfter(iPosInfInterval))); static assert(__traits(compiles, iInterval.isAfter(negInfInterval))); static assert(__traits(compiles, iInterval.isAfter(cNegInfInterval))); static assert(__traits(compiles, iInterval.isAfter(iNegInfInterval))); //Verify Examples. assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter(Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter(Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter(PosInfInterval!Date(Date(1999, 5, 4)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter(NegInfInterval!Date(Date(1996, 1, 2)))); } } //Test Interval's intersects(). unittest { version(testStdDateTime) { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); assertThrown!DateTimeException(interval.intersects(Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assertThrown!DateTimeException(Interval!Date(Date(2010, 7, 4), dur!"days"(0)).intersects(interval)); assertThrown!DateTimeException(Interval!Date(Date(2010, 7, 4), dur!"days"(0)).intersects(Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assert(interval.intersects(interval)); assert(!interval.intersects(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assert(interval.intersects(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)))); assert(!interval.intersects(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)))); assert(interval.intersects(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)))); assert(interval.intersects(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)))); assert(interval.intersects(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)))); assert(interval.intersects(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)))); assert(interval.intersects(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)))); assert(interval.intersects(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)))); assert(interval.intersects(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)))); assert(!interval.intersects(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)))); assert(!interval.intersects(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assert(!Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)).intersects(interval)); assert(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)).intersects(interval)); assert(!Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)).intersects(interval)); assert(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)).intersects(interval)); assert(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)).intersects(interval)); assert(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)).intersects(interval)); assert(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)).intersects(interval)); assert(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)).intersects(interval)); assert(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)).intersects(interval)); assert(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)).intersects(interval)); assert(!Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)).intersects(interval)); assert(!Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)).intersects(interval)); assert(interval.intersects(PosInfInterval!Date(Date(2010, 7, 3)))); assert(interval.intersects(PosInfInterval!Date(Date(2010, 7, 4)))); assert(interval.intersects(PosInfInterval!Date(Date(2010, 7, 5)))); assert(interval.intersects(PosInfInterval!Date(Date(2012, 1, 6)))); assert(!interval.intersects(PosInfInterval!Date(Date(2012, 1, 7)))); assert(!interval.intersects(PosInfInterval!Date(Date(2012, 1, 8)))); assert(!interval.intersects(NegInfInterval!Date(Date(2010, 7, 3)))); assert(!interval.intersects(NegInfInterval!Date(Date(2010, 7, 4)))); assert(interval.intersects(NegInfInterval!Date(Date(2010, 7, 5)))); assert(interval.intersects(NegInfInterval!Date(Date(2012, 1, 6)))); assert(interval.intersects(NegInfInterval!Date(Date(2012, 1, 7)))); assert(interval.intersects(NegInfInterval!Date(Date(2012, 1, 8)))); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, interval.intersects(interval))); static assert(__traits(compiles, interval.intersects(cInterval))); static assert(__traits(compiles, interval.intersects(iInterval))); static assert(__traits(compiles, interval.intersects(posInfInterval))); static assert(__traits(compiles, interval.intersects(cPosInfInterval))); static assert(__traits(compiles, interval.intersects(iPosInfInterval))); static assert(__traits(compiles, interval.intersects(negInfInterval))); static assert(__traits(compiles, interval.intersects(cNegInfInterval))); static assert(__traits(compiles, interval.intersects(iNegInfInterval))); static assert(__traits(compiles, cInterval.intersects(interval))); static assert(__traits(compiles, cInterval.intersects(cInterval))); static assert(__traits(compiles, cInterval.intersects(iInterval))); static assert(__traits(compiles, cInterval.intersects(posInfInterval))); static assert(__traits(compiles, cInterval.intersects(cPosInfInterval))); static assert(__traits(compiles, cInterval.intersects(iPosInfInterval))); static assert(__traits(compiles, cInterval.intersects(negInfInterval))); static assert(__traits(compiles, cInterval.intersects(cNegInfInterval))); static assert(__traits(compiles, cInterval.intersects(iNegInfInterval))); static assert(__traits(compiles, iInterval.intersects(interval))); static assert(__traits(compiles, iInterval.intersects(cInterval))); static assert(__traits(compiles, iInterval.intersects(iInterval))); static assert(__traits(compiles, iInterval.intersects(posInfInterval))); static assert(__traits(compiles, iInterval.intersects(cPosInfInterval))); static assert(__traits(compiles, iInterval.intersects(iPosInfInterval))); static assert(__traits(compiles, iInterval.intersects(negInfInterval))); static assert(__traits(compiles, iInterval.intersects(cNegInfInterval))); static assert(__traits(compiles, iInterval.intersects(iNegInfInterval))); //Verify Examples. assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects(Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects(Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects(PosInfInterval!Date(Date(1999, 5, 4)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects(PosInfInterval!Date(Date(2012, 3, 1)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects(NegInfInterval!Date(Date(1996, 1, 2)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects(NegInfInterval!Date(Date(2000, 1, 2)))); } } //Test Interval's intersection(). unittest { version(testStdDateTime) { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); assertThrown!DateTimeException(interval.intersection(Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assertThrown!DateTimeException(Interval!Date(Date(2010, 7, 4), dur!"days"(0)).intersection(interval)); assertThrown!DateTimeException(Interval!Date(Date(2010, 7, 4), dur!"days"(0)).intersection(Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assertThrown!DateTimeException(interval.intersection(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assertThrown!DateTimeException(interval.intersection(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)))); assertThrown!DateTimeException(interval.intersection(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)))); assertThrown!DateTimeException(interval.intersection(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assertThrown!DateTimeException(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)).intersection(interval)); assertThrown!DateTimeException(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)).intersection(interval)); assertThrown!DateTimeException(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)).intersection(interval)); assertThrown!DateTimeException(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)).intersection(interval)); assertThrown!DateTimeException(interval.intersection(PosInfInterval!Date(Date(2012, 1, 7)))); assertThrown!DateTimeException(interval.intersection(PosInfInterval!Date(Date(2012, 1, 8)))); assertThrown!DateTimeException(interval.intersection(NegInfInterval!Date(Date(2010, 7, 3)))); assertThrown!DateTimeException(interval.intersection(NegInfInterval!Date(Date(2010, 7, 4)))); _assertPred!"=="(interval.intersection(interval), interval); _assertPred!"=="(interval.intersection(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(interval.intersection(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5))), Interval!Date(Date(2010, 7, 4), Date(2010, 7, 5))); _assertPred!"=="(interval.intersection(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(interval.intersection(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(interval.intersection(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6))), Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6))); _assertPred!"=="(interval.intersection(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7))), Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7))); _assertPred!"=="(interval.intersection(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7))), Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7))); _assertPred!"=="(interval.intersection(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8))), Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)).intersection(interval), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)).intersection(interval), Interval!Date(Date(2010, 7, 4), Date(2010, 7, 5))); _assertPred!"=="(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)).intersection(interval), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)).intersection(interval), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)).intersection(interval), Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6))); _assertPred!"=="(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)).intersection(interval), Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)).intersection(interval), Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)).intersection(interval), Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7))); _assertPred!"=="(interval.intersection(PosInfInterval!Date(Date(2010, 7, 3))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(interval.intersection(PosInfInterval!Date(Date(2010, 7, 4))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(interval.intersection(PosInfInterval!Date(Date(2010, 7, 5))), Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7))); _assertPred!"=="(interval.intersection(PosInfInterval!Date(Date(2012, 1, 6))), Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7))); _assertPred!"=="(interval.intersection(NegInfInterval!Date(Date(2010, 7, 5))), Interval!Date(Date(2010, 7, 4), Date(2010, 7, 5))); _assertPred!"=="(interval.intersection(NegInfInterval!Date(Date(2012, 1, 6))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 6))); _assertPred!"=="(interval.intersection(NegInfInterval!Date(Date(2012, 1, 7))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(interval.intersection(NegInfInterval!Date(Date(2012, 1, 8))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, interval.intersection(interval))); static assert(__traits(compiles, interval.intersection(cInterval))); static assert(__traits(compiles, interval.intersection(iInterval))); static assert(__traits(compiles, interval.intersection(posInfInterval))); static assert(__traits(compiles, interval.intersection(cPosInfInterval))); static assert(__traits(compiles, interval.intersection(iPosInfInterval))); static assert(__traits(compiles, interval.intersection(negInfInterval))); static assert(__traits(compiles, interval.intersection(cNegInfInterval))); static assert(__traits(compiles, interval.intersection(iNegInfInterval))); static assert(__traits(compiles, cInterval.intersection(interval))); static assert(__traits(compiles, cInterval.intersection(cInterval))); static assert(__traits(compiles, cInterval.intersection(iInterval))); static assert(__traits(compiles, cInterval.intersection(posInfInterval))); static assert(__traits(compiles, cInterval.intersection(cPosInfInterval))); static assert(__traits(compiles, cInterval.intersection(iPosInfInterval))); static assert(__traits(compiles, cInterval.intersection(negInfInterval))); static assert(__traits(compiles, cInterval.intersection(cNegInfInterval))); static assert(__traits(compiles, cInterval.intersection(iNegInfInterval))); static assert(__traits(compiles, iInterval.intersection(interval))); static assert(__traits(compiles, iInterval.intersection(cInterval))); static assert(__traits(compiles, iInterval.intersection(iInterval))); static assert(__traits(compiles, iInterval.intersection(posInfInterval))); static assert(__traits(compiles, iInterval.intersection(cPosInfInterval))); static assert(__traits(compiles, iInterval.intersection(iPosInfInterval))); static assert(__traits(compiles, iInterval.intersection(negInfInterval))); static assert(__traits(compiles, iInterval.intersection(cNegInfInterval))); static assert(__traits(compiles, iInterval.intersection(iNegInfInterval))); //Verify Examples. assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == Interval!Date(Date(1996, 1 , 2), Date(2000, 8, 2))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection(Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))) == Interval!Date(Date(1999, 1 , 12), Date(2011, 9, 17))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection(PosInfInterval!Date(Date(1990, 7, 6))) == Interval!Date(Date(1996, 1 , 2), Date(2012, 3, 1))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection(PosInfInterval!Date(Date(1999, 1, 12))) == Interval!Date(Date(1999, 1 , 12), Date(2012, 3, 1))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection(NegInfInterval!Date(Date(1999, 7, 6))) == Interval!Date(Date(1996, 1 , 2), Date(1999, 7, 6))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection(NegInfInterval!Date(Date(2013, 1, 12))) == Interval!Date(Date(1996, 1 , 2), Date(2012, 3, 1))); } } //Test Interval's isAdjacent(). unittest { version(testStdDateTime) { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static void testInterval(in Interval!Date interval1, in Interval!Date interval2) { interval1.isAdjacent(interval2); } assertThrown!DateTimeException(testInterval(interval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assertThrown!DateTimeException(testInterval(Interval!Date(Date(2010, 7, 4), dur!"days"(0)), interval)); assertThrown!DateTimeException(testInterval(Interval!Date(Date(2010, 7, 4), dur!"days"(0)), Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assert(!interval.isAdjacent(interval)); assert(!interval.isAdjacent(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assert(!interval.isAdjacent(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)))); assert(interval.isAdjacent(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)))); assert(!interval.isAdjacent(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)))); assert(!interval.isAdjacent(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)))); assert(!interval.isAdjacent(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)))); assert(!interval.isAdjacent(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)))); assert(!interval.isAdjacent(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)))); assert(!interval.isAdjacent(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)))); assert(!interval.isAdjacent(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)))); assert(interval.isAdjacent(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)))); assert(!interval.isAdjacent(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assert(!Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)).isAdjacent(interval)); assert(!Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)).isAdjacent(interval)); assert(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)).isAdjacent(interval)); assert(!Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)).isAdjacent(interval)); assert(!Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)).isAdjacent(interval)); assert(!Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)).isAdjacent(interval)); assert(!Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)).isAdjacent(interval)); assert(!Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)).isAdjacent(interval)); assert(!Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)).isAdjacent(interval)); assert(!Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)).isAdjacent(interval)); assert(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)).isAdjacent(interval)); assert(!Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)).isAdjacent(interval)); assert(!interval.isAdjacent(PosInfInterval!Date(Date(2010, 7, 3)))); assert(!interval.isAdjacent(PosInfInterval!Date(Date(2010, 7, 4)))); assert(!interval.isAdjacent(PosInfInterval!Date(Date(2010, 7, 5)))); assert(!interval.isAdjacent(PosInfInterval!Date(Date(2012, 1, 6)))); assert(interval.isAdjacent(PosInfInterval!Date(Date(2012, 1, 7)))); assert(!interval.isAdjacent(PosInfInterval!Date(Date(2012, 1, 8)))); assert(!interval.isAdjacent(NegInfInterval!Date(Date(2010, 7, 3)))); assert(interval.isAdjacent(NegInfInterval!Date(Date(2010, 7, 4)))); assert(!interval.isAdjacent(NegInfInterval!Date(Date(2010, 7, 5)))); assert(!interval.isAdjacent(NegInfInterval!Date(Date(2012, 1, 6)))); assert(!interval.isAdjacent(NegInfInterval!Date(Date(2012, 1, 7)))); assert(!interval.isAdjacent(NegInfInterval!Date(Date(2012, 1, 8)))); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, interval.isAdjacent(interval))); static assert(__traits(compiles, interval.isAdjacent(cInterval))); static assert(__traits(compiles, interval.isAdjacent(iInterval))); static assert(__traits(compiles, interval.isAdjacent(posInfInterval))); static assert(__traits(compiles, interval.isAdjacent(cPosInfInterval))); static assert(__traits(compiles, interval.isAdjacent(iPosInfInterval))); static assert(__traits(compiles, interval.isAdjacent(negInfInterval))); static assert(__traits(compiles, interval.isAdjacent(cNegInfInterval))); static assert(__traits(compiles, interval.isAdjacent(iNegInfInterval))); static assert(__traits(compiles, cInterval.isAdjacent(interval))); static assert(__traits(compiles, cInterval.isAdjacent(cInterval))); static assert(__traits(compiles, cInterval.isAdjacent(iInterval))); static assert(__traits(compiles, cInterval.isAdjacent(posInfInterval))); static assert(__traits(compiles, cInterval.isAdjacent(cPosInfInterval))); static assert(__traits(compiles, cInterval.isAdjacent(iPosInfInterval))); static assert(__traits(compiles, cInterval.isAdjacent(negInfInterval))); static assert(__traits(compiles, cInterval.isAdjacent(cNegInfInterval))); static assert(__traits(compiles, cInterval.isAdjacent(iNegInfInterval))); static assert(__traits(compiles, iInterval.isAdjacent(interval))); static assert(__traits(compiles, iInterval.isAdjacent(cInterval))); static assert(__traits(compiles, iInterval.isAdjacent(iInterval))); static assert(__traits(compiles, iInterval.isAdjacent(posInfInterval))); static assert(__traits(compiles, iInterval.isAdjacent(cPosInfInterval))); static assert(__traits(compiles, iInterval.isAdjacent(iPosInfInterval))); static assert(__traits(compiles, iInterval.isAdjacent(negInfInterval))); static assert(__traits(compiles, iInterval.isAdjacent(cNegInfInterval))); static assert(__traits(compiles, iInterval.isAdjacent(iNegInfInterval))); //Verify Examples. assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent(Interval!Date(Date(1990, 7, 6), Date(1996, 1, 2)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent(Interval!Date(Date(2012, 3, 1), Date(2013, 9, 17)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent(Interval!Date(Date(1989, 3, 1), Date(2012, 3, 1)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent(PosInfInterval!Date(Date(1999, 5, 4)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent(PosInfInterval!Date(Date(2012, 3, 1)))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent(NegInfInterval!Date(Date(1996, 1, 2)))); assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent(NegInfInterval!Date(Date(2000, 1, 2)))); } } //Test Interval's merge(). unittest { version(testStdDateTime) { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static void testInterval(I)(in Interval!Date interval1, in I interval2) { interval1.merge(interval2); } assertThrown!DateTimeException(testInterval(interval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assertThrown!DateTimeException(testInterval(Interval!Date(Date(2010, 7, 4), dur!"days"(0)), interval)); assertThrown!DateTimeException(testInterval(Interval!Date(Date(2010, 7, 4), dur!"days"(0)), Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assertThrown!DateTimeException(testInterval(interval, Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assertThrown!DateTimeException(testInterval(interval, Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assertThrown!DateTimeException(testInterval(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)), interval)); assertThrown!DateTimeException(testInterval(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)), interval)); assertThrown!DateTimeException(testInterval(interval, PosInfInterval!Date(Date(2012, 1, 8)))); assertThrown!DateTimeException(testInterval(interval, NegInfInterval!Date(Date(2010, 7, 3)))); _assertPred!"=="(interval.merge(interval), interval); _assertPred!"=="(interval.merge(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3))), Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3))); _assertPred!"=="(interval.merge(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4))), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))); _assertPred!"=="(interval.merge(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5))), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))); _assertPred!"=="(interval.merge(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))); _assertPred!"=="(interval.merge(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8))), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8))); _assertPred!"=="(interval.merge(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(interval.merge(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(interval.merge(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(interval.merge(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 8))); _assertPred!"=="(interval.merge(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 8))); _assertPred!"=="(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)).merge(interval), Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3))); _assertPred!"=="(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)).merge(interval), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)).merge(interval), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)).merge(interval), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)).merge(interval), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8))); _assertPred!"=="(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)).merge(interval), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)).merge(interval), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)).merge(interval), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)).merge(interval), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 8))); _assertPred!"=="(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)).merge(interval), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 8))); _assertPred!"=="(interval.merge(PosInfInterval!Date(Date(2010, 7, 3))), PosInfInterval!Date(Date(2010, 7, 3))); _assertPred!"=="(interval.merge(PosInfInterval!Date(Date(2010, 7, 4))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(interval.merge(PosInfInterval!Date(Date(2010, 7, 5))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(interval.merge(PosInfInterval!Date(Date(2012, 1, 6))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(interval.merge(PosInfInterval!Date(Date(2012, 1, 7))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(interval.merge(NegInfInterval!Date(Date(2010, 7, 4))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(interval.merge(NegInfInterval!Date(Date(2010, 7, 5))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(interval.merge(NegInfInterval!Date(Date(2012, 1, 6))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(interval.merge(NegInfInterval!Date(Date(2012, 1, 7))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(interval.merge(NegInfInterval!Date(Date(2012, 1, 8))), NegInfInterval!Date(Date(2012, 1, 8))); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, interval.merge(interval))); static assert(__traits(compiles, interval.merge(cInterval))); static assert(__traits(compiles, interval.merge(iInterval))); static assert(__traits(compiles, interval.merge(posInfInterval))); static assert(__traits(compiles, interval.merge(cPosInfInterval))); static assert(__traits(compiles, interval.merge(iPosInfInterval))); static assert(__traits(compiles, interval.merge(negInfInterval))); static assert(__traits(compiles, interval.merge(cNegInfInterval))); static assert(__traits(compiles, interval.merge(iNegInfInterval))); static assert(__traits(compiles, cInterval.merge(interval))); static assert(__traits(compiles, cInterval.merge(cInterval))); static assert(__traits(compiles, cInterval.merge(iInterval))); static assert(__traits(compiles, cInterval.merge(posInfInterval))); static assert(__traits(compiles, cInterval.merge(cPosInfInterval))); static assert(__traits(compiles, cInterval.merge(iPosInfInterval))); static assert(__traits(compiles, cInterval.merge(negInfInterval))); static assert(__traits(compiles, cInterval.merge(cNegInfInterval))); static assert(__traits(compiles, cInterval.merge(iNegInfInterval))); static assert(__traits(compiles, iInterval.merge(interval))); static assert(__traits(compiles, iInterval.merge(cInterval))); static assert(__traits(compiles, iInterval.merge(iInterval))); static assert(__traits(compiles, iInterval.merge(posInfInterval))); static assert(__traits(compiles, iInterval.merge(cPosInfInterval))); static assert(__traits(compiles, iInterval.merge(iPosInfInterval))); static assert(__traits(compiles, iInterval.merge(negInfInterval))); static assert(__traits(compiles, iInterval.merge(cNegInfInterval))); static assert(__traits(compiles, iInterval.merge(iNegInfInterval))); //Verify Examples. assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == Interval!Date(Date(1990, 7 , 6), Date(2012, 3, 1))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge(Interval!Date(Date(2012, 3, 1), Date(2013, 5, 7))) == Interval!Date(Date(1996, 1 , 2), Date(2013, 5, 7))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge(PosInfInterval!Date(Date(1990, 7, 6))) == PosInfInterval!Date(Date(1990, 7 , 6))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge(PosInfInterval!Date(Date(2012, 3, 1))) == PosInfInterval!Date(Date(1996, 1 , 2))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge(NegInfInterval!Date(Date(1996, 1, 2))) == NegInfInterval!Date(Date(2012, 3 , 1))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge(NegInfInterval!Date(Date(2013, 1, 12))) == NegInfInterval!Date(Date(2013, 1 , 12))); } } //Test Interval's span(). unittest { version(testStdDateTime) { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static void testInterval(in Interval!Date interval1, in Interval!Date interval2) { interval1.span(interval2); } assertThrown!DateTimeException(testInterval(interval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assertThrown!DateTimeException(testInterval(Interval!Date(Date(2010, 7, 4), dur!"days"(0)), interval)); assertThrown!DateTimeException(testInterval(Interval!Date(Date(2010, 7, 4), dur!"days"(0)), Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); _assertPred!"=="(interval.span(interval), interval); _assertPred!"=="(interval.span(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3))), Interval!Date(Date(2010, 7, 1), Date(2012, 1, 7))); _assertPred!"=="(interval.span(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3))), Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3))); _assertPred!"=="(interval.span(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4))), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))); _assertPred!"=="(interval.span(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5))), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))); _assertPred!"=="(interval.span(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))); _assertPred!"=="(interval.span(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8))), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8))); _assertPred!"=="(interval.span(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(interval.span(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(interval.span(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(interval.span(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 8))); _assertPred!"=="(interval.span(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 8))); _assertPred!"=="(interval.span(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 9))); _assertPred!"=="(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)).span(interval), Interval!Date(Date(2010, 7, 1), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)).span(interval), Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3))); _assertPred!"=="(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)).span(interval), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)).span(interval), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)).span(interval), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)).span(interval), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8))); _assertPred!"=="(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)).span(interval), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)).span(interval), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)).span(interval), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)).span(interval), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 8))); _assertPred!"=="(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)).span(interval), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 8))); _assertPred!"=="(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)).span(interval), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 9))); _assertPred!"=="(interval.span(PosInfInterval!Date(Date(2010, 7, 3))), PosInfInterval!Date(Date(2010, 7, 3))); _assertPred!"=="(interval.span(PosInfInterval!Date(Date(2010, 7, 4))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(interval.span(PosInfInterval!Date(Date(2010, 7, 5))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(interval.span(PosInfInterval!Date(Date(2012, 1, 6))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(interval.span(PosInfInterval!Date(Date(2012, 1, 7))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(interval.span(PosInfInterval!Date(Date(2012, 1, 8))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(interval.span(NegInfInterval!Date(Date(2010, 7, 3))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(interval.span(NegInfInterval!Date(Date(2010, 7, 4))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(interval.span(NegInfInterval!Date(Date(2010, 7, 5))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(interval.span(NegInfInterval!Date(Date(2012, 1, 6))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(interval.span(NegInfInterval!Date(Date(2012, 1, 7))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(interval.span(NegInfInterval!Date(Date(2012, 1, 8))), NegInfInterval!Date(Date(2012, 1, 8))); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, interval.span(interval))); static assert(__traits(compiles, interval.span(cInterval))); static assert(__traits(compiles, interval.span(iInterval))); static assert(__traits(compiles, interval.span(posInfInterval))); static assert(__traits(compiles, interval.span(cPosInfInterval))); static assert(__traits(compiles, interval.span(iPosInfInterval))); static assert(__traits(compiles, interval.span(negInfInterval))); static assert(__traits(compiles, interval.span(cNegInfInterval))); static assert(__traits(compiles, interval.span(iNegInfInterval))); static assert(__traits(compiles, cInterval.span(interval))); static assert(__traits(compiles, cInterval.span(cInterval))); static assert(__traits(compiles, cInterval.span(iInterval))); static assert(__traits(compiles, cInterval.span(posInfInterval))); static assert(__traits(compiles, cInterval.span(cPosInfInterval))); static assert(__traits(compiles, cInterval.span(iPosInfInterval))); static assert(__traits(compiles, cInterval.span(negInfInterval))); static assert(__traits(compiles, cInterval.span(cNegInfInterval))); static assert(__traits(compiles, cInterval.span(iNegInfInterval))); static assert(__traits(compiles, iInterval.span(interval))); static assert(__traits(compiles, iInterval.span(cInterval))); static assert(__traits(compiles, iInterval.span(iInterval))); static assert(__traits(compiles, iInterval.span(posInfInterval))); static assert(__traits(compiles, iInterval.span(cPosInfInterval))); static assert(__traits(compiles, iInterval.span(iPosInfInterval))); static assert(__traits(compiles, iInterval.span(negInfInterval))); static assert(__traits(compiles, iInterval.span(cNegInfInterval))); static assert(__traits(compiles, iInterval.span(iNegInfInterval))); //Verify Examples. assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span(Interval!Date(Date(1990, 7, 6), Date(1991, 1, 8))) == Interval!Date(Date(1990, 7 , 6), Date(2012, 3, 1))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span(Interval!Date(Date(2012, 3, 1), Date(2013, 5, 7))) == Interval!Date(Date(1996, 1 , 2), Date(2013, 5, 7))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span(PosInfInterval!Date(Date(1990, 7, 6))) == PosInfInterval!Date(Date(1990, 7 , 6))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span(PosInfInterval!Date(Date(2050, 1, 1))) == PosInfInterval!Date(Date(1996, 1 , 2))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span(NegInfInterval!Date(Date(1602, 5, 21))) == NegInfInterval!Date(Date(2012, 3 , 1))); assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).span(NegInfInterval!Date(Date(2013, 1, 12))) == NegInfInterval!Date(Date(2013, 1 , 12))); } } //Test Interval's shift(duration). unittest { version(testStdDateTime) { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static void testIntervalFail(Interval!Date interval, in Duration duration) { interval.shift(duration); } assertThrown!DateTimeException(testIntervalFail(Interval!Date(Date(2010, 7, 4), dur!"days"(0)), dur!"days"(1))); static void testInterval(I)(I interval, in Duration duration, in I expected, size_t line = __LINE__) { interval.shift(duration); _assertPred!"=="(interval, expected, "", __FILE__, line); } testInterval(interval, dur!"days"(22), Interval!Date(Date(2010, 7, 26), Date(2012, 1, 29))); testInterval(interval, dur!"days"(-22), Interval!Date(Date(2010, 6, 12), Date(2011, 12, 16))); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static assert(!__traits(compiles, cInterval.shift(dur!"days"(5)))); static assert(!__traits(compiles, iInterval.shift(dur!"days"(5)))); //Verify Examples. auto interval1 = Interval!Date(Date(1996, 1, 2), Date(2012, 4, 5)); auto interval2 = Interval!Date(Date(1996, 1, 2), Date(2012, 4, 5)); interval1.shift(dur!"days"(50)); assert(interval1 == Interval!Date(Date(1996, 2, 21), Date(2012, 5, 25))); interval2.shift(dur!"days"(-50)); assert(interval2 == Interval!Date(Date(1995, 11, 13), Date(2012, 2, 15))); } } //Test Interval's shift(int, int, AllowDayOverflow). unittest { version(testStdDateTime) { { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static void testIntervalFail(Interval!Date interval, int years, int months) { interval.shift(years, months); } assertThrown!DateTimeException(testIntervalFail(Interval!Date(Date(2010, 7, 4), dur!"days"(0)), 1, 0)); static void testInterval(I)(I interval, int years, int months, AllowDayOverflow allow, in I expected, size_t line = __LINE__) { interval.shift(years, months, allow); _assertPred!"=="(interval, expected, "", __FILE__, line); } testInterval(interval, 5, 0, AllowDayOverflow.yes, Interval!Date(Date(2015, 7, 4), Date(2017, 1, 7))); testInterval(interval, -5, 0, AllowDayOverflow.yes, Interval!Date(Date(2005, 7, 4), Date(2007, 1, 7))); auto interval2 = Interval!Date(Date(2000, 1, 29), Date(2010, 5, 31)); testInterval(interval2, 1, 1, AllowDayOverflow.yes, Interval!Date(Date(2001, 3, 1), Date(2011, 7, 1))); testInterval(interval2, 1, -1, AllowDayOverflow.yes, Interval!Date(Date(2000, 12, 29), Date(2011, 5, 1))); testInterval(interval2, -1, -1, AllowDayOverflow.yes, Interval!Date(Date(1998, 12, 29), Date(2009, 5, 1))); testInterval(interval2, -1, 1, AllowDayOverflow.yes, Interval!Date(Date(1999, 3, 1), Date(2009, 7, 1))); testInterval(interval2, 1, 1, AllowDayOverflow.no, Interval!Date(Date(2001, 2, 28), Date(2011, 6, 30))); testInterval(interval2, 1, -1, AllowDayOverflow.no, Interval!Date(Date(2000, 12, 29), Date(2011, 4, 30))); testInterval(interval2, -1, -1, AllowDayOverflow.no, Interval!Date(Date(1998, 12, 29), Date(2009, 4, 30))); testInterval(interval2, -1, 1, AllowDayOverflow.no, Interval!Date(Date(1999, 2, 28), Date(2009, 6, 30))); } const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static assert(!__traits(compiles, cInterval.shift(5))); static assert(!__traits(compiles, iInterval.shift(5))); //Verify Examples. auto interval1 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)); auto interval2 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)); interval1.shift(2); assert(interval1 == Interval!Date(Date(1998, 1, 2), Date(2014, 3, 1))); interval2.shift(-2); assert(interval2 == Interval!Date(Date(1994, 1, 2), Date(2010, 3, 1))); } } //Test Interval's expand(Duration). unittest { version(testStdDateTime) { auto interval = Interval!Date(Date(2000, 7, 4), Date(2012, 1, 7)); static void testIntervalFail(I)(I interval, in Duration duration) { interval.expand(duration); } assertThrown!DateTimeException(testIntervalFail(Interval!Date(Date(2010, 7, 4), dur!"days"(0)), dur!"days"(1))); assertThrown!DateTimeException(testIntervalFail(Interval!Date(Date(2010, 7, 4), Date(2010, 7, 5)), dur!"days"(-5))); static void testInterval(I)(I interval, in Duration duration, in I expected, size_t line = __LINE__) { interval.expand(duration); _assertPred!"=="(interval, expected, "", __FILE__, line); } testInterval(interval, dur!"days"(22), Interval!Date(Date(2000, 6, 12), Date(2012, 1, 29))); testInterval(interval, dur!"days"(-22), Interval!Date(Date(2000, 7, 26), Date(2011, 12, 16))); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static assert(!__traits(compiles, cInterval.expand(dur!"days"(5)))); static assert(!__traits(compiles, iInterval.expand(dur!"days"(5)))); //Verify Examples. auto interval1 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)); auto interval2 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)); interval1.expand(dur!"days"(2)); assert(interval1 == Interval!Date(Date(1995, 12, 31), Date(2012, 3, 3))); interval2.expand(dur!"days"(-2)); assert(interval2 == Interval!Date(Date(1996, 1, 4), Date(2012, 2, 28))); } } //Test Interval's expand(int, int, AllowDayOverflow, Direction) unittest { version(testStdDateTime) { { auto interval = Interval!Date(Date(2000, 7, 4), Date(2012, 1, 7)); static void testIntervalFail(Interval!Date interval, int years, int months) { interval.expand(years, months); } assertThrown!DateTimeException(testIntervalFail(Interval!Date(Date(2010, 7, 4), dur!"days"(0)), 1, 0)); assertThrown!DateTimeException(testIntervalFail(Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)), -5, 0)); static void testInterval(I)(I interval, int years, int months, AllowDayOverflow allow, Direction dir, in I expected, size_t line = __LINE__) { interval.expand(years, months, allow, dir); _assertPred!"=="(interval, expected, "", __FILE__, line); } testInterval(interval, 5, 0, AllowDayOverflow.yes, Direction.both, Interval!Date(Date(1995, 7, 4), Date(2017, 1, 7))); testInterval(interval, -5, 0, AllowDayOverflow.yes, Direction.both, Interval!Date(Date(2005, 7, 4), Date(2007, 1, 7))); testInterval(interval, 5, 0, AllowDayOverflow.yes, Direction.fwd, Interval!Date(Date(2000, 7, 4), Date(2017, 1, 7))); testInterval(interval, -5, 0, AllowDayOverflow.yes, Direction.fwd, Interval!Date(Date(2000, 7, 4), Date(2007, 1, 7))); testInterval(interval, 5, 0, AllowDayOverflow.yes, Direction.bwd, Interval!Date(Date(1995, 7, 4), Date(2012, 1, 7))); testInterval(interval, -5, 0, AllowDayOverflow.yes, Direction.bwd, Interval!Date(Date(2005, 7, 4), Date(2012, 1, 7))); auto interval2 = Interval!Date(Date(2000, 1, 29), Date(2010, 5, 31)); testInterval(interval2, 1, 1, AllowDayOverflow.yes, Direction.both, Interval!Date(Date(1998, 12, 29), Date(2011, 7, 1))); testInterval(interval2, 1, -1, AllowDayOverflow.yes, Direction.both, Interval!Date(Date(1999, 3, 1), Date(2011, 5, 1))); testInterval(interval2, -1, -1, AllowDayOverflow.yes, Direction.both, Interval!Date(Date(2001, 3, 1), Date(2009, 5, 1))); testInterval(interval2, -1, 1, AllowDayOverflow.yes, Direction.both, Interval!Date(Date(2000, 12, 29), Date(2009, 7, 1))); testInterval(interval2, 1, 1, AllowDayOverflow.no, Direction.both, Interval!Date(Date(1998, 12, 29), Date(2011, 6, 30))); testInterval(interval2, 1, -1, AllowDayOverflow.no, Direction.both, Interval!Date(Date(1999, 2, 28), Date(2011, 4, 30))); testInterval(interval2, -1, -1, AllowDayOverflow.no, Direction.both, Interval!Date(Date(2001, 2, 28), Date(2009, 4, 30))); testInterval(interval2, -1, 1, AllowDayOverflow.no, Direction.both, Interval!Date(Date(2000, 12, 29), Date(2009, 6, 30))); testInterval(interval2, 1, 1, AllowDayOverflow.yes, Direction.fwd, Interval!Date(Date(2000, 1, 29), Date(2011, 7, 1))); testInterval(interval2, 1, -1, AllowDayOverflow.yes, Direction.fwd, Interval!Date(Date(2000, 1, 29), Date(2011, 5, 1))); testInterval(interval2, -1, -1, AllowDayOverflow.yes, Direction.fwd, Interval!Date(Date(2000, 1, 29), Date(2009, 5, 1))); testInterval(interval2, -1, 1, AllowDayOverflow.yes, Direction.fwd, Interval!Date(Date(2000, 1, 29), Date(2009, 7, 1))); testInterval(interval2, 1, 1, AllowDayOverflow.no, Direction.fwd, Interval!Date(Date(2000, 1, 29), Date(2011, 6, 30))); testInterval(interval2, 1, -1, AllowDayOverflow.no, Direction.fwd, Interval!Date(Date(2000, 1, 29), Date(2011, 4, 30))); testInterval(interval2, -1, -1, AllowDayOverflow.no, Direction.fwd, Interval!Date(Date(2000, 1, 29), Date(2009, 4, 30))); testInterval(interval2, -1, 1, AllowDayOverflow.no, Direction.fwd, Interval!Date(Date(2000, 1, 29), Date(2009, 6, 30))); testInterval(interval2, 1, 1, AllowDayOverflow.yes, Direction.bwd, Interval!Date(Date(1998, 12, 29), Date(2010, 5, 31))); testInterval(interval2, 1, -1, AllowDayOverflow.yes, Direction.bwd, Interval!Date(Date(1999, 3, 1), Date(2010, 5, 31))); testInterval(interval2, -1, -1, AllowDayOverflow.yes, Direction.bwd, Interval!Date(Date(2001, 3, 1), Date(2010, 5, 31))); testInterval(interval2, -1, 1, AllowDayOverflow.yes, Direction.bwd, Interval!Date(Date(2000, 12, 29), Date(2010, 5, 31))); testInterval(interval2, 1, 1, AllowDayOverflow.no, Direction.bwd, Interval!Date(Date(1998, 12, 29), Date(2010, 5, 31))); testInterval(interval2, 1, -1, AllowDayOverflow.no, Direction.bwd, Interval!Date(Date(1999, 2, 28), Date(2010, 5, 31))); testInterval(interval2, -1, -1, AllowDayOverflow.no, Direction.bwd, Interval!Date(Date(2001, 2, 28), Date(2010, 5, 31))); testInterval(interval2, -1, 1, AllowDayOverflow.no, Direction.bwd, Interval!Date(Date(2000, 12, 29), Date(2010, 5, 31))); } const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static assert(!__traits(compiles, cInterval.expand(5))); static assert(!__traits(compiles, iInterval.expand(5))); //Verify Examples. auto interval1 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)); auto interval2 = Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)); interval1.expand(2); assert(interval1 == Interval!Date(Date(1994, 1, 2), Date(2014, 3, 1))); interval2.expand(-2); assert(interval2 == Interval!Date(Date(1998, 1, 2), Date(2010, 3, 1))); } } //Test Interval's fwdRange. unittest { version(testStdDateTime) { { auto interval = Interval!Date(Date(2010, 9, 19), Date(2010, 9, 21)); static void testInterval1(Interval!Date interval) { interval.fwdRange(everyDayOfWeek!Date(DayOfWeek.fri)); } assertThrown!DateTimeException(testInterval1(Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); static void testInterval2(Interval!Date interval) { interval.fwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri)).popFront(); } assertThrown!DateTimeException(testInterval2(interval)); assert(!interval.fwdRange(everyDayOfWeek!Date(DayOfWeek.fri)).empty); assert(interval.fwdRange(everyDayOfWeek!Date(DayOfWeek.fri), PopFirst.yes).empty); _assertPred!"=="(Interval!Date(Date(2010, 9, 12), Date(2010, 10, 1)).fwdRange(everyDayOfWeek!Date(DayOfWeek.fri)).front, Date(2010, 9, 12)); _assertPred!"=="(Interval!Date(Date(2010, 9, 12), Date(2010, 10, 1)).fwdRange(everyDayOfWeek!Date(DayOfWeek.fri), PopFirst.yes).front, Date(2010, 9, 17)); } //Verify Examples. { auto interval = Interval!Date(Date(2010, 9, 1), Date(2010, 9, 9)); auto func = delegate (in Date date) { if((date.day & 1) == 0) return date + dur!"days"(2); return date + dur!"days"(1); }; auto range = interval.fwdRange(func); assert(range.front == Date(2010, 9, 1)); //An odd day. Using PopFirst.yes would have made this Date(2010, 9, 2). range.popFront(); assert(range.front == Date(2010, 9, 2)); range.popFront(); assert(range.front == Date(2010, 9, 4)); range.popFront(); assert(range.front == Date(2010, 9, 6)); range.popFront(); assert(range.front == Date(2010, 9, 8)); range.popFront(); assert(range.empty); } const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static assert(__traits(compiles, cInterval.fwdRange(everyDayOfWeek!Date(DayOfWeek.fri)))); static assert(__traits(compiles, iInterval.fwdRange(everyDayOfWeek!Date(DayOfWeek.fri)))); } } //Test Interval's bwdRange. unittest { version(testStdDateTime) { { auto interval = Interval!Date(Date(2010, 9, 19), Date(2010, 9, 21)); static void testInterval1(Interval!Date interval) { interval.bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri)); } assertThrown!DateTimeException(testInterval1(Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); static void testInterval2(Interval!Date interval) { interval.bwdRange(everyDayOfWeek!(Date, Direction.fwd)(DayOfWeek.fri)).popFront(); } assertThrown!DateTimeException(testInterval2(interval)); assert(!interval.bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri)).empty); assert(interval.bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri), PopFirst.yes).empty); _assertPred!"=="(Interval!Date(Date(2010, 9, 19), Date(2010, 10, 1)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri)).front, Date(2010, 10, 1)); _assertPred!"=="(Interval!Date(Date(2010, 9, 19), Date(2010, 10, 1)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri), PopFirst.yes).front, Date(2010, 9, 24)); } //Verify Examples. { auto interval = Interval!Date(Date(2010, 9, 1), Date(2010, 9, 9)); auto func = delegate (in Date date) { if((date.day & 1) == 0) return date - dur!"days"(2); return date - dur!"days"(1); }; auto range = interval.bwdRange(func); assert(range.front == Date(2010, 9, 9)); //An odd day. Using PopFirst.yes would have made this Date(2010, 9, 8). range.popFront(); assert(range.front == Date(2010, 9, 8)); range.popFront(); assert(range.front == Date(2010, 9, 6)); range.popFront(); assert(range.front == Date(2010, 9, 4)); range.popFront(); assert(range.front == Date(2010, 9, 2)); range.popFront(); assert(range.empty); } const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static assert(__traits(compiles, cInterval.bwdRange(everyDayOfWeek!Date(DayOfWeek.fri)))); static assert(__traits(compiles, iInterval.bwdRange(everyDayOfWeek!Date(DayOfWeek.fri)))); } } //Test Interval's toString(). unittest { version(testStdDateTime) { _assertPred!"=="(Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)).toString(), "[2010-Jul-04 - 2012-Jan-07)"); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static assert(__traits(compiles, cInterval.toString())); static assert(__traits(compiles, iInterval.toString())); } } /++ Represents an interval of time which has positive infinity as its end point. Any ranges which iterate over a $(D PosInfInterval) are infinite. So, the main purpose of using $(D PosInfInterval) is to create an infinite range which starts at a fixed point in time and goes to positive infinity. +/ struct PosInfInterval(TP) { public: /++ Params: begin = The time point which begins the interval. Examples: -------------------- auto interval = PosInfInterval!Date(Date(1996, 1, 2)); -------------------- +/ this(in TP begin) pure nothrow { _begin = cast(TP)begin; } /++ Params: rhs = The $(D PosInfInterval) to assign to this one. +/ /+ref+/ PosInfInterval opAssign(const ref PosInfInterval rhs) pure nothrow { _begin = cast(TP)rhs._begin; return this; } /++ Params: rhs = The $(D PosInfInterval) to assign to this one. +/ /+ref+/ PosInfInterval opAssign(PosInfInterval rhs) pure nothrow { _begin = cast(TP)rhs._begin; return this; } /++ The starting point of the interval. It is included in the interval. Examples: -------------------- assert(PosInfInterval!Date(Date(1996, 1, 2)).begin == Date(1996, 1, 2)); -------------------- +/ @property TP begin() const pure nothrow { return cast(TP)_begin; } /++ The starting point of the interval. It is included in the interval. Params: timePoint = The time point to set $(D begin) to. +/ @property void begin(TP timePoint) pure nothrow { _begin = timePoint; } /++ Whether the interval's length is 0. Always returns false. Examples: -------------------- assert(!PosInfInterval!Date(Date(1996, 1, 2)).empty); -------------------- +/ @property bool empty() const pure nothrow { return false; } /++ Whether the given time point is within this interval. Params: timePoint = The time point to check for inclusion in this interval. Examples: -------------------- assert(!PosInfInterval!Date(Date(1996, 1, 2)).contains(Date(1994, 12, 24))); assert(PosInfInterval!Date(Date(1996, 1, 2)).contains(Date(2000, 1, 5))); -------------------- +/ bool contains(TP timePoint) const pure nothrow { return timePoint >= _begin; } /++ Whether the given interval is completely within this interval. Params: interval = The interval to check for inclusion in this interval. Throws: $(D DateTimeException) if the given interval is empty. Examples: -------------------- assert(!PosInfInterval!Date(Date(1996, 1, 2)).contains( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(PosInfInterval!Date(Date(1996, 1, 2)).contains( Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(PosInfInterval!Date(Date(1996, 1, 2)).contains( Interval!Date(Date(1998, 2, 28), Date(2013, 5, 1)))); -------------------- +/ bool contains(in Interval!TP interval) const pure { interval._enforceNotEmpty(); return interval._begin >= _begin; } /++ Whether the given interval is completely within this interval. Params: interval = The interval to check for inclusion in this interval. Examples: -------------------- assert(PosInfInterval!Date(Date(1996, 1, 2)).contains( PosInfInterval!Date(Date(1999, 5, 4)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).contains( PosInfInterval!Date(Date(1995, 7, 2)))); -------------------- +/ bool contains(in PosInfInterval interval) const pure nothrow { return interval._begin >= _begin; } /++ Whether the given interval is completely within this interval. Always returns false because an interval going to positive infinity can never contain an interval beginning at negative infinity. Params: interval = The interval to check for inclusion in this interval. Examples: -------------------- assert(!PosInfInterval!Date(Date(1996, 1, 2)).contains( NegInfInterval!Date(Date(1996, 5, 4)))); -------------------- +/ bool contains(in NegInfInterval!TP interval) const pure nothrow { return false; } /++ Whether this interval is before the given time point. Always returns false because an interval going to positive infinity can never be before any time point. Params: timePoint = The time point to check whether this interval is before it. Examples: -------------------- assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore(Date(1994, 12, 24))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore(Date(2000, 1, 5))); -------------------- +/ bool isBefore(in TP timePoint) const pure nothrow { return false; } /++ Whether this interval is before the given interval and does not intersect it. Always returns false (unless the given interval is empty) because an interval going to positive infinity can never be before any other interval. Params: interval = The interval to check for against this interval. Throws: $(D DateTimeException) if the given interval is empty. Examples: -------------------- assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore( Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); -------------------- +/ bool isBefore(in Interval!TP interval) const pure { interval._enforceNotEmpty(); return false; } /++ Whether this interval is before the given interval and does not intersect it. Always returns false because an interval going to positive infinity can never be before any other interval. Params: interval = The interval to check for against this interval. Examples: -------------------- assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore( PosInfInterval!Date(Date(1992, 5, 4)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore( PosInfInterval!Date(Date(2013, 3, 7)))); -------------------- +/ bool isBefore(in PosInfInterval interval) const pure nothrow { return false; } /++ Whether this interval is before the given interval and does not intersect it. Always returns false because an interval going to positive infinity can never be before any other interval. Params: interval = The interval to check for against this interval. Examples: -------------------- assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore( NegInfInterval!Date(Date(1996, 5, 4)))); -------------------- +/ bool isBefore(in NegInfInterval!TP interval) const pure nothrow { return false; } /++ Whether this interval is after the given time point. Params: timePoint = The time point to check whether this interval is after it. Examples: -------------------- assert(PosInfInterval!Date(Date(1996, 1, 2)).isAfter(Date(1994, 12, 24))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter(Date(2000, 1, 5))); -------------------- +/ bool isAfter(in TP timePoint) const pure nothrow { return timePoint < _begin; } /++ Whether this interval is after the given interval and does not intersect it. Params: interval = The interval to check against this interval. Throws: $(D DateTimeException) if the given interval is empty. Examples: -------------------- assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter( Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(PosInfInterval!Date(Date(1996, 1, 2)).isAfter( Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2)))); -------------------- +/ bool isAfter(in Interval!TP interval) const pure { interval._enforceNotEmpty(); return _begin >= interval._end; } /++ Whether this interval is after the given interval and does not intersect it. Always returns false because an interval going to positive infinity can never be after another interval going to positive infinity. Params: interval = The interval to check against this interval. Examples: -------------------- assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter( PosInfInterval!Date(Date(1990, 1, 7)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter( PosInfInterval!Date(Date(1999, 5, 4)))); -------------------- +/ bool isAfter(in PosInfInterval interval) const pure nothrow { return false; } /++ Whether this interval is after the given interval and does not intersect it. Params: interval = The interval to check against this interval. Examples: -------------------- assert(PosInfInterval!Date(Date(1996, 1, 2)).isAfter( NegInfInterval!Date(Date(1996, 1, 2)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter( NegInfInterval!Date(Date(2000, 7, 1)))); -------------------- +/ bool isAfter(in NegInfInterval!TP interval) const pure nothrow { return _begin >= interval._end; } /++ Whether the given interval overlaps this interval. Params: interval = The interval to check for intersection with this interval. Throws: $(D DateTimeException) if the given interval is empty. Examples: -------------------- assert(PosInfInterval!Date(Date(1996, 1, 2)).intersects( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(PosInfInterval!Date(Date(1996, 1, 2)).intersects( Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).intersects( Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2)))); -------------------- +/ bool intersects(in Interval!TP interval) const pure { interval._enforceNotEmpty(); return interval._end > _begin; } /++ Whether the given interval overlaps this interval. Always returns true because two intervals going to positive infinity always overlap. Params: interval = The interval to check for intersection with this interval. Examples: -------------------- assert(PosInfInterval!Date(Date(1996, 1, 2)).intersects( PosInfInterval!Date(Date(1990, 1, 7)))); assert(PosInfInterval!Date(Date(1996, 1, 2)).intersects( PosInfInterval!Date(Date(1999, 5, 4)))); -------------------- +/ bool intersects(in PosInfInterval interval) const pure nothrow { return true; } /++ Whether the given interval overlaps this interval. Params: interval = The interval to check for intersection with this interval. Examples: -------------------- assert(!PosInfInterval!Date(Date(1996, 1, 2)).intersects( NegInfInterval!Date(Date(1996, 1, 2)))); assert(PosInfInterval!Date(Date(1996, 1, 2)).intersects( NegInfInterval!Date(Date(2000, 7, 1)))); -------------------- +/ bool intersects(in NegInfInterval!TP interval) const pure nothrow { return _begin < interval._end; } /++ Returns the intersection of two intervals Params: interval = The interval to intersect with this interval. Throws: $(D DateTimeException) if the two intervals do not intersect or if the given interval is empty. Examples: -------------------- assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == Interval!Date(Date(1996, 1 , 2), Date(2000, 8, 2))); assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection( Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))) == Interval!Date(Date(1999, 1 , 12), Date(2011, 9, 17))); -------------------- +/ Interval!TP intersection(in Interval!TP interval) const { enforce(this.intersects(interval), new DateTimeException(format("%s and %s do not intersect.", this, interval))); auto begin = _begin > interval._begin ? _begin : interval._begin; return Interval!TP(begin, interval._end); } /++ Returns the intersection of two intervals Params: interval = The interval to intersect with this interval. Examples: -------------------- assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection( PosInfInterval!Date(Date(1990, 7, 6))) == PosInfInterval!Date(Date(1996, 1 , 2))); assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection( PosInfInterval!Date(Date(1999, 1, 12))) == PosInfInterval!Date(Date(1999, 1 , 12))); -------------------- +/ PosInfInterval intersection(in PosInfInterval interval) const pure nothrow { return PosInfInterval(_begin < interval._begin ? interval._begin : _begin); } /++ Returns the intersection of two intervals Params: interval = The interval to intersect with this interval. Throws: $(D DateTimeException) if the two intervals do not intersect. Examples: -------------------- assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection( NegInfInterval!Date(Date(1999, 7, 6))) == Interval!Date(Date(1996, 1 , 2), Date(1999, 7, 6))); assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection( NegInfInterval!Date(Date(2013, 1, 12))) == Interval!Date(Date(1996, 1 , 2), Date(2013, 1, 12))); -------------------- +/ Interval!TP intersection(in NegInfInterval!TP interval) const { enforce(this.intersects(interval), new DateTimeException(format("%s and %s do not intersect.", this, interval))); return Interval!TP(_begin, interval._end); } /++ Whether the given interval is adjacent to this interval. Params: interval = The interval to check whether its adjecent to this interval. Throws: $(D DateTimeException) if the given interval is empty. Examples: -------------------- assert(PosInfInterval!Date(Date(1996, 1, 2)).isAdjacent( Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2)))); assert(!PosInfInterval!Date(Date(1999, 1, 12)).isAdjacent( Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); -------------------- +/ bool isAdjacent(in Interval!TP interval) const pure { interval._enforceNotEmpty(); return _begin == interval._end; } /++ Whether the given interval is adjacent to this interval. Always returns false because two intervals going to positive infinity can never be adjacent to one another. Params: interval = The interval to check whether its adjecent to this interval. Examples: -------------------- assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAdjacent( PosInfInterval!Date(Date(1990, 1, 7)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAdjacent( PosInfInterval!Date(Date(1996, 1, 2)))); -------------------- +/ bool isAdjacent(in PosInfInterval interval) const pure nothrow { return false; } /++ Whether the given interval is adjacent to this interval. Params: interval = The interval to check whether its adjecent to this interval. Examples: -------------------- assert(PosInfInterval!Date(Date(1996, 1, 2)).isAdjacent( NegInfInterval!Date(Date(1996, 1, 2)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAdjacent( NegInfInterval!Date(Date(2000, 7, 1)))); -------------------- +/ bool isAdjacent(in NegInfInterval!TP interval) const pure nothrow { return _begin == interval._end; } /++ Returns the union of two intervals Params: interval = The interval to merge with this interval. Throws: $(D DateTimeException) if the two intervals do not intersect and are not adjacent or if the given interval is empty. Note: There is no overload for $(D merge) which takes a $(D NegInfInterval), because an interval going from negative infinity to positive infinity is not possible. Examples: -------------------- assert(PosInfInterval!Date(Date(1996, 1, 2)).merge( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == PosInfInterval!Date(Date(1990, 7 , 6))); assert(PosInfInterval!Date(Date(1996, 1, 2)).merge( Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))) == PosInfInterval!Date(Date(1996, 1 , 2))); -------------------- +/ PosInfInterval merge(in Interval!TP interval) const { enforce(this.isAdjacent(interval) || this.intersects(interval), new DateTimeException(format("%s and %s are not adjacent and do not intersect.", this, interval))); return PosInfInterval(_begin < interval._begin ? _begin : interval._begin); } /++ Returns the union of two intervals Params: interval = The interval to merge with this interval. Note: There is no overload for $(D merge) which takes a $(D NegInfInterval), because an interval going from negative infinity to positive infinity is not possible. Examples: -------------------- assert(PosInfInterval!Date(Date(1996, 1, 2)).merge( PosInfInterval!Date(Date(1990, 7, 6))) == PosInfInterval!Date(Date(1990, 7 , 6))); assert(PosInfInterval!Date(Date(1996, 1, 2)).merge( PosInfInterval!Date(Date(1999, 1, 12))) == PosInfInterval!Date(Date(1996, 1 , 2))); -------------------- +/ PosInfInterval merge(in PosInfInterval interval) const pure nothrow { return PosInfInterval(_begin < interval._begin ? _begin : interval._begin); } /++ Returns an interval that covers from the earliest time point of two intervals up to (but not including) the latest time point of two intervals. Params: interval = The interval to create a span together with this interval. Throws: $(D DateTimeException) if the given interval is empty. Note: There is no overload for $(D span) which takes a $(D NegInfInterval), because an interval going from negative infinity to positive infinity is not possible. Examples: -------------------- assert(PosInfInterval!Date(Date(1996, 1, 2)).span( Interval!Date(Date(500, 8, 9), Date(1602, 1, 31))) == PosInfInterval!Date(Date(500, 8, 9))); assert(PosInfInterval!Date(Date(1996, 1, 2)).span( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == PosInfInterval!Date(Date(1990, 7 , 6))); assert(PosInfInterval!Date(Date(1996, 1, 2)).span( Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))) == PosInfInterval!Date(Date(1996, 1 , 2))); -------------------- +/ PosInfInterval span(in Interval!TP interval) const pure { interval._enforceNotEmpty(); return PosInfInterval(_begin < interval._begin ? _begin : interval._begin); } /++ Returns an interval that covers from the earliest time point of two intervals up to (but not including) the latest time point of two intervals. Params: interval = The interval to create a span together with this interval. Note: There is no overload for $(D span) which takes a $(D NegInfInterval), because an interval going from negative infinity to positive infinity is not possible. Examples: -------------------- assert(PosInfInterval!Date(Date(1996, 1, 2)).span( PosInfInterval!Date(Date(1990, 7, 6))) == PosInfInterval!Date(Date(1990, 7 , 6))); assert(PosInfInterval!Date(Date(1996, 1, 2)).span( PosInfInterval!Date(Date(1999, 1, 12))) == PosInfInterval!Date(Date(1996, 1 , 2))); -------------------- +/ PosInfInterval span(in PosInfInterval interval) const pure nothrow { return PosInfInterval(_begin < interval._begin ? _begin : interval._begin); } /++ Shifts the $(D begin) of this interval forward or backwards in time by the given duration (a positive duration shifts the interval forward; a negative duration shifts it backward). Effectively, it does $(D begin += duration). Params: duration = The duration to shift the interval by. Examples: -------------------- auto interval1 = PosInfInterval!Date(Date(1996, 1, 2)); auto interval2 = PosInfInterval!Date(Date(1996, 1, 2)); interval1.shift(dur!"days"(50)); assert(interval1 == PosInfInterval!Date(Date(1996, 2, 21))); interval2.shift(dur!"days"(-50)); assert(interval2 == PosInfInterval!Date(Date(1995, 11, 13))); -------------------- +/ void shift(D)(D duration) pure nothrow if(__traits(compiles, begin + duration)) { _begin += duration; } static if(__traits(compiles, begin.add!"months"(1)) && __traits(compiles, begin.add!"years"(1))) { /++ Shifts the $(D begin) of this interval forward or backwards in time by the given number of years and/or months (a positive number of years and months shifts the interval forward; a negative number shifts it backward). It adds the years the given years and months to $(D begin). It effectively calls $(D add!"years"()) and then $(D add!"months"()) on $(D begin) with the given number of years and months. Params: years = The number of years to shift the interval by. months = The number of months to shift the interval by. allowOverflow = Whether the days should be allowed to overflow on $(D begin), causing its month to increment. Throws: $(D DateTimeException) if this interval is empty or if the resulting interval would be invalid. Examples: -------------------- auto interval1 = PosInfInterval!Date(Date(1996, 1, 2)); auto interval2 = PosInfInterval!Date(Date(1996, 1, 2)); interval1.shift(dur!"days"(50)); assert(interval1 == PosInfInterval!Date(Date(1996, 2, 21))); interval2.shift(dur!"days"(-50)); assert(interval2 == PosInfInterval!Date(Date(1995, 11, 13))); -------------------- +/ void shift(T)(T years, T months = 0, AllowDayOverflow allowOverflow = AllowDayOverflow.yes) if(isIntegral!T) { auto begin = _begin; begin.add!"years"(years, allowOverflow); begin.add!"months"(months, allowOverflow); _begin = begin; } } /++ Expands the interval backwards in time. Effectively, it does $(D begin -= duration). Params: duration = The duration to expand the interval by. dir = The direction in time to expand the interval. Examples: -------------------- auto interval1 = PosInfInterval!Date(Date(1996, 1, 2)); auto interval2 = PosInfInterval!Date(Date(1996, 1, 2)); interval1.expand(dur!"days"(2)); assert(interval1 == PosInfInterval!Date(Date(1995, 12, 31))); interval2.expand(dur!"days"(-2)); assert(interval2 == PosInfInterval!Date(Date(1996, 1, 4))); -------------------- +/ void expand(D)(D duration) pure nothrow if(__traits(compiles, begin + duration)) { _begin -= duration; } static if(__traits(compiles, begin.add!"months"(1)) && __traits(compiles, begin.add!"years"(1))) { /++ Expands the interval forwards and/or backwards in time. Effectively, it subtracts the given number of months/years from $(D begin). Params: years = The number of years to expand the interval by. months = The number of months to expand the interval by. allowOverflow = Whether the days should be allowed to overflow on $(D begin), causing its month to increment. Throws: $(D DateTimeException) if this interval is empty or if the resulting interval would be invalid. Examples: -------------------- auto interval1 = PosInfInterval!Date(Date(1996, 1, 2)); auto interval2 = PosInfInterval!Date(Date(1996, 1, 2)); interval1.expand(2); assert(interval1 == PosInfInterval!Date(Date(1994, 1, 2))); interval2.expand(-2); assert(interval2 == PosInfInterval!Date(Date(1998, 1, 2))); -------------------- +/ void expand(T)(T years, T months = 0, AllowDayOverflow allowOverflow = AllowDayOverflow.yes) if(isIntegral!T) { auto begin = _begin; begin.add!"years"(-years, allowOverflow); begin.add!"months"(-months, allowOverflow); _begin = begin; return; } } /++ Returns a range which iterates forward over the interval, starting at $(D begin), using $(D_PARAM func) to generate each successive time point. The range's $(D front) is the interval's $(D begin). $(D_PARAM func) is used to generate the next $(D front) when $(D popFront) is called. If $(D_PARAM popFirst) is $(D PopFirst.yes), then $(D popFront) is called before the range is returned (so that $(D front) is a time point which $(D_PARAM func) would generate). If $(D_PARAM func) ever generates a time point less than or equal to the current $(D front) of the range, then a $(D DateTimeException) will be thrown. There are helper functions in this module which generate common delegates to pass to $(D fwdRange). Their documentation starts with "Range-generating function," to make them easily searchable. Params: func = The function used to generate the time points of the range over the interval. popFirst = Whether $(D popFront) should be called on the range before returning it. Throws: $(D DateTimeException) if this interval is empty. Warning: $(D_PARAM func) must be logically pure. Ideally, $(D_PARAM func) would be a function pointer to a pure function, but forcing $(D_PARAM func) to be pure is far too restrictive to be useful, and in order to have the ease of use of having functions which generate functions to pass to $(D fwdRange), $(D_PARAM func) must be a delegate. If $(D_PARAM func) retains state which changes as it is called, then some algorithms will not work correctly, because the range's $(D save) will have failed to have really saved the range's state. To avoid such bugs, don't pass a delegate which is not logically pure to $(D fwdRange). If $(D_PARAM func) is given the same time point with two different calls, it must return the same result both times. Of course, none of the functions in this module have this problem, so it's only relevant for custom delegates. Examples: -------------------- auto interval = PosInfInterval!Date(Date(2010, 9, 1)); auto func = (in Date date) //For iterating over even-numbered days. { if((date.day & 1) == 0) return date + dur!"days"(2); return date + dur!"days"(1); }; auto range = interval.fwdRange(func); //An odd day. Using PopFirst.yes would have made this Date(2010, 9, 2). assert(range.front == Date(2010, 9, 1)); range.popFront(); assert(range.front == Date(2010, 9, 2)); range.popFront(); assert(range.front == Date(2010, 9, 4)); range.popFront(); assert(range.front == Date(2010, 9, 6)); range.popFront(); assert(range.front == Date(2010, 9, 8)); range.popFront(); assert(!range.empty); -------------------- +/ PosInfIntervalRange!(TP) fwdRange(TP delegate(in TP) func, PopFirst popFirst = PopFirst.no) const { auto range = PosInfIntervalRange!(TP)(this, func); if(popFirst == PopFirst.yes) range.popFront(); return range; } /+ Converts this interval to a string. +/ //Due to bug http://d.puremagic.com/issues/show_bug.cgi?id=3715 , we can't //have versions of toString() with extra modifiers, so we define one version //with modifiers and one without. string toString() { return _toStringImpl(); } /++ Converts this interval to a string. +/ //Due to bug http://d.puremagic.com/issues/show_bug.cgi?id=3715 , we can't //have versions of toString() with extra modifiers, so we define one version //with modifiers and one without. string toString() const nothrow { return _toStringImpl(); } private: /+ Since we have two versions of toString(), we have _toStringImpl() so that they can share implementations. +/ string _toStringImpl() const nothrow { try return format("[%s - ∞)", _begin); catch(Exception e) assert(0, "format() threw."); } TP _begin; } //Test PosInfInterval's constructor. unittest { version(testStdDateTime) { PosInfInterval!Date(Date.init); PosInfInterval!TimeOfDay(TimeOfDay.init); PosInfInterval!DateTime(DateTime.init); PosInfInterval!SysTime(SysTime(0)); //Verify Examples. auto interval = PosInfInterval!Date(Date(1996, 1, 2)); } } //Test PosInfInterval's begin. unittest { version(testStdDateTime) { _assertPred!"=="(PosInfInterval!Date(Date(1, 1, 1)).begin, Date(1, 1, 1)); _assertPred!"=="(PosInfInterval!Date(Date(2010, 1, 1)).begin, Date(2010, 1, 1)); _assertPred!"=="(PosInfInterval!Date(Date(1997, 12, 31)).begin, Date(1997, 12, 31)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); static assert(__traits(compiles, cPosInfInterval.begin)); static assert(__traits(compiles, iPosInfInterval.begin)); //Verify Examples. assert(PosInfInterval!Date(Date(1996, 1, 2)).begin == Date(1996, 1, 2)); } } //Test PosInfInterval's empty. unittest { version(testStdDateTime) { assert(!PosInfInterval!Date(Date(2010, 1, 1)).empty); assert(!PosInfInterval!TimeOfDay(TimeOfDay(0, 30, 0)).empty); assert(!PosInfInterval!DateTime(DateTime(2010, 1, 1, 0, 30, 0)).empty); assert(!PosInfInterval!SysTime(SysTime(DateTime(2010, 1, 1, 0, 30, 0))).empty); const cPosInfInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iPosInfInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); static assert(__traits(compiles, cPosInfInterval.empty)); static assert(__traits(compiles, iPosInfInterval.empty)); //Verify Examples. assert(!PosInfInterval!Date(Date(1996, 1, 2)).empty); } } //Test PosInfInterval's contains(time point). unittest { version(testStdDateTime) { auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); assert(!posInfInterval.contains(Date(2009, 7, 4))); assert(!posInfInterval.contains(Date(2010, 7, 3))); assert(posInfInterval.contains(Date(2010, 7, 4))); assert(posInfInterval.contains(Date(2010, 7, 5))); assert(posInfInterval.contains(Date(2011, 7, 1))); assert(posInfInterval.contains(Date(2012, 1, 6))); assert(posInfInterval.contains(Date(2012, 1, 7))); assert(posInfInterval.contains(Date(2012, 1, 8))); assert(posInfInterval.contains(Date(2013, 1, 7))); const cdate = Date(2010, 7, 6); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); static assert(__traits(compiles, posInfInterval.contains(cdate))); static assert(__traits(compiles, cPosInfInterval.contains(cdate))); static assert(__traits(compiles, iPosInfInterval.contains(cdate))); //Verify Examples. assert(!PosInfInterval!Date(Date(1996, 1, 2)).contains(Date(1994, 12, 24))); assert(PosInfInterval!Date(Date(1996, 1, 2)).contains(Date(2000, 1, 5))); } } //Test PosInfInterval's contains(Interval). unittest { version(testStdDateTime) { auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); static void testInterval(in PosInfInterval!Date posInfInterval, in Interval!Date interval) { posInfInterval.contains(interval); } assertThrown!DateTimeException(testInterval(posInfInterval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assert(posInfInterval.contains(posInfInterval)); assert(!posInfInterval.contains(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assert(!posInfInterval.contains(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)))); assert(!posInfInterval.contains(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)))); assert(!posInfInterval.contains(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)))); assert(!posInfInterval.contains(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)))); assert(!posInfInterval.contains(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)))); assert(posInfInterval.contains(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)))); assert(posInfInterval.contains(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)))); assert(posInfInterval.contains(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)))); assert(posInfInterval.contains(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)))); assert(posInfInterval.contains(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)))); assert(posInfInterval.contains(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assert(!posInfInterval.contains(PosInfInterval!Date(Date(2010, 7, 3)))); assert(posInfInterval.contains(PosInfInterval!Date(Date(2010, 7, 4)))); assert(posInfInterval.contains(PosInfInterval!Date(Date(2010, 7, 5)))); assert(posInfInterval.contains(PosInfInterval!Date(Date(2012, 1, 6)))); assert(posInfInterval.contains(PosInfInterval!Date(Date(2012, 1, 7)))); assert(posInfInterval.contains(PosInfInterval!Date(Date(2012, 1, 8)))); assert(PosInfInterval!Date(Date(2010, 7, 3)).contains(posInfInterval)); assert(PosInfInterval!Date(Date(2010, 7, 4)).contains(posInfInterval)); assert(!PosInfInterval!Date(Date(2010, 7, 5)).contains(posInfInterval)); assert(!PosInfInterval!Date(Date(2012, 1, 6)).contains(posInfInterval)); assert(!PosInfInterval!Date(Date(2012, 1, 7)).contains(posInfInterval)); assert(!PosInfInterval!Date(Date(2012, 1, 8)).contains(posInfInterval)); assert(!posInfInterval.contains(NegInfInterval!Date(Date(2010, 7, 3)))); assert(!posInfInterval.contains(NegInfInterval!Date(Date(2010, 7, 4)))); assert(!posInfInterval.contains(NegInfInterval!Date(Date(2010, 7, 5)))); assert(!posInfInterval.contains(NegInfInterval!Date(Date(2012, 1, 6)))); assert(!posInfInterval.contains(NegInfInterval!Date(Date(2012, 1, 7)))); assert(!posInfInterval.contains(NegInfInterval!Date(Date(2012, 1, 8)))); auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, posInfInterval.contains(interval))); static assert(__traits(compiles, posInfInterval.contains(cInterval))); static assert(__traits(compiles, posInfInterval.contains(iInterval))); static assert(__traits(compiles, posInfInterval.contains(posInfInterval))); static assert(__traits(compiles, posInfInterval.contains(cPosInfInterval))); static assert(__traits(compiles, posInfInterval.contains(iPosInfInterval))); static assert(__traits(compiles, posInfInterval.contains(negInfInterval))); static assert(__traits(compiles, posInfInterval.contains(cNegInfInterval))); static assert(__traits(compiles, posInfInterval.contains(iNegInfInterval))); static assert(__traits(compiles, cPosInfInterval.contains(interval))); static assert(__traits(compiles, cPosInfInterval.contains(cInterval))); static assert(__traits(compiles, cPosInfInterval.contains(iInterval))); static assert(__traits(compiles, cPosInfInterval.contains(posInfInterval))); static assert(__traits(compiles, cPosInfInterval.contains(cPosInfInterval))); static assert(__traits(compiles, cPosInfInterval.contains(iPosInfInterval))); static assert(__traits(compiles, cPosInfInterval.contains(negInfInterval))); static assert(__traits(compiles, cPosInfInterval.contains(cNegInfInterval))); static assert(__traits(compiles, cPosInfInterval.contains(iNegInfInterval))); static assert(__traits(compiles, iPosInfInterval.contains(interval))); static assert(__traits(compiles, iPosInfInterval.contains(cInterval))); static assert(__traits(compiles, iPosInfInterval.contains(iInterval))); static assert(__traits(compiles, iPosInfInterval.contains(posInfInterval))); static assert(__traits(compiles, iPosInfInterval.contains(cPosInfInterval))); static assert(__traits(compiles, iPosInfInterval.contains(iPosInfInterval))); static assert(__traits(compiles, iPosInfInterval.contains(negInfInterval))); static assert(__traits(compiles, iPosInfInterval.contains(cNegInfInterval))); static assert(__traits(compiles, iPosInfInterval.contains(iNegInfInterval))); //Verify Examples. assert(!PosInfInterval!Date(Date(1996, 1, 2)).contains(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(PosInfInterval!Date(Date(1996, 1, 2)).contains(Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(PosInfInterval!Date(Date(1996, 1, 2)).contains(Interval!Date(Date(1998, 2, 28), Date(2013, 5, 1)))); assert(PosInfInterval!Date(Date(1996, 1, 2)).contains(PosInfInterval!Date(Date(1999, 5, 4)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).contains(PosInfInterval!Date(Date(1995, 7, 2)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).contains(NegInfInterval!Date(Date(1996, 5, 4)))); } } //Test PosInfInterval's isBefore(time point). unittest { version(testStdDateTime) { auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); assert(!posInfInterval.isBefore(Date(2009, 7, 3))); assert(!posInfInterval.isBefore(Date(2010, 7, 3))); assert(!posInfInterval.isBefore(Date(2010, 7, 4))); assert(!posInfInterval.isBefore(Date(2010, 7, 5))); assert(!posInfInterval.isBefore(Date(2011, 7, 1))); assert(!posInfInterval.isBefore(Date(2012, 1, 6))); assert(!posInfInterval.isBefore(Date(2012, 1, 7))); assert(!posInfInterval.isBefore(Date(2012, 1, 8))); assert(!posInfInterval.isBefore(Date(2013, 1, 7))); const cdate = Date(2010, 7, 6); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); static assert(__traits(compiles, posInfInterval.isBefore(cdate))); static assert(__traits(compiles, cPosInfInterval.isBefore(cdate))); static assert(__traits(compiles, iPosInfInterval.isBefore(cdate))); //Verify Examples. assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore(Date(1994, 12, 24))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore(Date(2000, 1, 5))); } } //Test PosInfInterval's isBefore(Interval). unittest { version(testStdDateTime) { auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); static void testInterval(in PosInfInterval!Date posInfInterval, in Interval!Date interval) { posInfInterval.isBefore(interval); } assertThrown!DateTimeException(testInterval(posInfInterval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assert(!posInfInterval.isBefore(posInfInterval)); assert(!posInfInterval.isBefore(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assert(!posInfInterval.isBefore(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)))); assert(!posInfInterval.isBefore(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)))); assert(!posInfInterval.isBefore(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)))); assert(!posInfInterval.isBefore(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)))); assert(!posInfInterval.isBefore(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)))); assert(!posInfInterval.isBefore(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)))); assert(!posInfInterval.isBefore(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)))); assert(!posInfInterval.isBefore(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)))); assert(!posInfInterval.isBefore(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)))); assert(!posInfInterval.isBefore(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)))); assert(!posInfInterval.isBefore(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assert(!posInfInterval.isBefore(PosInfInterval!Date(Date(2010, 7, 3)))); assert(!posInfInterval.isBefore(PosInfInterval!Date(Date(2010, 7, 4)))); assert(!posInfInterval.isBefore(PosInfInterval!Date(Date(2010, 7, 5)))); assert(!posInfInterval.isBefore(PosInfInterval!Date(Date(2012, 1, 6)))); assert(!posInfInterval.isBefore(PosInfInterval!Date(Date(2012, 1, 7)))); assert(!posInfInterval.isBefore(PosInfInterval!Date(Date(2012, 1, 8)))); assert(!PosInfInterval!Date(Date(2010, 7, 3)).isBefore(posInfInterval)); assert(!PosInfInterval!Date(Date(2010, 7, 4)).isBefore(posInfInterval)); assert(!PosInfInterval!Date(Date(2010, 7, 5)).isBefore(posInfInterval)); assert(!PosInfInterval!Date(Date(2012, 1, 6)).isBefore(posInfInterval)); assert(!PosInfInterval!Date(Date(2012, 1, 7)).isBefore(posInfInterval)); assert(!PosInfInterval!Date(Date(2012, 1, 8)).isBefore(posInfInterval)); assert(!posInfInterval.isBefore(NegInfInterval!Date(Date(2010, 7, 3)))); assert(!posInfInterval.isBefore(NegInfInterval!Date(Date(2010, 7, 4)))); assert(!posInfInterval.isBefore(NegInfInterval!Date(Date(2010, 7, 5)))); assert(!posInfInterval.isBefore(NegInfInterval!Date(Date(2012, 1, 6)))); assert(!posInfInterval.isBefore(NegInfInterval!Date(Date(2012, 1, 7)))); assert(!posInfInterval.isBefore(NegInfInterval!Date(Date(2012, 1, 8)))); auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, posInfInterval.isBefore(interval))); static assert(__traits(compiles, posInfInterval.isBefore(cInterval))); static assert(__traits(compiles, posInfInterval.isBefore(iInterval))); static assert(__traits(compiles, posInfInterval.isBefore(posInfInterval))); static assert(__traits(compiles, posInfInterval.isBefore(cPosInfInterval))); static assert(__traits(compiles, posInfInterval.isBefore(iPosInfInterval))); static assert(__traits(compiles, posInfInterval.isBefore(negInfInterval))); static assert(__traits(compiles, posInfInterval.isBefore(cNegInfInterval))); static assert(__traits(compiles, posInfInterval.isBefore(iNegInfInterval))); static assert(__traits(compiles, cPosInfInterval.isBefore(interval))); static assert(__traits(compiles, cPosInfInterval.isBefore(cInterval))); static assert(__traits(compiles, cPosInfInterval.isBefore(iInterval))); static assert(__traits(compiles, cPosInfInterval.isBefore(posInfInterval))); static assert(__traits(compiles, cPosInfInterval.isBefore(cPosInfInterval))); static assert(__traits(compiles, cPosInfInterval.isBefore(iPosInfInterval))); static assert(__traits(compiles, cPosInfInterval.isBefore(negInfInterval))); static assert(__traits(compiles, cPosInfInterval.isBefore(cNegInfInterval))); static assert(__traits(compiles, cPosInfInterval.isBefore(iNegInfInterval))); static assert(__traits(compiles, iPosInfInterval.isBefore(interval))); static assert(__traits(compiles, iPosInfInterval.isBefore(cInterval))); static assert(__traits(compiles, iPosInfInterval.isBefore(iInterval))); static assert(__traits(compiles, iPosInfInterval.isBefore(posInfInterval))); static assert(__traits(compiles, iPosInfInterval.isBefore(cPosInfInterval))); static assert(__traits(compiles, iPosInfInterval.isBefore(iPosInfInterval))); static assert(__traits(compiles, iPosInfInterval.isBefore(negInfInterval))); static assert(__traits(compiles, iPosInfInterval.isBefore(cNegInfInterval))); static assert(__traits(compiles, iPosInfInterval.isBefore(iNegInfInterval))); //Verify Examples. assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore(Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore(PosInfInterval!Date(Date(1992, 5, 4)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore(PosInfInterval!Date(Date(2013, 3, 7)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isBefore(NegInfInterval!Date(Date(1996, 5, 4)))); } } //Test PosInfInterval's isAfter(time point). unittest { version(testStdDateTime) { auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); assert(posInfInterval.isAfter(Date(2009, 7, 3))); assert(posInfInterval.isAfter(Date(2010, 7, 3))); assert(!posInfInterval.isAfter(Date(2010, 7, 4))); assert(!posInfInterval.isAfter(Date(2010, 7, 5))); assert(!posInfInterval.isAfter(Date(2011, 7, 1))); assert(!posInfInterval.isAfter(Date(2012, 1, 6))); assert(!posInfInterval.isAfter(Date(2012, 1, 7))); assert(!posInfInterval.isAfter(Date(2012, 1, 8))); assert(!posInfInterval.isAfter(Date(2013, 1, 7))); const cdate = Date(2010, 7, 6); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); static assert(__traits(compiles, posInfInterval.isAfter(cdate))); static assert(__traits(compiles, cPosInfInterval.isAfter(cdate))); static assert(__traits(compiles, iPosInfInterval.isAfter(cdate))); //Verify Examples. assert(PosInfInterval!Date(Date(1996, 1, 2)).isAfter(Date(1994, 12, 24))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter(Date(2000, 1, 5))); } } //Test PosInfInterval's isAfter(Interval). unittest { version(testStdDateTime) { auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); static void testInterval(in PosInfInterval!Date posInfInterval, in Interval!Date interval) { posInfInterval.isAfter(interval); } assertThrown!DateTimeException(testInterval(posInfInterval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assert(!posInfInterval.isAfter(posInfInterval)); assert(posInfInterval.isAfter(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assert(!posInfInterval.isAfter(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)))); assert(posInfInterval.isAfter(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)))); assert(!posInfInterval.isAfter(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)))); assert(!posInfInterval.isAfter(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)))); assert(!posInfInterval.isAfter(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)))); assert(!posInfInterval.isAfter(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)))); assert(!posInfInterval.isAfter(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)))); assert(!posInfInterval.isAfter(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)))); assert(!posInfInterval.isAfter(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)))); assert(!posInfInterval.isAfter(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)))); assert(!posInfInterval.isAfter(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assert(!posInfInterval.isAfter(PosInfInterval!Date(Date(2010, 7, 3)))); assert(!posInfInterval.isAfter(PosInfInterval!Date(Date(2010, 7, 4)))); assert(!posInfInterval.isAfter(PosInfInterval!Date(Date(2010, 7, 5)))); assert(!posInfInterval.isAfter(PosInfInterval!Date(Date(2012, 1, 6)))); assert(!posInfInterval.isAfter(PosInfInterval!Date(Date(2012, 1, 7)))); assert(!posInfInterval.isAfter(PosInfInterval!Date(Date(2012, 1, 8)))); assert(!PosInfInterval!Date(Date(2010, 7, 3)).isAfter(posInfInterval)); assert(!PosInfInterval!Date(Date(2010, 7, 4)).isAfter(posInfInterval)); assert(!PosInfInterval!Date(Date(2010, 7, 5)).isAfter(posInfInterval)); assert(!PosInfInterval!Date(Date(2012, 1, 6)).isAfter(posInfInterval)); assert(!PosInfInterval!Date(Date(2012, 1, 7)).isAfter(posInfInterval)); assert(!PosInfInterval!Date(Date(2012, 1, 8)).isAfter(posInfInterval)); assert(posInfInterval.isAfter(NegInfInterval!Date(Date(2010, 7, 3)))); assert(posInfInterval.isAfter(NegInfInterval!Date(Date(2010, 7, 4)))); assert(!posInfInterval.isAfter(NegInfInterval!Date(Date(2010, 7, 5)))); assert(!posInfInterval.isAfter(NegInfInterval!Date(Date(2012, 1, 6)))); assert(!posInfInterval.isAfter(NegInfInterval!Date(Date(2012, 1, 7)))); assert(!posInfInterval.isAfter(NegInfInterval!Date(Date(2012, 1, 8)))); auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, posInfInterval.isAfter(interval))); static assert(__traits(compiles, posInfInterval.isAfter(cInterval))); static assert(__traits(compiles, posInfInterval.isAfter(iInterval))); static assert(__traits(compiles, posInfInterval.isAfter(posInfInterval))); static assert(__traits(compiles, posInfInterval.isAfter(cPosInfInterval))); static assert(__traits(compiles, posInfInterval.isAfter(iPosInfInterval))); static assert(__traits(compiles, posInfInterval.isAfter(negInfInterval))); static assert(__traits(compiles, posInfInterval.isAfter(cNegInfInterval))); static assert(__traits(compiles, posInfInterval.isAfter(iNegInfInterval))); static assert(__traits(compiles, cPosInfInterval.isAfter(interval))); static assert(__traits(compiles, cPosInfInterval.isAfter(cInterval))); static assert(__traits(compiles, cPosInfInterval.isAfter(iInterval))); static assert(__traits(compiles, cPosInfInterval.isAfter(posInfInterval))); static assert(__traits(compiles, cPosInfInterval.isAfter(cPosInfInterval))); static assert(__traits(compiles, cPosInfInterval.isAfter(iPosInfInterval))); static assert(__traits(compiles, cPosInfInterval.isAfter(negInfInterval))); static assert(__traits(compiles, cPosInfInterval.isAfter(cNegInfInterval))); static assert(__traits(compiles, cPosInfInterval.isAfter(iNegInfInterval))); static assert(__traits(compiles, iPosInfInterval.isAfter(interval))); static assert(__traits(compiles, iPosInfInterval.isAfter(cInterval))); static assert(__traits(compiles, iPosInfInterval.isAfter(iInterval))); static assert(__traits(compiles, iPosInfInterval.isAfter(posInfInterval))); static assert(__traits(compiles, iPosInfInterval.isAfter(cPosInfInterval))); static assert(__traits(compiles, iPosInfInterval.isAfter(iPosInfInterval))); static assert(__traits(compiles, iPosInfInterval.isAfter(negInfInterval))); static assert(__traits(compiles, iPosInfInterval.isAfter(cNegInfInterval))); static assert(__traits(compiles, iPosInfInterval.isAfter(iNegInfInterval))); //Verify Examples. assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter(Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(PosInfInterval!Date(Date(1996, 1, 2)).isAfter(Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter(PosInfInterval!Date(Date(1990, 1, 7)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter(PosInfInterval!Date(Date(1999, 5, 4)))); assert(PosInfInterval!Date(Date(1996, 1, 2)).isAfter(NegInfInterval!Date(Date(1996, 1, 2)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAfter(NegInfInterval!Date(Date(2000, 7, 1)))); } } //Test PosInfInterval's intersects(). unittest { version(testStdDateTime) { auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); static void testInterval(in PosInfInterval!Date posInfInterval, in Interval!Date interval) { posInfInterval.intersects(interval); } assertThrown!DateTimeException(testInterval(posInfInterval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assert(posInfInterval.intersects(posInfInterval)); assert(!posInfInterval.intersects(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assert(posInfInterval.intersects(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)))); assert(!posInfInterval.intersects(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)))); assert(posInfInterval.intersects(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)))); assert(posInfInterval.intersects(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)))); assert(posInfInterval.intersects(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)))); assert(posInfInterval.intersects(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)))); assert(posInfInterval.intersects(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)))); assert(posInfInterval.intersects(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)))); assert(posInfInterval.intersects(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)))); assert(posInfInterval.intersects(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)))); assert(posInfInterval.intersects(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assert(posInfInterval.intersects(PosInfInterval!Date(Date(2010, 7, 3)))); assert(posInfInterval.intersects(PosInfInterval!Date(Date(2010, 7, 4)))); assert(posInfInterval.intersects(PosInfInterval!Date(Date(2010, 7, 5)))); assert(posInfInterval.intersects(PosInfInterval!Date(Date(2012, 1, 6)))); assert(posInfInterval.intersects(PosInfInterval!Date(Date(2012, 1, 7)))); assert(posInfInterval.intersects(PosInfInterval!Date(Date(2012, 1, 8)))); assert(PosInfInterval!Date(Date(2010, 7, 3)).intersects(posInfInterval)); assert(PosInfInterval!Date(Date(2010, 7, 4)).intersects(posInfInterval)); assert(PosInfInterval!Date(Date(2010, 7, 5)).intersects(posInfInterval)); assert(PosInfInterval!Date(Date(2012, 1, 6)).intersects(posInfInterval)); assert(PosInfInterval!Date(Date(2012, 1, 7)).intersects(posInfInterval)); assert(PosInfInterval!Date(Date(2012, 1, 8)).intersects(posInfInterval)); assert(!posInfInterval.intersects(NegInfInterval!Date(Date(2010, 7, 3)))); assert(!posInfInterval.intersects(NegInfInterval!Date(Date(2010, 7, 4)))); assert(posInfInterval.intersects(NegInfInterval!Date(Date(2010, 7, 5)))); assert(posInfInterval.intersects(NegInfInterval!Date(Date(2012, 1, 6)))); assert(posInfInterval.intersects(NegInfInterval!Date(Date(2012, 1, 7)))); assert(posInfInterval.intersects(NegInfInterval!Date(Date(2012, 1, 8)))); auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, posInfInterval.intersects(interval))); static assert(__traits(compiles, posInfInterval.intersects(cInterval))); static assert(__traits(compiles, posInfInterval.intersects(iInterval))); static assert(__traits(compiles, posInfInterval.intersects(posInfInterval))); static assert(__traits(compiles, posInfInterval.intersects(cPosInfInterval))); static assert(__traits(compiles, posInfInterval.intersects(iPosInfInterval))); static assert(__traits(compiles, posInfInterval.intersects(negInfInterval))); static assert(__traits(compiles, posInfInterval.intersects(cNegInfInterval))); static assert(__traits(compiles, posInfInterval.intersects(iNegInfInterval))); static assert(__traits(compiles, cPosInfInterval.intersects(interval))); static assert(__traits(compiles, cPosInfInterval.intersects(cInterval))); static assert(__traits(compiles, cPosInfInterval.intersects(iInterval))); static assert(__traits(compiles, cPosInfInterval.intersects(posInfInterval))); static assert(__traits(compiles, cPosInfInterval.intersects(cPosInfInterval))); static assert(__traits(compiles, cPosInfInterval.intersects(iPosInfInterval))); static assert(__traits(compiles, cPosInfInterval.intersects(negInfInterval))); static assert(__traits(compiles, cPosInfInterval.intersects(cNegInfInterval))); static assert(__traits(compiles, cPosInfInterval.intersects(iNegInfInterval))); static assert(__traits(compiles, iPosInfInterval.intersects(interval))); static assert(__traits(compiles, iPosInfInterval.intersects(cInterval))); static assert(__traits(compiles, iPosInfInterval.intersects(iInterval))); static assert(__traits(compiles, iPosInfInterval.intersects(posInfInterval))); static assert(__traits(compiles, iPosInfInterval.intersects(cPosInfInterval))); static assert(__traits(compiles, iPosInfInterval.intersects(iPosInfInterval))); static assert(__traits(compiles, iPosInfInterval.intersects(negInfInterval))); static assert(__traits(compiles, iPosInfInterval.intersects(cNegInfInterval))); static assert(__traits(compiles, iPosInfInterval.intersects(iNegInfInterval))); //Verify Examples. assert(PosInfInterval!Date(Date(1996, 1, 2)).intersects(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(PosInfInterval!Date(Date(1996, 1, 2)).intersects(Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).intersects(Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2)))); assert(PosInfInterval!Date(Date(1996, 1, 2)).intersects(PosInfInterval!Date(Date(1990, 1, 7)))); assert(PosInfInterval!Date(Date(1996, 1, 2)).intersects(PosInfInterval!Date(Date(1999, 5, 4)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).intersects(NegInfInterval!Date(Date(1996, 1, 2)))); assert(PosInfInterval!Date(Date(1996, 1, 2)).intersects(NegInfInterval!Date(Date(2000, 7, 1)))); } } //Test PosInfInterval's intersection(). unittest { version(testStdDateTime) { auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); static void testInterval(I, J)(in I interval1, in J interval2) { interval1.intersection(interval2); } assertThrown!DateTimeException(testInterval(posInfInterval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assertThrown!DateTimeException(testInterval(posInfInterval, Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assertThrown!DateTimeException(testInterval(posInfInterval, Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)))); assertThrown!DateTimeException(testInterval(posInfInterval, NegInfInterval!Date(Date(2010, 7, 3)))); assertThrown!DateTimeException(testInterval(posInfInterval, NegInfInterval!Date(Date(2010, 7, 4)))); _assertPred!"=="(posInfInterval.intersection(posInfInterval), posInfInterval); _assertPred!"=="(posInfInterval.intersection(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3))), Interval!Date(Date(2010, 7, 4), Date(2013, 7, 3))); _assertPred!"=="(posInfInterval.intersection(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5))), Interval!Date(Date(2010, 7, 4), Date(2010, 7, 5))); _assertPred!"=="(posInfInterval.intersection(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(posInfInterval.intersection(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 8))); _assertPred!"=="(posInfInterval.intersection(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6))), Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6))); _assertPred!"=="(posInfInterval.intersection(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7))), Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7))); _assertPred!"=="(posInfInterval.intersection(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7))), Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7))); _assertPred!"=="(posInfInterval.intersection(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8))), Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8))); _assertPred!"=="(posInfInterval.intersection(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8))), Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8))); _assertPred!"=="(posInfInterval.intersection(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9))), Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9))); _assertPred!"=="(posInfInterval.intersection(PosInfInterval!Date(Date(2010, 7, 3))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.intersection(PosInfInterval!Date(Date(2010, 7, 4))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.intersection(PosInfInterval!Date(Date(2010, 7, 5))), PosInfInterval!Date(Date(2010, 7, 5))); _assertPred!"=="(posInfInterval.intersection(PosInfInterval!Date(Date(2012, 1, 6))), PosInfInterval!Date(Date(2012, 1, 6))); _assertPred!"=="(posInfInterval.intersection(PosInfInterval!Date(Date(2012, 1, 7))), PosInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(posInfInterval.intersection(PosInfInterval!Date(Date(2012, 1, 8))), PosInfInterval!Date(Date(2012, 1, 8))); _assertPred!"=="(PosInfInterval!Date(Date(2010, 7, 3)).intersection(posInfInterval), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(PosInfInterval!Date(Date(2010, 7, 4)).intersection(posInfInterval), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(PosInfInterval!Date(Date(2010, 7, 5)).intersection(posInfInterval), PosInfInterval!Date(Date(2010, 7, 5))); _assertPred!"=="(PosInfInterval!Date(Date(2012, 1, 6)).intersection(posInfInterval), PosInfInterval!Date(Date(2012, 1, 6))); _assertPred!"=="(PosInfInterval!Date(Date(2012, 1, 7)).intersection(posInfInterval), PosInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(PosInfInterval!Date(Date(2012, 1, 8)).intersection(posInfInterval), PosInfInterval!Date(Date(2012, 1, 8))); _assertPred!"=="(posInfInterval.intersection(NegInfInterval!Date(Date(2010, 7, 5))), Interval!Date(Date(2010, 7, 4), Date(2010, 7, 5))); _assertPred!"=="(posInfInterval.intersection(NegInfInterval!Date(Date(2012, 1, 6))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 6))); _assertPred!"=="(posInfInterval.intersection(NegInfInterval!Date(Date(2012, 1, 7))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7))); _assertPred!"=="(posInfInterval.intersection(NegInfInterval!Date(Date(2012, 1, 8))), Interval!Date(Date(2010, 7, 4), Date(2012, 1, 8))); auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, posInfInterval.intersection(interval))); static assert(__traits(compiles, posInfInterval.intersection(cInterval))); static assert(__traits(compiles, posInfInterval.intersection(iInterval))); static assert(__traits(compiles, posInfInterval.intersection(posInfInterval))); static assert(__traits(compiles, posInfInterval.intersection(cPosInfInterval))); static assert(__traits(compiles, posInfInterval.intersection(iPosInfInterval))); static assert(__traits(compiles, posInfInterval.intersection(negInfInterval))); static assert(__traits(compiles, posInfInterval.intersection(cNegInfInterval))); static assert(__traits(compiles, posInfInterval.intersection(iNegInfInterval))); static assert(__traits(compiles, cPosInfInterval.intersection(interval))); static assert(__traits(compiles, cPosInfInterval.intersection(cInterval))); static assert(__traits(compiles, cPosInfInterval.intersection(iInterval))); static assert(__traits(compiles, cPosInfInterval.intersection(posInfInterval))); static assert(__traits(compiles, cPosInfInterval.intersection(cPosInfInterval))); static assert(__traits(compiles, cPosInfInterval.intersection(iPosInfInterval))); static assert(__traits(compiles, cPosInfInterval.intersection(negInfInterval))); static assert(__traits(compiles, cPosInfInterval.intersection(cNegInfInterval))); static assert(__traits(compiles, cPosInfInterval.intersection(iNegInfInterval))); static assert(__traits(compiles, iPosInfInterval.intersection(interval))); static assert(__traits(compiles, iPosInfInterval.intersection(cInterval))); static assert(__traits(compiles, iPosInfInterval.intersection(iInterval))); static assert(__traits(compiles, iPosInfInterval.intersection(posInfInterval))); static assert(__traits(compiles, iPosInfInterval.intersection(cPosInfInterval))); static assert(__traits(compiles, iPosInfInterval.intersection(iPosInfInterval))); static assert(__traits(compiles, iPosInfInterval.intersection(negInfInterval))); static assert(__traits(compiles, iPosInfInterval.intersection(cNegInfInterval))); static assert(__traits(compiles, iPosInfInterval.intersection(iNegInfInterval))); //Verify Examples. assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == Interval!Date(Date(1996, 1 , 2), Date(2000, 8, 2))); assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection(Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))) == Interval!Date(Date(1999, 1 , 12), Date(2011, 9, 17))); assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection(PosInfInterval!Date(Date(1990, 7, 6))) == PosInfInterval!Date(Date(1996, 1 , 2))); assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection(PosInfInterval!Date(Date(1999, 1, 12))) == PosInfInterval!Date(Date(1999, 1 , 12))); assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection(NegInfInterval!Date(Date(1999, 7, 6))) == Interval!Date(Date(1996, 1 , 2), Date(1999, 7, 6))); assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection(NegInfInterval!Date(Date(2013, 1, 12))) == Interval!Date(Date(1996, 1 , 2), Date(2013, 1, 12))); } } //Test PosInfInterval's isAdjacent(). unittest { version(testStdDateTime) { auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); static void testInterval(in PosInfInterval!Date posInfInterval, in Interval!Date interval) { posInfInterval.isAdjacent(interval); } assertThrown!DateTimeException(testInterval(posInfInterval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assert(!posInfInterval.isAdjacent(posInfInterval)); assert(!posInfInterval.isAdjacent(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assert(!posInfInterval.isAdjacent(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)))); assert(posInfInterval.isAdjacent(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)))); assert(!posInfInterval.isAdjacent(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)))); assert(!posInfInterval.isAdjacent(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)))); assert(!posInfInterval.isAdjacent(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)))); assert(!posInfInterval.isAdjacent(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)))); assert(!posInfInterval.isAdjacent(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)))); assert(!posInfInterval.isAdjacent(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)))); assert(!posInfInterval.isAdjacent(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)))); assert(!posInfInterval.isAdjacent(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)))); assert(!posInfInterval.isAdjacent(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assert(!posInfInterval.isAdjacent(PosInfInterval!Date(Date(2010, 7, 3)))); assert(!posInfInterval.isAdjacent(PosInfInterval!Date(Date(2010, 7, 4)))); assert(!posInfInterval.isAdjacent(PosInfInterval!Date(Date(2010, 7, 5)))); assert(!posInfInterval.isAdjacent(PosInfInterval!Date(Date(2012, 1, 6)))); assert(!posInfInterval.isAdjacent(PosInfInterval!Date(Date(2012, 1, 7)))); assert(!posInfInterval.isAdjacent(PosInfInterval!Date(Date(2012, 1, 8)))); assert(!PosInfInterval!Date(Date(2010, 7, 3)).isAdjacent(posInfInterval)); assert(!PosInfInterval!Date(Date(2010, 7, 4)).isAdjacent(posInfInterval)); assert(!PosInfInterval!Date(Date(2010, 7, 5)).isAdjacent(posInfInterval)); assert(!PosInfInterval!Date(Date(2012, 1, 6)).isAdjacent(posInfInterval)); assert(!PosInfInterval!Date(Date(2012, 1, 7)).isAdjacent(posInfInterval)); assert(!PosInfInterval!Date(Date(2012, 1, 8)).isAdjacent(posInfInterval)); assert(!posInfInterval.isAdjacent(NegInfInterval!Date(Date(2010, 7, 3)))); assert(posInfInterval.isAdjacent(NegInfInterval!Date(Date(2010, 7, 4)))); assert(!posInfInterval.isAdjacent(NegInfInterval!Date(Date(2010, 7, 5)))); assert(!posInfInterval.isAdjacent(NegInfInterval!Date(Date(2012, 1, 6)))); assert(!posInfInterval.isAdjacent(NegInfInterval!Date(Date(2012, 1, 7)))); assert(!posInfInterval.isAdjacent(NegInfInterval!Date(Date(2012, 1, 8)))); auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, posInfInterval.isAdjacent(interval))); static assert(__traits(compiles, posInfInterval.isAdjacent(cInterval))); static assert(__traits(compiles, posInfInterval.isAdjacent(iInterval))); static assert(__traits(compiles, posInfInterval.isAdjacent(posInfInterval))); static assert(__traits(compiles, posInfInterval.isAdjacent(cPosInfInterval))); static assert(__traits(compiles, posInfInterval.isAdjacent(iPosInfInterval))); static assert(__traits(compiles, posInfInterval.isAdjacent(negInfInterval))); static assert(__traits(compiles, posInfInterval.isAdjacent(cNegInfInterval))); static assert(__traits(compiles, posInfInterval.isAdjacent(iNegInfInterval))); static assert(__traits(compiles, cPosInfInterval.isAdjacent(interval))); static assert(__traits(compiles, cPosInfInterval.isAdjacent(cInterval))); static assert(__traits(compiles, cPosInfInterval.isAdjacent(iInterval))); static assert(__traits(compiles, cPosInfInterval.isAdjacent(posInfInterval))); static assert(__traits(compiles, cPosInfInterval.isAdjacent(cPosInfInterval))); static assert(__traits(compiles, cPosInfInterval.isAdjacent(iPosInfInterval))); static assert(__traits(compiles, cPosInfInterval.isAdjacent(negInfInterval))); static assert(__traits(compiles, cPosInfInterval.isAdjacent(cNegInfInterval))); static assert(__traits(compiles, cPosInfInterval.isAdjacent(iNegInfInterval))); static assert(__traits(compiles, iPosInfInterval.isAdjacent(interval))); static assert(__traits(compiles, iPosInfInterval.isAdjacent(cInterval))); static assert(__traits(compiles, iPosInfInterval.isAdjacent(iInterval))); static assert(__traits(compiles, iPosInfInterval.isAdjacent(posInfInterval))); static assert(__traits(compiles, iPosInfInterval.isAdjacent(cPosInfInterval))); static assert(__traits(compiles, iPosInfInterval.isAdjacent(iPosInfInterval))); static assert(__traits(compiles, iPosInfInterval.isAdjacent(negInfInterval))); static assert(__traits(compiles, iPosInfInterval.isAdjacent(cNegInfInterval))); static assert(__traits(compiles, iPosInfInterval.isAdjacent(iNegInfInterval))); //Verify Examples. assert(PosInfInterval!Date(Date(1996, 1, 2)).isAdjacent(Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2)))); assert(!PosInfInterval!Date(Date(1999, 1, 12)).isAdjacent(Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAdjacent(PosInfInterval!Date(Date(1990, 1, 7)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAdjacent(PosInfInterval!Date(Date(1996, 1, 2)))); assert(PosInfInterval!Date(Date(1996, 1, 2)).isAdjacent(NegInfInterval!Date(Date(1996, 1, 2)))); assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAdjacent(NegInfInterval!Date(Date(2000, 7, 1)))); } } //Test PosInfInterval's merge(). unittest { version(testStdDateTime) { auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); static void testInterval(in PosInfInterval!Date posInfInterval, in Interval!Date interval) { posInfInterval.merge(interval); } assertThrown!DateTimeException(testInterval(posInfInterval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assertThrown!DateTimeException(testInterval(posInfInterval, Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); _assertPred!"=="(posInfInterval.merge(posInfInterval), posInfInterval); _assertPred!"=="(posInfInterval.merge(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3))), PosInfInterval!Date(Date(2010, 7, 1))); _assertPred!"=="(posInfInterval.merge(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4))), PosInfInterval!Date(Date(2010, 7, 3))); _assertPred!"=="(posInfInterval.merge(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5))), PosInfInterval!Date(Date(2010, 7, 3))); _assertPred!"=="(posInfInterval.merge(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))), PosInfInterval!Date(Date(2010, 7, 3))); _assertPred!"=="(posInfInterval.merge(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8))), PosInfInterval!Date(Date(2010, 7, 3))); _assertPred!"=="(posInfInterval.merge(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.merge(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.merge(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.merge(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.merge(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.merge(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.merge(PosInfInterval!Date(Date(2010, 7, 3))), PosInfInterval!Date(Date(2010, 7, 3))); _assertPred!"=="(posInfInterval.merge(PosInfInterval!Date(Date(2010, 7, 4))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.merge(PosInfInterval!Date(Date(2010, 7, 5))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.merge(PosInfInterval!Date(Date(2012, 1, 6))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.merge(PosInfInterval!Date(Date(2012, 1, 7))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.merge(PosInfInterval!Date(Date(2012, 1, 8))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(PosInfInterval!Date(Date(2010, 7, 3)).merge(posInfInterval), PosInfInterval!Date(Date(2010, 7, 3))); _assertPred!"=="(PosInfInterval!Date(Date(2010, 7, 4)).merge(posInfInterval), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(PosInfInterval!Date(Date(2010, 7, 5)).merge(posInfInterval), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(PosInfInterval!Date(Date(2012, 1, 6)).merge(posInfInterval), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(PosInfInterval!Date(Date(2012, 1, 7)).merge(posInfInterval), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(PosInfInterval!Date(Date(2012, 1, 8)).merge(posInfInterval), PosInfInterval!Date(Date(2010, 7, 4))); static assert(!__traits(compiles, posInfInterval.merge(NegInfInterval!Date(Date(2010, 7, 3))))); static assert(!__traits(compiles, posInfInterval.merge(NegInfInterval!Date(Date(2010, 7, 4))))); static assert(!__traits(compiles, posInfInterval.merge(NegInfInterval!Date(Date(2010, 7, 5))))); static assert(!__traits(compiles, posInfInterval.merge(NegInfInterval!Date(Date(2012, 1, 6))))); static assert(!__traits(compiles, posInfInterval.merge(NegInfInterval!Date(Date(2012, 1, 7))))); static assert(!__traits(compiles, posInfInterval.merge(NegInfInterval!Date(Date(2012, 1, 8))))); auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, posInfInterval.merge(interval))); static assert(__traits(compiles, posInfInterval.merge(cInterval))); static assert(__traits(compiles, posInfInterval.merge(iInterval))); static assert(__traits(compiles, posInfInterval.merge(posInfInterval))); static assert(__traits(compiles, posInfInterval.merge(cPosInfInterval))); static assert(__traits(compiles, posInfInterval.merge(iPosInfInterval))); static assert(!__traits(compiles, posInfInterval.merge(negInfInterval))); static assert(!__traits(compiles, posInfInterval.merge(cNegInfInterval))); static assert(!__traits(compiles, posInfInterval.merge(iNegInfInterval))); static assert(__traits(compiles, cPosInfInterval.merge(interval))); static assert(__traits(compiles, cPosInfInterval.merge(cInterval))); static assert(__traits(compiles, cPosInfInterval.merge(iInterval))); static assert(__traits(compiles, cPosInfInterval.merge(posInfInterval))); static assert(__traits(compiles, cPosInfInterval.merge(cPosInfInterval))); static assert(__traits(compiles, cPosInfInterval.merge(iPosInfInterval))); static assert(!__traits(compiles, cPosInfInterval.merge(negInfInterval))); static assert(!__traits(compiles, cPosInfInterval.merge(cNegInfInterval))); static assert(!__traits(compiles, cPosInfInterval.merge(iNegInfInterval))); static assert(__traits(compiles, iPosInfInterval.merge(interval))); static assert(__traits(compiles, iPosInfInterval.merge(cInterval))); static assert(__traits(compiles, iPosInfInterval.merge(iInterval))); static assert(__traits(compiles, iPosInfInterval.merge(posInfInterval))); static assert(__traits(compiles, iPosInfInterval.merge(cPosInfInterval))); static assert(__traits(compiles, iPosInfInterval.merge(iPosInfInterval))); static assert(!__traits(compiles, iPosInfInterval.merge(negInfInterval))); static assert(!__traits(compiles, iPosInfInterval.merge(cNegInfInterval))); static assert(!__traits(compiles, iPosInfInterval.merge(iNegInfInterval))); //Verify Examples. assert(PosInfInterval!Date(Date(1996, 1, 2)).merge(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == PosInfInterval!Date(Date(1990, 7 , 6))); assert(PosInfInterval!Date(Date(1996, 1, 2)).merge(Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))) == PosInfInterval!Date(Date(1996, 1 , 2))); assert(PosInfInterval!Date(Date(1996, 1, 2)).merge(PosInfInterval!Date(Date(1990, 7, 6))) == PosInfInterval!Date(Date(1990, 7 , 6))); assert(PosInfInterval!Date(Date(1996, 1, 2)).merge(PosInfInterval!Date(Date(1999, 1, 12))) == PosInfInterval!Date(Date(1996, 1 , 2))); } } //Test PosInfInterval's span(). unittest { version(testStdDateTime) { auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); static void testInterval(in PosInfInterval!Date posInfInterval, in Interval!Date interval) { posInfInterval.span(interval); } assertThrown!DateTimeException(testInterval(posInfInterval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); _assertPred!"=="(posInfInterval.span(posInfInterval), posInfInterval); _assertPred!"=="(posInfInterval.span(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3))), PosInfInterval!Date(Date(2010, 7, 1))); _assertPred!"=="(posInfInterval.span(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3))), PosInfInterval!Date(Date(2010, 7, 1))); _assertPred!"=="(posInfInterval.span(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4))), PosInfInterval!Date(Date(2010, 7, 3))); _assertPred!"=="(posInfInterval.span(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5))), PosInfInterval!Date(Date(2010, 7, 3))); _assertPred!"=="(posInfInterval.span(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))), PosInfInterval!Date(Date(2010, 7, 3))); _assertPred!"=="(posInfInterval.span(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8))), PosInfInterval!Date(Date(2010, 7, 3))); _assertPred!"=="(posInfInterval.span(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.span(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.span(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.span(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.span(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.span(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.span(PosInfInterval!Date(Date(2010, 7, 3))), PosInfInterval!Date(Date(2010, 7, 3))); _assertPred!"=="(posInfInterval.span(PosInfInterval!Date(Date(2010, 7, 4))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.span(PosInfInterval!Date(Date(2010, 7, 5))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.span(PosInfInterval!Date(Date(2012, 1, 6))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.span(PosInfInterval!Date(Date(2012, 1, 7))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(posInfInterval.span(PosInfInterval!Date(Date(2012, 1, 8))), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(PosInfInterval!Date(Date(2010, 7, 3)).span(posInfInterval), PosInfInterval!Date(Date(2010, 7, 3))); _assertPred!"=="(PosInfInterval!Date(Date(2010, 7, 4)).span(posInfInterval), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(PosInfInterval!Date(Date(2010, 7, 5)).span(posInfInterval), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(PosInfInterval!Date(Date(2012, 1, 6)).span(posInfInterval), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(PosInfInterval!Date(Date(2012, 1, 7)).span(posInfInterval), PosInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(PosInfInterval!Date(Date(2012, 1, 8)).span(posInfInterval), PosInfInterval!Date(Date(2010, 7, 4))); static assert(!__traits(compiles, posInfInterval.span(NegInfInterval!Date(Date(2010, 7, 3))))); static assert(!__traits(compiles, posInfInterval.span(NegInfInterval!Date(Date(2010, 7, 4))))); static assert(!__traits(compiles, posInfInterval.span(NegInfInterval!Date(Date(2010, 7, 5))))); static assert(!__traits(compiles, posInfInterval.span(NegInfInterval!Date(Date(2012, 1, 6))))); static assert(!__traits(compiles, posInfInterval.span(NegInfInterval!Date(Date(2012, 1, 7))))); static assert(!__traits(compiles, posInfInterval.span(NegInfInterval!Date(Date(2012, 1, 8))))); auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, posInfInterval.span(interval))); static assert(__traits(compiles, posInfInterval.span(cInterval))); static assert(__traits(compiles, posInfInterval.span(iInterval))); static assert(__traits(compiles, posInfInterval.span(posInfInterval))); static assert(__traits(compiles, posInfInterval.span(cPosInfInterval))); static assert(__traits(compiles, posInfInterval.span(iPosInfInterval))); static assert(!__traits(compiles, posInfInterval.span(negInfInterval))); static assert(!__traits(compiles, posInfInterval.span(cNegInfInterval))); static assert(!__traits(compiles, posInfInterval.span(iNegInfInterval))); static assert(__traits(compiles, cPosInfInterval.span(interval))); static assert(__traits(compiles, cPosInfInterval.span(cInterval))); static assert(__traits(compiles, cPosInfInterval.span(iInterval))); static assert(__traits(compiles, cPosInfInterval.span(posInfInterval))); static assert(__traits(compiles, cPosInfInterval.span(cPosInfInterval))); static assert(__traits(compiles, cPosInfInterval.span(iPosInfInterval))); static assert(!__traits(compiles, cPosInfInterval.span(negInfInterval))); static assert(!__traits(compiles, cPosInfInterval.span(cNegInfInterval))); static assert(!__traits(compiles, cPosInfInterval.span(iNegInfInterval))); static assert(__traits(compiles, iPosInfInterval.span(interval))); static assert(__traits(compiles, iPosInfInterval.span(cInterval))); static assert(__traits(compiles, iPosInfInterval.span(iInterval))); static assert(__traits(compiles, iPosInfInterval.span(posInfInterval))); static assert(__traits(compiles, iPosInfInterval.span(cPosInfInterval))); static assert(__traits(compiles, iPosInfInterval.span(iPosInfInterval))); static assert(!__traits(compiles, iPosInfInterval.span(negInfInterval))); static assert(!__traits(compiles, iPosInfInterval.span(cNegInfInterval))); static assert(!__traits(compiles, iPosInfInterval.span(iNegInfInterval))); //Verify Examples. assert(PosInfInterval!Date(Date(1996, 1, 2)).span(Interval!Date(Date(500, 8, 9), Date(1602, 1, 31))) == PosInfInterval!Date(Date(500, 8, 9))); assert(PosInfInterval!Date(Date(1996, 1, 2)).span(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == PosInfInterval!Date(Date(1990, 7 , 6))); assert(PosInfInterval!Date(Date(1996, 1, 2)).span(Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))) == PosInfInterval!Date(Date(1996, 1 , 2))); assert(PosInfInterval!Date(Date(1996, 1, 2)).span(PosInfInterval!Date(Date(1990, 7, 6))) == PosInfInterval!Date(Date(1990, 7 , 6))); assert(PosInfInterval!Date(Date(1996, 1, 2)).span(PosInfInterval!Date(Date(1999, 1, 12))) == PosInfInterval!Date(Date(1996, 1 , 2))); } } //Test PosInfInterval's shift(). unittest { version(testStdDateTime) { auto interval = PosInfInterval!Date(Date(2010, 7, 4)); static void testInterval(I)(I interval, in Duration duration, in I expected, size_t line = __LINE__) { interval.shift(duration); _assertPred!"=="(interval, expected, "", __FILE__, line); } testInterval(interval, dur!"days"(22), PosInfInterval!Date(Date(2010, 7, 26))); testInterval(interval, dur!"days"(-22), PosInfInterval!Date(Date(2010, 6, 12))); const cInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iInterval = PosInfInterval!Date(Date(2010, 7, 4)); static assert(!__traits(compiles, cInterval.shift(dur!"days"(5)))); static assert(!__traits(compiles, iInterval.shift(dur!"days"(5)))); //Verify Examples. auto interval1 = PosInfInterval!Date(Date(1996, 1, 2)); auto interval2 = PosInfInterval!Date(Date(1996, 1, 2)); interval1.shift(dur!"days"(50)); assert(interval1 == PosInfInterval!Date(Date(1996, 2, 21))); interval2.shift(dur!"days"(-50)); assert(interval2 == PosInfInterval!Date(Date(1995, 11, 13))); } } //Test PosInfInterval's shift(int, int, AllowDayOverflow). unittest { version(testStdDateTime) { { auto interval = PosInfInterval!Date(Date(2010, 7, 4)); static void testInterval(I)(I interval, int years, int months, AllowDayOverflow allow, in I expected, size_t line = __LINE__) { interval.shift(years, months, allow); _assertPred!"=="(interval, expected, "", __FILE__, line); } testInterval(interval, 5, 0, AllowDayOverflow.yes, PosInfInterval!Date(Date(2015, 7, 4))); testInterval(interval, -5, 0, AllowDayOverflow.yes, PosInfInterval!Date(Date(2005, 7, 4))); auto interval2 = PosInfInterval!Date(Date(2000, 1, 29)); testInterval(interval2, 1, 1, AllowDayOverflow.yes, PosInfInterval!Date(Date(2001, 3, 1))); testInterval(interval2, 1, -1, AllowDayOverflow.yes, PosInfInterval!Date(Date(2000, 12, 29))); testInterval(interval2, -1, -1, AllowDayOverflow.yes, PosInfInterval!Date(Date(1998, 12, 29))); testInterval(interval2, -1, 1, AllowDayOverflow.yes, PosInfInterval!Date(Date(1999, 3, 1))); testInterval(interval2, 1, 1, AllowDayOverflow.no, PosInfInterval!Date(Date(2001, 2, 28))); testInterval(interval2, 1, -1, AllowDayOverflow.no, PosInfInterval!Date(Date(2000, 12, 29))); testInterval(interval2, -1, -1, AllowDayOverflow.no, PosInfInterval!Date(Date(1998, 12, 29))); testInterval(interval2, -1, 1, AllowDayOverflow.no, PosInfInterval!Date(Date(1999, 2, 28))); } const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); static assert(!__traits(compiles, cPosInfInterval.shift(1))); static assert(!__traits(compiles, iPosInfInterval.shift(1))); //Verify Examples. auto interval1 = PosInfInterval!Date(Date(1996, 1, 2)); auto interval2 = PosInfInterval!Date(Date(1996, 1, 2)); interval1.shift(2); assert(interval1 == PosInfInterval!Date(Date(1998, 1, 2))); interval2.shift(-2); assert(interval2 == PosInfInterval!Date(Date(1994, 1, 2))); } } //Test PosInfInterval's expand(). unittest { version(testStdDateTime) { auto interval = PosInfInterval!Date(Date(2000, 7, 4)); static void testInterval(I)(I interval, in Duration duration, in I expected, size_t line = __LINE__) { interval.expand(duration); _assertPred!"=="(interval, expected, "", __FILE__, line); } testInterval(interval, dur!"days"(22), PosInfInterval!Date(Date(2000, 6, 12))); testInterval(interval, dur!"days"(-22), PosInfInterval!Date(Date(2000, 7, 26))); const cInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iInterval = PosInfInterval!Date(Date(2010, 7, 4)); static assert(!__traits(compiles, cInterval.expand(dur!"days"(5)))); static assert(!__traits(compiles, iInterval.expand(dur!"days"(5)))); //Verify Examples. auto interval1 = PosInfInterval!Date(Date(1996, 1, 2)); auto interval2 = PosInfInterval!Date(Date(1996, 1, 2)); interval1.expand(dur!"days"(2)); assert(interval1 == PosInfInterval!Date(Date(1995, 12, 31))); interval2.expand(dur!"days"(-2)); assert(interval2 == PosInfInterval!Date(Date(1996, 1, 4))); } } //Test PosInfInterval's expand(int, int, AllowDayOverflow). unittest { version(testStdDateTime) { { auto interval = PosInfInterval!Date(Date(2000, 7, 4)); static void testInterval(I)(I interval, int years, int months, AllowDayOverflow allow, in I expected, size_t line = __LINE__) { interval.expand(years, months, allow); _assertPred!"=="(interval, expected, "", __FILE__, line); } testInterval(interval, 5, 0, AllowDayOverflow.yes, PosInfInterval!Date(Date(1995, 7, 4))); testInterval(interval, -5, 0, AllowDayOverflow.yes, PosInfInterval!Date(Date(2005, 7, 4))); auto interval2 = PosInfInterval!Date(Date(2000, 1, 29)); testInterval(interval2, 1, 1, AllowDayOverflow.yes, PosInfInterval!Date(Date(1998, 12, 29))); testInterval(interval2, 1, -1, AllowDayOverflow.yes, PosInfInterval!Date(Date(1999, 3, 1))); testInterval(interval2, -1, -1, AllowDayOverflow.yes, PosInfInterval!Date(Date(2001, 3, 1))); testInterval(interval2, -1, 1, AllowDayOverflow.yes, PosInfInterval!Date(Date(2000, 12, 29))); testInterval(interval2, 1, 1, AllowDayOverflow.no, PosInfInterval!Date(Date(1998, 12, 29))); testInterval(interval2, 1, -1, AllowDayOverflow.no, PosInfInterval!Date(Date(1999, 2, 28))); testInterval(interval2, -1, -1, AllowDayOverflow.no, PosInfInterval!Date(Date(2001, 2, 28))); testInterval(interval2, -1, 1, AllowDayOverflow.no, PosInfInterval!Date(Date(2000, 12, 29))); } const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); static assert(!__traits(compiles, cPosInfInterval.expand(1))); static assert(!__traits(compiles, iPosInfInterval.expand(1))); //Verify Examples. auto interval1 = PosInfInterval!Date(Date(1996, 1, 2)); auto interval2 = PosInfInterval!Date(Date(1996, 1, 2)); interval1.expand(2); assert(interval1 == PosInfInterval!Date(Date(1994, 1, 2))); interval2.expand(-2); assert(interval2 == PosInfInterval!Date(Date(1998, 1, 2))); } } //Test PosInfInterval's fwdRange(). unittest { version(testStdDateTime) { auto posInfInterval = PosInfInterval!Date(Date(2010, 9, 19)); static void testInterval(PosInfInterval!Date posInfInterval) { posInfInterval.fwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri)).popFront(); } assertThrown!DateTimeException(testInterval(posInfInterval)); _assertPred!"=="(PosInfInterval!Date(Date(2010, 9, 12)).fwdRange(everyDayOfWeek!Date(DayOfWeek.fri)).front, Date(2010, 9, 12)); _assertPred!"=="(PosInfInterval!Date(Date(2010, 9, 12)).fwdRange(everyDayOfWeek!Date(DayOfWeek.fri), PopFirst.yes).front, Date(2010, 9, 17)); //Verify Examples. auto interval = PosInfInterval!Date(Date(2010, 9, 1)); auto func = delegate (in Date date) { if((date.day & 1) == 0) return date + dur!"days"(2); return date + dur!"days"(1); }; auto range = interval.fwdRange(func); assert(range.front == Date(2010, 9, 1)); //An odd day. Using PopFirst.yes would have made this Date(2010, 9, 2). range.popFront(); assert(range.front == Date(2010, 9, 2)); range.popFront(); assert(range.front == Date(2010, 9, 4)); range.popFront(); assert(range.front == Date(2010, 9, 6)); range.popFront(); assert(range.front == Date(2010, 9, 8)); range.popFront(); assert(!range.empty); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); static assert(__traits(compiles, cPosInfInterval.fwdRange(everyDayOfWeek!Date(DayOfWeek.fri)))); static assert(__traits(compiles, iPosInfInterval.fwdRange(everyDayOfWeek!Date(DayOfWeek.fri)))); } } //Test PosInfInterval's toString(). unittest { version(testStdDateTime) { _assertPred!"=="(PosInfInterval!Date(Date(2010, 7, 4)).toString(), "[2010-Jul-04 - ∞)"); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); static assert(__traits(compiles, cPosInfInterval.toString())); static assert(__traits(compiles, iPosInfInterval.toString())); } } /++ Represents an interval of time which has negative infinity as its starting point. Any ranges which iterate over a $(D NegInfInterval) are infinite. So, the main purpose of using $(D NegInfInterval) is to create an infinite range which starts at negative infinity and goes to a fixed end point. Iterate over it in reverse. +/ struct NegInfInterval(TP) { public: /++ Params: begin = The time point which begins the interval. Examples: -------------------- auto interval = PosInfInterval!Date(Date(1996, 1, 2)); -------------------- +/ this(in TP end) pure nothrow { _end = cast(TP)end; } /++ Params: rhs = The $(D NegInfInterval) to assign to this one. +/ /+ref+/ NegInfInterval opAssign(const ref NegInfInterval rhs) pure nothrow { _end = cast(TP)rhs._end; return this; } /++ Params: rhs = The $(D NegInfInterval) to assign to this one. +/ /+ref+/ NegInfInterval opAssign(NegInfInterval rhs) pure nothrow { _end = cast(TP)rhs._end; return this; } /++ The end point of the interval. It is excluded from the interval. Examples: -------------------- assert(NegInfInterval!Date(Date(2012, 3, 1)).end == Date(2012, 3, 1)); -------------------- +/ @property TP end() const pure nothrow { return cast(TP)_end; } /++ The end point of the interval. It is excluded from the interval. Params: timePoint = The time point to set end to. +/ @property void end(TP timePoint) pure nothrow { _end = timePoint; } /++ Whether the interval's length is 0. Always returns false. Examples: -------------------- assert(!NegInfInterval!Date(Date(1996, 1, 2)).empty); -------------------- +/ @property bool empty() const pure nothrow { return false; } /++ Whether the given time point is within this interval. Params: timePoint = The time point to check for inclusion in this interval. Examples: -------------------- assert(NegInfInterval!Date(Date(2012, 3, 1)).contains(Date(1994, 12, 24))); assert(NegInfInterval!Date(Date(2012, 3, 1)).contains(Date(2000, 1, 5))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).contains(Date(2012, 3, 1))); -------------------- +/ bool contains(TP timePoint) const pure nothrow { return timePoint < _end; } /++ Whether the given interval is completely within this interval. Params: interval = The interval to check for inclusion in this interval. Throws: $(D DateTimeException) if the given interval is empty. Examples: -------------------- assert(NegInfInterval!Date(Date(2012, 3, 1)).contains( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(NegInfInterval!Date(Date(2012, 3, 1)).contains( Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).contains( Interval!Date(Date(1998, 2, 28), Date(2013, 5, 1)))); -------------------- +/ bool contains(in Interval!TP interval) const pure { interval._enforceNotEmpty(); return interval._end <= _end; } /++ Whether the given interval is completely within this interval. Always returns false because an interval beginning at negative infinity can never contain an interval going to positive infinity. Params: interval = The interval to check for inclusion in this interval. Examples: -------------------- assert(!NegInfInterval!Date(Date(2012, 3, 1)).contains( PosInfInterval!Date(Date(1999, 5, 4)))); -------------------- +/ bool contains(in PosInfInterval!TP interval) const pure nothrow { return false; } /++ Whether the given interval is completely within this interval. Params: interval = The interval to check for inclusion in this interval. Examples: -------------------- assert(NegInfInterval!Date(Date(2012, 3, 1)).contains( NegInfInterval!Date(Date(1996, 5, 4)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).contains( NegInfInterval!Date(Date(2013, 7, 9)))); -------------------- +/ bool contains(in NegInfInterval interval) const pure nothrow { return interval._end <= _end; } /++ Whether this interval is before the given time point. Params: timePoint = The time point to check whether this interval is before it. Examples: -------------------- assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore(Date(1994, 12, 24))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore(Date(2000, 1, 5))); assert(NegInfInterval!Date(Date(2012, 3, 1)).isBefore(Date(2012, 3, 1))); -------------------- +/ bool isBefore(in TP timePoint) const pure nothrow { return timePoint >= _end; } /++ Whether this interval is before the given interval and does not intersect it. Params: interval = The interval to check for against this interval. Throws: $(D DateTimeException) if the given interval is empty Examples: -------------------- assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore( Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(NegInfInterval!Date(Date(2012, 3, 1)).isBefore( Interval!Date(Date(2022, 10, 19), Date(2027, 6, 3)))); -------------------- +/ bool isBefore(in Interval!TP interval) const pure { interval._enforceNotEmpty(); return _end <= interval._begin; } /++ Whether this interval is before the given interval and does not intersect it. Params: interval = The interval to check for against this interval. Examples: -------------------- assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore( PosInfInterval!Date(Date(1999, 5, 4)))); assert(NegInfInterval!Date(Date(2012, 3, 1)).isBefore( PosInfInterval!Date(Date(2012, 3, 1)))); -------------------- +/ bool isBefore(in PosInfInterval!TP interval) const pure nothrow { return _end <= interval._begin; } /++ Whether this interval is before the given interval and does not intersect it. Always returns false because an interval beginning at negative infinity can never be before another interval beginning at negative infinity. Params: interval = The interval to check for against this interval. Examples: -------------------- assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore( NegInfInterval!Date(Date(1996, 5, 4)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore( NegInfInterval!Date(Date(2013, 7, 9)))); -------------------- +/ bool isBefore(in NegInfInterval interval) const pure nothrow { return false; } /++ Whether this interval is after the given time point. Always returns false because an interval beginning at negative infinity can never be after any time point. Params: timePoint = The time point to check whether this interval is after it. Examples: -------------------- assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(Date(1994, 12, 24))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(Date(2000, 1, 5))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(Date(2012, 3, 1))); -------------------- +/ bool isAfter(in TP timePoint) const pure nothrow { return false; } /++ Whether this interval is after the given interval and does not intersect it. Always returns false (unless the given interval is empty) because an interval beginning at negative infinity can never be after any other interval. Params: interval = The interval to check against this interval. Throws: $(D DateTimeException) if the given interval is empty. Examples: -------------------- assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter( Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter( Interval!Date(Date(2022, 10, 19), Date(2027, 6, 3)))); -------------------- +/ bool isAfter(in Interval!TP interval) const pure { interval._enforceNotEmpty(); return false; } /++ Whether this interval is after the given interval and does not intersect it. Always returns false because an interval beginning at negative infinity can never be after any other interval. Params: interval = The interval to check against this interval. Examples: -------------------- assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter( PosInfInterval!Date(Date(1999, 5, 4)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter( PosInfInterval!Date(Date(2012, 3, 1)))); -------------------- +/ bool isAfter(in PosInfInterval!TP interval) const pure nothrow { return false; } /++ Whether this interval is after the given interval and does not intersect it. Always returns false because an interval beginning at negative infinity can never be after any other interval. Params: interval = The interval to check against this interval. Examples: -------------------- assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter( NegInfInterval!Date(Date(1996, 5, 4)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter( NegInfInterval!Date(Date(2013, 7, 9)))); -------------------- +/ bool isAfter(in NegInfInterval interval) const pure nothrow { return false; } /++ Whether the given interval overlaps this interval. Params: interval = The interval to check for intersection with this interval. Throws: $(D DateTimeException) if the given interval is empty. Examples: -------------------- assert(NegInfInterval!Date(Date(2012, 3, 1)).intersects( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(NegInfInterval!Date(Date(2012, 3, 1)).intersects( Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).intersects( Interval!Date(Date(2022, 10, 19), Date(2027, 6, 3)))); -------------------- +/ bool intersects(in Interval!TP interval) const pure { interval._enforceNotEmpty(); return interval._begin < _end; } /++ Whether the given interval overlaps this interval. Params: interval = The interval to check for intersection with this interval. Examples: -------------------- assert(NegInfInterval!Date(Date(2012, 3, 1)).intersects( PosInfInterval!Date(Date(1999, 5, 4)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).intersects( PosInfInterval!Date(Date(2012, 3, 1)))); -------------------- +/ bool intersects(in PosInfInterval!TP interval) const pure nothrow { return interval._begin < _end; } /++ Whether the given interval overlaps this interval. Always returns true because two intervals beginning at negative infinity always overlap. Params: interval = The interval to check for intersection with this interval. Examples: -------------------- assert(NegInfInterval!Date(Date(2012, 3, 1)).intersects( NegInfInterval!Date(Date(1996, 5, 4)))); assert(NegInfInterval!Date(Date(2012, 3, 1)).intersects( NegInfInterval!Date(Date(2013, 7, 9)))); -------------------- +/ bool intersects(in NegInfInterval!TP interval) const pure nothrow { return true; } /++ Returns the intersection of two intervals Params: interval = The interval to intersect with this interval. Throws: $(D DateTimeException) if the two intervals do not intersect or if the given interval is empty. Examples: -------------------- assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == Interval!Date(Date(1990, 7 , 6), Date(2000, 8, 2))); assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection( Interval!Date(Date(1999, 1, 12), Date(2015, 9, 2))) == Interval!Date(Date(1999, 1 , 12), Date(2012, 3, 1))); -------------------- +/ Interval!TP intersection(in Interval!TP interval) const { enforce(this.intersects(interval), new DateTimeException(format("%s and %s do not intersect.", this, interval))); auto end = _end < interval._end ? _end : interval._end; return Interval!TP(interval._begin, end); } /++ Returns the intersection of two intervals Params: interval = The interval to intersect with this interval. Throws: $(D DateTimeException) if the two intervals do not intersect. Examples: -------------------- assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection( PosInfInterval!Date(Date(1990, 7, 6))) == Interval!Date(Date(1990, 7 , 6), Date(2012, 3, 1))); assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection( PosInfInterval!Date(Date(1999, 1, 12))) == Interval!Date(Date(1999, 1 , 12), Date(2012, 3, 1))); -------------------- +/ Interval!TP intersection(in PosInfInterval!TP interval) const { enforce(this.intersects(interval), new DateTimeException(format("%s and %s do not intersect.", this, interval))); return Interval!TP(interval._begin, _end); } /++ Returns the intersection of two intervals Params: interval = The interval to intersect with this interval. Examples: -------------------- assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection( NegInfInterval!Date(Date(1999, 7, 6))) == NegInfInterval!Date(Date(1999, 7 , 6))); assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection( NegInfInterval!Date(Date(2013, 1, 12))) == NegInfInterval!Date(Date(2012, 3 , 1))); -------------------- +/ NegInfInterval intersection(in NegInfInterval interval) const nothrow { return NegInfInterval(_end < interval._end ? _end : interval._end); } /++ Whether the given interval is adjacent to this interval. Params: interval = The interval to check whether its adjecent to this interval. Throws: $(D DateTimeException) if the given interval is empty. Examples: -------------------- assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent( Interval!Date(Date(1999, 1, 12), Date(2012, 3, 1)))); assert(NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent( Interval!Date(Date(2012, 3, 1), Date(2019, 2, 2)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent( Interval!Date(Date(2022, 10, 19), Date(2027, 6, 3)))); -------------------- +/ bool isAdjacent(in Interval!TP interval) const pure { interval._enforceNotEmpty(); return interval._begin == _end; } /++ Whether the given interval is adjacent to this interval. Params: interval = The interval to check whether its adjecent to this interval. Examples: -------------------- assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent( PosInfInterval!Date(Date(1999, 5, 4)))); assert(NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent( PosInfInterval!Date(Date(2012, 3, 1)))); -------------------- +/ bool isAdjacent(in PosInfInterval!TP interval) const pure nothrow { return interval._begin == _end; } /++ Whether the given interval is adjacent to this interval. Always returns false because two intervals beginning at negative infinity can never be adjacent to one another. Params: interval = The interval to check whether its adjecent to this interval. Examples: -------------------- assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent( NegInfInterval!Date(Date(1996, 5, 4)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent( NegInfInterval!Date(Date(2012, 3, 1)))); -------------------- +/ bool isAdjacent(in NegInfInterval interval) const pure nothrow { return false; } /++ Returns the union of two intervals Params: interval = The interval to merge with this interval. Throws: $(D DateTimeException) if the two intervals do not intersect and are not adjacent or if the given interval is empty. Note: There is no overload for $(D merge) which takes a $(D PosInfInterval), because an interval going from negative infinity to positive infinity is not possible. Examples: -------------------- assert(NegInfInterval!Date(Date(2012, 3, 1)).merge( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == NegInfInterval!Date(Date(2012, 3 , 1))); assert(NegInfInterval!Date(Date(2012, 3, 1)).merge( Interval!Date(Date(1999, 1, 12), Date(2015, 9, 2))) == NegInfInterval!Date(Date(2015, 9 , 2))); -------------------- +/ NegInfInterval merge(in Interval!TP interval) const { enforce(this.isAdjacent(interval) || this.intersects(interval), new DateTimeException(format("%s and %s are not adjacent and do not intersect.", this, interval))); return NegInfInterval(_end > interval._end ? _end : interval._end); } /++ Returns the union of two intervals Params: interval = The interval to merge with this interval. Note: There is no overload for $(D merge) which takes a $(D PosInfInterval), because an interval going from negative infinity to positive infinity is not possible. Examples: -------------------- assert(NegInfInterval!Date(Date(2012, 3, 1)).merge( NegInfInterval!Date(Date(1999, 7, 6))) == NegInfInterval!Date(Date(2012, 3 , 1))); assert(NegInfInterval!Date(Date(2012, 3, 1)).merge( NegInfInterval!Date(Date(2013, 1, 12))) == NegInfInterval!Date(Date(2013, 1 , 12))); -------------------- +/ NegInfInterval merge(in NegInfInterval interval) const pure nothrow { return NegInfInterval(_end > interval._end ? _end : interval._end); } /++ Returns an interval that covers from the earliest time point of two intervals up to (but not including) the latest time point of two intervals. Params: interval = The interval to create a span together with this interval. Throws: $(D DateTimeException) if the given interval is empty. Note: There is no overload for $(D span) which takes a $(D PosInfInterval), because an interval going from negative infinity to positive infinity is not possible. Examples: -------------------- assert(NegInfInterval!Date(Date(2012, 3, 1)).span( Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == NegInfInterval!Date(Date(2012, 3 , 1))); assert(NegInfInterval!Date(Date(2012, 3, 1)).span( Interval!Date(Date(1999, 1, 12), Date(2015, 9, 2))) == NegInfInterval!Date(Date(2015, 9 , 2))); assert(NegInfInterval!Date(Date(1600, 1, 7)).span( Interval!Date(Date(2012, 3, 11), Date(2017, 7, 1))) == NegInfInterval!Date(Date(2017, 7 , 1))); -------------------- +/ NegInfInterval span(in Interval!TP interval) const pure { interval._enforceNotEmpty(); return NegInfInterval(_end > interval._end ? _end : interval._end); } /++ Returns an interval that covers from the earliest time point of two intervals up to (but not including) the latest time point of two intervals. Params: interval = The interval to create a span together with this interval. Note: There is no overload for $(D span) which takes a $(D PosInfInterval), because an interval going from negative infinity to positive infinity is not possible. Examples: -------------------- assert(NegInfInterval!Date(Date(2012, 3, 1)).span( NegInfInterval!Date(Date(1999, 7, 6))) == NegInfInterval!Date(Date(2012, 3 , 1))); assert(NegInfInterval!Date(Date(2012, 3, 1)).span( NegInfInterval!Date(Date(2013, 1, 12))) == NegInfInterval!Date(Date(2013, 1 , 12))); -------------------- +/ NegInfInterval span(in NegInfInterval interval) const pure nothrow { return NegInfInterval(_end > interval._end ? _end : interval._end); } /++ Shifts the $(D end) of this interval forward or backwards in time by the given duration (a positive duration shifts the interval forward; a negative duration shifts it backward). Effectively, it does $(D end += duration). Params: duration = The duration to shift the interval by. Examples: -------------------- auto interval1 = NegInfInterval!Date(Date(2012, 4, 5)); auto interval2 = NegInfInterval!Date(Date(2012, 4, 5)); interval1.shift(dur!"days"(50)); assert(interval1 == NegInfInterval!Date(Date(2012, 5, 25))); interval2.shift(dur!"days"(-50)); assert(interval2 == NegInfInterval!Date( Date(2012, 2, 15))); -------------------- +/ void shift(D)(D duration) pure nothrow if(__traits(compiles, end + duration)) { _end += duration; } static if(__traits(compiles, end.add!"months"(1)) && __traits(compiles, end.add!"years"(1))) { /++ Shifts the $(D end) of this interval forward or backwards in time by the given number of years and/or months (a positive number of years and months shifts the interval forward; a negative number shifts it backward). It adds the years the given years and months to end. It effectively calls $(D add!"years"()) and then $(D add!"months"()) on end with the given number of years and months. Params: years = The number of years to shift the interval by. months = The number of months to shift the interval by. allowOverflow = Whether the days should be allowed to overflow on $(D end), causing its month to increment. Throws: $(D DateTimeException) if empty is true or if the resulting interval would be invalid. Examples: -------------------- auto interval1 = NegInfInterval!Date(Date(2012, 3, 1)); auto interval2 = NegInfInterval!Date(Date(2012, 3, 1)); interval1.shift(2); assert(interval1 == NegInfInterval!Date(Date(2014, 3, 1))); interval2.shift(-2); assert(interval2 == NegInfInterval!Date(Date(2010, 3, 1))); -------------------- +/ void shift(T)(T years, T months = 0, AllowDayOverflow allowOverflow = AllowDayOverflow.yes) if(isIntegral!T) { auto end = _end; end.add!"years"(years, allowOverflow); end.add!"months"(months, allowOverflow); _end = end; } } /++ Expands the interval forwards in time. Effectively, it does $(D end += duration). Params: duration = The duration to expand the interval by. dir = The direction in time to expand the interval. Examples: -------------------- auto interval1 = NegInfInterval!Date(Date(2012, 3, 1)); auto interval2 = NegInfInterval!Date(Date(2012, 3, 1)); interval1.expand(dur!"days"(2)); assert(interval1 == NegInfInterval!Date(Date(2012, 3, 3))); interval2.expand(dur!"days"(-2)); assert(interval2 == NegInfInterval!Date(Date(2012, 2, 28))); -------------------- +/ void expand(D)(D duration) pure nothrow if(__traits(compiles, end + duration)) { _end += duration; } static if(__traits(compiles, end.add!"months"(1)) && __traits(compiles, end.add!"years"(1))) { /++ Expands the interval forwards and/or backwards in time. Effectively, it adds the given number of months/years to end. Params: years = The number of years to expand the interval by. months = The number of months to expand the interval by. allowOverflow = Whether the days should be allowed to overflow on $(D end), causing their month to increment. Throws: $(D DateTimeException) if empty is true or if the resulting interval would be invalid. Examples: -------------------- auto interval1 = NegInfInterval!Date(Date(2012, 3, 1)); auto interval2 = NegInfInterval!Date(Date(2012, 3, 1)); interval1.expand(2); assert(interval1 == NegInfInterval!Date(Date(2014, 3, 1))); interval2.expand(-2); assert(interval2 == NegInfInterval!Date(Date(2010, 3, 1))); -------------------- +/ void expand(T)(T years, T months = 0, AllowDayOverflow allowOverflow = AllowDayOverflow.yes) if(isIntegral!T) { auto end = _end; end.add!"years"(years, allowOverflow); end.add!"months"(months, allowOverflow); _end = end; return; } } /++ Returns a range which iterates backwards over the interval, starting at $(D end), using $(D_PARAM func) to generate each successive time point. The range's $(D front) is the interval's $(D end). $(D_PARAM func) is used to generate the next $(D front) when $(D popFront) is called. If $(D_PARAM popFirst) is $(D PopFirst.yes), then $(D popFront) is called before the range is returned (so that $(D front) is a time point which $(D_PARAM func) would generate). If $(D_PARAM func) ever generates a time point greater than or equal to the current $(D front) of the range, then a $(D DateTimeException) will be thrown. There are helper functions in this module which generate common delegates to pass to $(D bwdRange). Their documentation starts with "Range-generating function," to make them easily searchable. Params: func = The function used to generate the time points of the range over the interval. popFirst = Whether $(D popFront) should be called on the range before returning it. Throws: $(D DateTimeException) if this interval is empty. Warning: $(D_PARAM func) must be logically pure. Ideally, $(D_PARAM func) would be a function pointer to a pure function, but forcing $(D_PARAM func) to be pure is far too restrictive to be useful, and in order to have the ease of use of having functions which generate functions to pass to $(D fwdRange), $(D_PARAM func) must be a delegate. If $(D_PARAM func) retains state which changes as it is called, then some algorithms will not work correctly, because the range's $(D save) will have failed to have really saved the range's state. To avoid such bugs, don't pass a delegate which is not logically pure to $(D fwdRange). If $(D_PARAM func) is given the same time point with two different calls, it must return the same result both times. Of course, none of the functions in this module have this problem, so it's only relevant for custom delegates. Examples: -------------------- auto interval = NegInfInterval!Date(Date(2010, 9, 9)); auto func = (in Date date) //For iterating over even-numbered days. { if((date.day & 1) == 0) return date - dur!"days"(2); return date - dur!"days"(1); }; auto range = interval.bwdRange(func); assert(range.front == Date(2010, 9, 9)); //An odd day. Using PopFirst.yes would have made this Date(2010, 9, 8). range.popFront(); assert(range.front == Date(2010, 9, 8)); range.popFront(); assert(range.front == Date(2010, 9, 6)); range.popFront(); assert(range.front == Date(2010, 9, 4)); range.popFront(); assert(range.front == Date(2010, 9, 2)); range.popFront(); assert(!range.empty); -------------------- +/ NegInfIntervalRange!(TP) bwdRange(TP delegate(in TP) func, PopFirst popFirst = PopFirst.no) const { auto range = NegInfIntervalRange!(TP)(this, func); if(popFirst == PopFirst.yes) range.popFront(); return range; } /+ Converts this interval to a string. +/ //Due to bug http://d.puremagic.com/issues/show_bug.cgi?id=3715 , we can't //have versions of toString() with extra modifiers, so we define one version //with modifiers and one without. string toString() { return _toStringImpl(); } /++ Converts this interval to a string. +/ //Due to bug http://d.puremagic.com/issues/show_bug.cgi?id=3715 , we can't //have versions of toString() with extra modifiers, so we define one version //with modifiers and one without. string toString() const nothrow { return _toStringImpl(); } private: /+ Since we have two versions of toString(), we have _toStringImpl() so that they can share implementations. +/ string _toStringImpl() const nothrow { try return format("[-∞ - %s)", _end); catch(Exception e) assert(0, "format() threw."); } TP _end; } //Test NegInfInterval's constructor. unittest { version(testStdDateTime) { NegInfInterval!Date(Date.init); NegInfInterval!TimeOfDay(TimeOfDay.init); NegInfInterval!DateTime(DateTime.init); NegInfInterval!SysTime(SysTime(0)); } } //Test NegInfInterval's end. unittest { version(testStdDateTime) { _assertPred!"=="(NegInfInterval!Date(Date(2010, 1, 1)).end, Date(2010, 1, 1)); _assertPred!"=="(NegInfInterval!Date(Date(2010, 1, 1)).end, Date(2010, 1, 1)); _assertPred!"=="(NegInfInterval!Date(Date(1998, 1, 1)).end, Date(1998, 1, 1)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, cNegInfInterval.end)); static assert(__traits(compiles, iNegInfInterval.end)); //Verify Examples. assert(NegInfInterval!Date(Date(2012, 3, 1)).end == Date(2012, 3, 1)); } } //Test NegInfInterval's empty. unittest { version(testStdDateTime) { assert(!NegInfInterval!Date(Date(2010, 1, 1)).empty); assert(!NegInfInterval!TimeOfDay(TimeOfDay(0, 30, 0)).empty); assert(!NegInfInterval!DateTime(DateTime(2010, 1, 1, 0, 30, 0)).empty); assert(!NegInfInterval!SysTime(SysTime(DateTime(2010, 1, 1, 0, 30, 0))).empty); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, cNegInfInterval.empty)); static assert(__traits(compiles, iNegInfInterval.empty)); //Verify Examples. assert(!NegInfInterval!Date(Date(1996, 1, 2)).empty); } } //Test NegInfInterval's contains(time point). unittest { version(testStdDateTime) { auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); assert(negInfInterval.contains(Date(2009, 7, 4))); assert(negInfInterval.contains(Date(2010, 7, 3))); assert(negInfInterval.contains(Date(2010, 7, 4))); assert(negInfInterval.contains(Date(2010, 7, 5))); assert(negInfInterval.contains(Date(2011, 7, 1))); assert(negInfInterval.contains(Date(2012, 1, 6))); assert(!negInfInterval.contains(Date(2012, 1, 7))); assert(!negInfInterval.contains(Date(2012, 1, 8))); assert(!negInfInterval.contains(Date(2013, 1, 7))); const cdate = Date(2010, 7, 6); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, negInfInterval.contains(cdate))); static assert(__traits(compiles, cNegInfInterval.contains(cdate))); static assert(__traits(compiles, iNegInfInterval.contains(cdate))); //Verify Examples. assert(NegInfInterval!Date(Date(2012, 3, 1)).contains(Date(1994, 12, 24))); assert(NegInfInterval!Date(Date(2012, 3, 1)).contains(Date(2000, 1, 5))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).contains(Date(2012, 3, 1))); } } //Test NegInfInterval's contains(Interval). unittest { version(testStdDateTime) { auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static void testInterval(in NegInfInterval!Date negInfInterval, in Interval!Date interval) { negInfInterval.contains(interval); } assertThrown!DateTimeException(testInterval(negInfInterval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assert(negInfInterval.contains(negInfInterval)); assert(negInfInterval.contains(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assert(!negInfInterval.contains(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)))); assert(negInfInterval.contains(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)))); assert(negInfInterval.contains(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)))); assert(negInfInterval.contains(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)))); assert(!negInfInterval.contains(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)))); assert(negInfInterval.contains(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)))); assert(negInfInterval.contains(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)))); assert(negInfInterval.contains(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)))); assert(!negInfInterval.contains(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)))); assert(!negInfInterval.contains(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)))); assert(!negInfInterval.contains(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assert(negInfInterval.contains(NegInfInterval!Date(Date(2010, 7, 3)))); assert(negInfInterval.contains(NegInfInterval!Date(Date(2010, 7, 4)))); assert(negInfInterval.contains(NegInfInterval!Date(Date(2010, 7, 5)))); assert(negInfInterval.contains(NegInfInterval!Date(Date(2012, 1, 6)))); assert(negInfInterval.contains(NegInfInterval!Date(Date(2012, 1, 7)))); assert(!negInfInterval.contains(NegInfInterval!Date(Date(2012, 1, 8)))); assert(!NegInfInterval!Date(Date(2010, 7, 3)).contains(negInfInterval)); assert(!NegInfInterval!Date(Date(2010, 7, 4)).contains(negInfInterval)); assert(!NegInfInterval!Date(Date(2010, 7, 5)).contains(negInfInterval)); assert(!NegInfInterval!Date(Date(2012, 1, 6)).contains(negInfInterval)); assert(NegInfInterval!Date(Date(2012, 1, 7)).contains(negInfInterval)); assert(NegInfInterval!Date(Date(2012, 1, 8)).contains(negInfInterval)); assert(!negInfInterval.contains(PosInfInterval!Date(Date(2010, 7, 3)))); assert(!negInfInterval.contains(PosInfInterval!Date(Date(2010, 7, 4)))); assert(!negInfInterval.contains(PosInfInterval!Date(Date(2010, 7, 5)))); assert(!negInfInterval.contains(PosInfInterval!Date(Date(2012, 1, 6)))); assert(!negInfInterval.contains(PosInfInterval!Date(Date(2012, 1, 7)))); assert(!negInfInterval.contains(PosInfInterval!Date(Date(2012, 1, 8)))); auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, negInfInterval.contains(interval))); static assert(__traits(compiles, negInfInterval.contains(cInterval))); static assert(__traits(compiles, negInfInterval.contains(iInterval))); static assert(__traits(compiles, negInfInterval.contains(posInfInterval))); static assert(__traits(compiles, negInfInterval.contains(cPosInfInterval))); static assert(__traits(compiles, negInfInterval.contains(iPosInfInterval))); static assert(__traits(compiles, negInfInterval.contains(negInfInterval))); static assert(__traits(compiles, negInfInterval.contains(cNegInfInterval))); static assert(__traits(compiles, negInfInterval.contains(iNegInfInterval))); static assert(__traits(compiles, cNegInfInterval.contains(interval))); static assert(__traits(compiles, cNegInfInterval.contains(cInterval))); static assert(__traits(compiles, cNegInfInterval.contains(iInterval))); static assert(__traits(compiles, cNegInfInterval.contains(posInfInterval))); static assert(__traits(compiles, cNegInfInterval.contains(cPosInfInterval))); static assert(__traits(compiles, cNegInfInterval.contains(iPosInfInterval))); static assert(__traits(compiles, cNegInfInterval.contains(negInfInterval))); static assert(__traits(compiles, cNegInfInterval.contains(cNegInfInterval))); static assert(__traits(compiles, cNegInfInterval.contains(iNegInfInterval))); static assert(__traits(compiles, iNegInfInterval.contains(interval))); static assert(__traits(compiles, iNegInfInterval.contains(cInterval))); static assert(__traits(compiles, iNegInfInterval.contains(iInterval))); static assert(__traits(compiles, iNegInfInterval.contains(posInfInterval))); static assert(__traits(compiles, iNegInfInterval.contains(cPosInfInterval))); static assert(__traits(compiles, iNegInfInterval.contains(iPosInfInterval))); static assert(__traits(compiles, iNegInfInterval.contains(negInfInterval))); static assert(__traits(compiles, iNegInfInterval.contains(cNegInfInterval))); static assert(__traits(compiles, iNegInfInterval.contains(iNegInfInterval))); //Verify Examples. assert(NegInfInterval!Date(Date(2012, 3, 1)).contains(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(NegInfInterval!Date(Date(2012, 3, 1)).contains(Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).contains(Interval!Date(Date(1998, 2, 28), Date(2013, 5, 1)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).contains(PosInfInterval!Date(Date(1999, 5, 4)))); assert(NegInfInterval!Date(Date(2012, 3, 1)).contains(NegInfInterval!Date(Date(1996, 5, 4)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).contains(NegInfInterval!Date(Date(2013, 7, 9)))); } } //Test NegInfInterval's isBefore(time point). unittest { version(testStdDateTime) { auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); assert(!negInfInterval.isBefore(Date(2009, 7, 4))); assert(!negInfInterval.isBefore(Date(2010, 7, 3))); assert(!negInfInterval.isBefore(Date(2010, 7, 4))); assert(!negInfInterval.isBefore(Date(2010, 7, 5))); assert(!negInfInterval.isBefore(Date(2011, 7, 1))); assert(!negInfInterval.isBefore(Date(2012, 1, 6))); assert(negInfInterval.isBefore(Date(2012, 1, 7))); assert(negInfInterval.isBefore(Date(2012, 1, 8))); assert(negInfInterval.isBefore(Date(2013, 1, 7))); const cdate = Date(2010, 7, 6); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, negInfInterval.isBefore(cdate))); static assert(__traits(compiles, cNegInfInterval.isBefore(cdate))); static assert(__traits(compiles, iNegInfInterval.isBefore(cdate))); //Verify Examples. assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore(Date(1994, 12, 24))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore(Date(2000, 1, 5))); assert(NegInfInterval!Date(Date(2012, 3, 1)).isBefore(Date(2012, 3, 1))); } } //Test NegInfInterval's isBefore(Interval). unittest { version(testStdDateTime) { auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static void testInterval(in NegInfInterval!Date negInfInterval, in Interval!Date interval) { negInfInterval.isBefore(interval); } assertThrown!DateTimeException(testInterval(negInfInterval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assert(!negInfInterval.isBefore(negInfInterval)); assert(!negInfInterval.isBefore(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assert(!negInfInterval.isBefore(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)))); assert(!negInfInterval.isBefore(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)))); assert(!negInfInterval.isBefore(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)))); assert(!negInfInterval.isBefore(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)))); assert(!negInfInterval.isBefore(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)))); assert(!negInfInterval.isBefore(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)))); assert(!negInfInterval.isBefore(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)))); assert(!negInfInterval.isBefore(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)))); assert(!negInfInterval.isBefore(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)))); assert(negInfInterval.isBefore(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)))); assert(negInfInterval.isBefore(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assert(!negInfInterval.isBefore(NegInfInterval!Date(Date(2010, 7, 3)))); assert(!negInfInterval.isBefore(NegInfInterval!Date(Date(2010, 7, 4)))); assert(!negInfInterval.isBefore(NegInfInterval!Date(Date(2010, 7, 5)))); assert(!negInfInterval.isBefore(NegInfInterval!Date(Date(2012, 1, 6)))); assert(!negInfInterval.isBefore(NegInfInterval!Date(Date(2012, 1, 7)))); assert(!negInfInterval.isBefore(NegInfInterval!Date(Date(2012, 1, 8)))); assert(!NegInfInterval!Date(Date(2010, 7, 3)).isBefore(negInfInterval)); assert(!NegInfInterval!Date(Date(2010, 7, 4)).isBefore(negInfInterval)); assert(!NegInfInterval!Date(Date(2010, 7, 5)).isBefore(negInfInterval)); assert(!NegInfInterval!Date(Date(2012, 1, 6)).isBefore(negInfInterval)); assert(!NegInfInterval!Date(Date(2012, 1, 7)).isBefore(negInfInterval)); assert(!NegInfInterval!Date(Date(2012, 1, 8)).isBefore(negInfInterval)); assert(!negInfInterval.isBefore(PosInfInterval!Date(Date(2010, 7, 3)))); assert(!negInfInterval.isBefore(PosInfInterval!Date(Date(2010, 7, 4)))); assert(!negInfInterval.isBefore(PosInfInterval!Date(Date(2010, 7, 5)))); assert(!negInfInterval.isBefore(PosInfInterval!Date(Date(2012, 1, 6)))); assert(negInfInterval.isBefore(PosInfInterval!Date(Date(2012, 1, 7)))); assert(negInfInterval.isBefore(PosInfInterval!Date(Date(2012, 1, 8)))); auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, negInfInterval.isBefore(interval))); static assert(__traits(compiles, negInfInterval.isBefore(cInterval))); static assert(__traits(compiles, negInfInterval.isBefore(iInterval))); static assert(__traits(compiles, negInfInterval.isBefore(posInfInterval))); static assert(__traits(compiles, negInfInterval.isBefore(cPosInfInterval))); static assert(__traits(compiles, negInfInterval.isBefore(iPosInfInterval))); static assert(__traits(compiles, negInfInterval.isBefore(negInfInterval))); static assert(__traits(compiles, negInfInterval.isBefore(cNegInfInterval))); static assert(__traits(compiles, negInfInterval.isBefore(iNegInfInterval))); static assert(__traits(compiles, cNegInfInterval.isBefore(interval))); static assert(__traits(compiles, cNegInfInterval.isBefore(cInterval))); static assert(__traits(compiles, cNegInfInterval.isBefore(iInterval))); static assert(__traits(compiles, cNegInfInterval.isBefore(posInfInterval))); static assert(__traits(compiles, cNegInfInterval.isBefore(cPosInfInterval))); static assert(__traits(compiles, cNegInfInterval.isBefore(iPosInfInterval))); static assert(__traits(compiles, cNegInfInterval.isBefore(negInfInterval))); static assert(__traits(compiles, cNegInfInterval.isBefore(cNegInfInterval))); static assert(__traits(compiles, cNegInfInterval.isBefore(iNegInfInterval))); static assert(__traits(compiles, iNegInfInterval.isBefore(interval))); static assert(__traits(compiles, iNegInfInterval.isBefore(cInterval))); static assert(__traits(compiles, iNegInfInterval.isBefore(iInterval))); static assert(__traits(compiles, iNegInfInterval.isBefore(posInfInterval))); static assert(__traits(compiles, iNegInfInterval.isBefore(cPosInfInterval))); static assert(__traits(compiles, iNegInfInterval.isBefore(iPosInfInterval))); static assert(__traits(compiles, iNegInfInterval.isBefore(negInfInterval))); static assert(__traits(compiles, iNegInfInterval.isBefore(cNegInfInterval))); static assert(__traits(compiles, iNegInfInterval.isBefore(iNegInfInterval))); //Verify Examples. assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore(Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(NegInfInterval!Date(Date(2012, 3, 1)).isBefore(Interval!Date(Date(2022, 10, 19), Date(2027, 6, 3)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore(PosInfInterval!Date(Date(1999, 5, 4)))); assert(NegInfInterval!Date(Date(2012, 3, 1)).isBefore(PosInfInterval!Date(Date(2012, 3, 1)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore(NegInfInterval!Date(Date(1996, 5, 4)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isBefore(NegInfInterval!Date(Date(2013, 7, 9)))); } } //Test NegInfInterval's isAfter(time point). unittest { version(testStdDateTime) { auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); assert(!negInfInterval.isAfter(Date(2009, 7, 4))); assert(!negInfInterval.isAfter(Date(2010, 7, 3))); assert(!negInfInterval.isAfter(Date(2010, 7, 4))); assert(!negInfInterval.isAfter(Date(2010, 7, 5))); assert(!negInfInterval.isAfter(Date(2011, 7, 1))); assert(!negInfInterval.isAfter(Date(2012, 1, 6))); assert(!negInfInterval.isAfter(Date(2012, 1, 7))); assert(!negInfInterval.isAfter(Date(2012, 1, 8))); assert(!negInfInterval.isAfter(Date(2013, 1, 7))); const cdate = Date(2010, 7, 6); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, negInfInterval.isAfter(cdate))); static assert(__traits(compiles, cNegInfInterval.isAfter(cdate))); static assert(__traits(compiles, iNegInfInterval.isAfter(cdate))); } } //Test NegInfInterval's isAfter(Interval). unittest { version(testStdDateTime) { auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static void testInterval(in NegInfInterval!Date negInfInterval, in Interval!Date interval) { negInfInterval.isAfter(interval); } assertThrown!DateTimeException(testInterval(negInfInterval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assert(!negInfInterval.isAfter(negInfInterval)); assert(!negInfInterval.isAfter(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assert(!negInfInterval.isAfter(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)))); assert(!negInfInterval.isAfter(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)))); assert(!negInfInterval.isAfter(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)))); assert(!negInfInterval.isAfter(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)))); assert(!negInfInterval.isAfter(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)))); assert(!negInfInterval.isAfter(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)))); assert(!negInfInterval.isAfter(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)))); assert(!negInfInterval.isAfter(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)))); assert(!negInfInterval.isAfter(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)))); assert(!negInfInterval.isAfter(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)))); assert(!negInfInterval.isAfter(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assert(!negInfInterval.isAfter(NegInfInterval!Date(Date(2010, 7, 3)))); assert(!negInfInterval.isAfter(NegInfInterval!Date(Date(2010, 7, 4)))); assert(!negInfInterval.isAfter(NegInfInterval!Date(Date(2010, 7, 5)))); assert(!negInfInterval.isAfter(NegInfInterval!Date(Date(2012, 1, 6)))); assert(!negInfInterval.isAfter(NegInfInterval!Date(Date(2012, 1, 7)))); assert(!negInfInterval.isAfter(NegInfInterval!Date(Date(2012, 1, 8)))); assert(!NegInfInterval!Date(Date(2010, 7, 3)).isAfter(negInfInterval)); assert(!NegInfInterval!Date(Date(2010, 7, 4)).isAfter(negInfInterval)); assert(!NegInfInterval!Date(Date(2010, 7, 5)).isAfter(negInfInterval)); assert(!NegInfInterval!Date(Date(2012, 1, 6)).isAfter(negInfInterval)); assert(!NegInfInterval!Date(Date(2012, 1, 7)).isAfter(negInfInterval)); assert(!NegInfInterval!Date(Date(2012, 1, 8)).isAfter(negInfInterval)); assert(!negInfInterval.isAfter(PosInfInterval!Date(Date(2010, 7, 3)))); assert(!negInfInterval.isAfter(PosInfInterval!Date(Date(2010, 7, 4)))); assert(!negInfInterval.isAfter(PosInfInterval!Date(Date(2010, 7, 5)))); assert(!negInfInterval.isAfter(PosInfInterval!Date(Date(2012, 1, 6)))); assert(!negInfInterval.isAfter(PosInfInterval!Date(Date(2012, 1, 7)))); assert(!negInfInterval.isAfter(PosInfInterval!Date(Date(2012, 1, 8)))); auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, negInfInterval.isAfter(interval))); static assert(__traits(compiles, negInfInterval.isAfter(cInterval))); static assert(__traits(compiles, negInfInterval.isAfter(iInterval))); static assert(__traits(compiles, negInfInterval.isAfter(posInfInterval))); static assert(__traits(compiles, negInfInterval.isAfter(cPosInfInterval))); static assert(__traits(compiles, negInfInterval.isAfter(iPosInfInterval))); static assert(__traits(compiles, negInfInterval.isAfter(negInfInterval))); static assert(__traits(compiles, negInfInterval.isAfter(cNegInfInterval))); static assert(__traits(compiles, negInfInterval.isAfter(iNegInfInterval))); static assert(__traits(compiles, cNegInfInterval.isAfter(interval))); static assert(__traits(compiles, cNegInfInterval.isAfter(cInterval))); static assert(__traits(compiles, cNegInfInterval.isAfter(iInterval))); static assert(__traits(compiles, cNegInfInterval.isAfter(posInfInterval))); static assert(__traits(compiles, cNegInfInterval.isAfter(cPosInfInterval))); static assert(__traits(compiles, cNegInfInterval.isAfter(iPosInfInterval))); static assert(__traits(compiles, cNegInfInterval.isAfter(negInfInterval))); static assert(__traits(compiles, cNegInfInterval.isAfter(cNegInfInterval))); static assert(__traits(compiles, cNegInfInterval.isAfter(iNegInfInterval))); static assert(__traits(compiles, iNegInfInterval.isAfter(interval))); static assert(__traits(compiles, iNegInfInterval.isAfter(cInterval))); static assert(__traits(compiles, iNegInfInterval.isAfter(iInterval))); static assert(__traits(compiles, iNegInfInterval.isAfter(posInfInterval))); static assert(__traits(compiles, iNegInfInterval.isAfter(cPosInfInterval))); static assert(__traits(compiles, iNegInfInterval.isAfter(iPosInfInterval))); static assert(__traits(compiles, iNegInfInterval.isAfter(negInfInterval))); static assert(__traits(compiles, iNegInfInterval.isAfter(cNegInfInterval))); static assert(__traits(compiles, iNegInfInterval.isAfter(iNegInfInterval))); //Verify Examples. assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(Date(1994, 12, 24))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(Date(2000, 1, 5))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(Date(2012, 3, 1))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(Interval!Date(Date(2022, 10, 19), Date(2027, 6, 3)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(PosInfInterval!Date(Date(1999, 5, 4)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(PosInfInterval!Date(Date(2012, 3, 1)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(NegInfInterval!Date(Date(1996, 5, 4)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAfter(NegInfInterval!Date(Date(2013, 7, 9)))); } } //Test NegInfInterval's intersects(). unittest { version(testStdDateTime) { auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static void testInterval(in NegInfInterval!Date negInfInterval, in Interval!Date interval) { negInfInterval.intersects(interval); } assertThrown!DateTimeException(testInterval(negInfInterval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assert(negInfInterval.intersects(negInfInterval)); assert(negInfInterval.intersects(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assert(negInfInterval.intersects(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)))); assert(negInfInterval.intersects(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)))); assert(negInfInterval.intersects(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)))); assert(negInfInterval.intersects(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)))); assert(negInfInterval.intersects(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)))); assert(negInfInterval.intersects(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)))); assert(negInfInterval.intersects(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)))); assert(negInfInterval.intersects(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)))); assert(negInfInterval.intersects(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)))); assert(!negInfInterval.intersects(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)))); assert(!negInfInterval.intersects(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assert(negInfInterval.intersects(NegInfInterval!Date(Date(2010, 7, 3)))); assert(negInfInterval.intersects(NegInfInterval!Date(Date(2010, 7, 4)))); assert(negInfInterval.intersects(NegInfInterval!Date(Date(2010, 7, 5)))); assert(negInfInterval.intersects(NegInfInterval!Date(Date(2012, 1, 6)))); assert(negInfInterval.intersects(NegInfInterval!Date(Date(2012, 1, 7)))); assert(negInfInterval.intersects(NegInfInterval!Date(Date(2012, 1, 8)))); assert(NegInfInterval!Date(Date(2010, 7, 3)).intersects(negInfInterval)); assert(NegInfInterval!Date(Date(2010, 7, 4)).intersects(negInfInterval)); assert(NegInfInterval!Date(Date(2010, 7, 5)).intersects(negInfInterval)); assert(NegInfInterval!Date(Date(2012, 1, 6)).intersects(negInfInterval)); assert(NegInfInterval!Date(Date(2012, 1, 7)).intersects(negInfInterval)); assert(NegInfInterval!Date(Date(2012, 1, 8)).intersects(negInfInterval)); assert(negInfInterval.intersects(PosInfInterval!Date(Date(2010, 7, 3)))); assert(negInfInterval.intersects(PosInfInterval!Date(Date(2010, 7, 4)))); assert(negInfInterval.intersects(PosInfInterval!Date(Date(2010, 7, 5)))); assert(negInfInterval.intersects(PosInfInterval!Date(Date(2012, 1, 6)))); assert(!negInfInterval.intersects(PosInfInterval!Date(Date(2012, 1, 7)))); assert(!negInfInterval.intersects(PosInfInterval!Date(Date(2012, 1, 8)))); auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, negInfInterval.intersects(interval))); static assert(__traits(compiles, negInfInterval.intersects(cInterval))); static assert(__traits(compiles, negInfInterval.intersects(iInterval))); static assert(__traits(compiles, negInfInterval.intersects(posInfInterval))); static assert(__traits(compiles, negInfInterval.intersects(cPosInfInterval))); static assert(__traits(compiles, negInfInterval.intersects(iPosInfInterval))); static assert(__traits(compiles, negInfInterval.intersects(negInfInterval))); static assert(__traits(compiles, negInfInterval.intersects(cNegInfInterval))); static assert(__traits(compiles, negInfInterval.intersects(iNegInfInterval))); static assert(__traits(compiles, cNegInfInterval.intersects(interval))); static assert(__traits(compiles, cNegInfInterval.intersects(cInterval))); static assert(__traits(compiles, cNegInfInterval.intersects(iInterval))); static assert(__traits(compiles, cNegInfInterval.intersects(posInfInterval))); static assert(__traits(compiles, cNegInfInterval.intersects(cPosInfInterval))); static assert(__traits(compiles, cNegInfInterval.intersects(iPosInfInterval))); static assert(__traits(compiles, cNegInfInterval.intersects(negInfInterval))); static assert(__traits(compiles, cNegInfInterval.intersects(cNegInfInterval))); static assert(__traits(compiles, cNegInfInterval.intersects(iNegInfInterval))); static assert(__traits(compiles, iNegInfInterval.intersects(interval))); static assert(__traits(compiles, iNegInfInterval.intersects(cInterval))); static assert(__traits(compiles, iNegInfInterval.intersects(iInterval))); static assert(__traits(compiles, iNegInfInterval.intersects(posInfInterval))); static assert(__traits(compiles, iNegInfInterval.intersects(cPosInfInterval))); static assert(__traits(compiles, iNegInfInterval.intersects(iPosInfInterval))); static assert(__traits(compiles, iNegInfInterval.intersects(negInfInterval))); static assert(__traits(compiles, iNegInfInterval.intersects(cNegInfInterval))); static assert(__traits(compiles, iNegInfInterval.intersects(iNegInfInterval))); //Verify Examples. assert(NegInfInterval!Date(Date(2012, 3, 1)).intersects(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(NegInfInterval!Date(Date(2012, 3, 1)).intersects(Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).intersects(Interval!Date(Date(2022, 10, 19), Date(2027, 6, 3)))); assert(NegInfInterval!Date(Date(2012, 3, 1)).intersects(PosInfInterval!Date(Date(1999, 5, 4)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).intersects(PosInfInterval!Date(Date(2012, 3, 1)))); assert(NegInfInterval!Date(Date(2012, 3, 1)).intersects(NegInfInterval!Date(Date(1996, 5, 4)))); assert(NegInfInterval!Date(Date(2012, 3, 1)).intersects(NegInfInterval!Date(Date(2013, 7, 9)))); } } //Test NegInfInterval's intersection(). unittest { version(testStdDateTime) { auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static void testInterval(I, J)(in I interval1, in J interval2) { interval1.intersection(interval2); } assertThrown!DateTimeException(testInterval(negInfInterval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assertThrown!DateTimeException(testInterval(negInfInterval, Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)))); assertThrown!DateTimeException(testInterval(negInfInterval, Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assertThrown!DateTimeException(testInterval(negInfInterval, PosInfInterval!Date(Date(2012, 1, 7)))); assertThrown!DateTimeException(testInterval(negInfInterval, PosInfInterval!Date(Date(2012, 1, 8)))); _assertPred!"=="(negInfInterval.intersection(negInfInterval), negInfInterval); _assertPred!"=="(negInfInterval.intersection(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3))), Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3))); _assertPred!"=="(negInfInterval.intersection(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3))), Interval!Date(Date(2010, 7, 1), Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.intersection(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4))), Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4))); _assertPred!"=="(negInfInterval.intersection(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5))), Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5))); _assertPred!"=="(negInfInterval.intersection(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.intersection(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8))), Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.intersection(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6))), Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6))); _assertPred!"=="(negInfInterval.intersection(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7))), Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.intersection(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7))), Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.intersection(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8))), Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.intersection(NegInfInterval!Date(Date(2010, 7, 3))), NegInfInterval!Date(Date(2010, 7, 3))); _assertPred!"=="(negInfInterval.intersection(NegInfInterval!Date(Date(2010, 7, 4))), NegInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(negInfInterval.intersection(NegInfInterval!Date(Date(2010, 7, 5))), NegInfInterval!Date(Date(2010, 7, 5))); _assertPred!"=="(negInfInterval.intersection(NegInfInterval!Date(Date(2012, 1, 6))), NegInfInterval!Date(Date(2012, 1, 6))); _assertPred!"=="(negInfInterval.intersection(NegInfInterval!Date(Date(2012, 1, 7))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.intersection(NegInfInterval!Date(Date(2012, 1, 8))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(NegInfInterval!Date(Date(2010, 7, 3)).intersection(negInfInterval), NegInfInterval!Date(Date(2010, 7, 3))); _assertPred!"=="(NegInfInterval!Date(Date(2010, 7, 4)).intersection(negInfInterval), NegInfInterval!Date(Date(2010, 7, 4))); _assertPred!"=="(NegInfInterval!Date(Date(2010, 7, 5)).intersection(negInfInterval), NegInfInterval!Date(Date(2010, 7, 5))); _assertPred!"=="(NegInfInterval!Date(Date(2012, 1, 6)).intersection(negInfInterval), NegInfInterval!Date(Date(2012, 1, 6))); _assertPred!"=="(NegInfInterval!Date(Date(2012, 1, 7)).intersection(negInfInterval), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(NegInfInterval!Date(Date(2012, 1, 8)).intersection(negInfInterval), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.intersection(PosInfInterval!Date(Date(2010, 7, 3))), Interval!Date(Date(2010, 7, 3), Date(2012, 1 ,7))); _assertPred!"=="(negInfInterval.intersection(PosInfInterval!Date(Date(2010, 7, 4))), Interval!Date(Date(2010, 7, 4), Date(2012, 1 ,7))); _assertPred!"=="(negInfInterval.intersection(PosInfInterval!Date(Date(2010, 7, 5))), Interval!Date(Date(2010, 7, 5), Date(2012, 1 ,7))); _assertPred!"=="(negInfInterval.intersection(PosInfInterval!Date(Date(2012, 1, 6))), Interval!Date(Date(2012, 1, 6), Date(2012, 1 ,7))); auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, negInfInterval.intersection(interval))); static assert(__traits(compiles, negInfInterval.intersection(cInterval))); static assert(__traits(compiles, negInfInterval.intersection(iInterval))); static assert(__traits(compiles, negInfInterval.intersection(posInfInterval))); static assert(__traits(compiles, negInfInterval.intersection(cPosInfInterval))); static assert(__traits(compiles, negInfInterval.intersection(iPosInfInterval))); static assert(__traits(compiles, negInfInterval.intersection(negInfInterval))); static assert(__traits(compiles, negInfInterval.intersection(cNegInfInterval))); static assert(__traits(compiles, negInfInterval.intersection(iNegInfInterval))); static assert(__traits(compiles, cNegInfInterval.intersection(interval))); static assert(__traits(compiles, cNegInfInterval.intersection(cInterval))); static assert(__traits(compiles, cNegInfInterval.intersection(iInterval))); static assert(__traits(compiles, cNegInfInterval.intersection(posInfInterval))); static assert(__traits(compiles, cNegInfInterval.intersection(cPosInfInterval))); static assert(__traits(compiles, cNegInfInterval.intersection(iPosInfInterval))); static assert(__traits(compiles, cNegInfInterval.intersection(negInfInterval))); static assert(__traits(compiles, cNegInfInterval.intersection(cNegInfInterval))); static assert(__traits(compiles, cNegInfInterval.intersection(iNegInfInterval))); static assert(__traits(compiles, iNegInfInterval.intersection(interval))); static assert(__traits(compiles, iNegInfInterval.intersection(cInterval))); static assert(__traits(compiles, iNegInfInterval.intersection(iInterval))); static assert(__traits(compiles, iNegInfInterval.intersection(posInfInterval))); static assert(__traits(compiles, iNegInfInterval.intersection(cPosInfInterval))); static assert(__traits(compiles, iNegInfInterval.intersection(iPosInfInterval))); static assert(__traits(compiles, iNegInfInterval.intersection(negInfInterval))); static assert(__traits(compiles, iNegInfInterval.intersection(cNegInfInterval))); static assert(__traits(compiles, iNegInfInterval.intersection(iNegInfInterval))); //Verify Examples. assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == Interval!Date(Date(1990, 7 , 6), Date(2000, 8, 2))); assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection(Interval!Date(Date(1999, 1, 12), Date(2015, 9, 2))) == Interval!Date(Date(1999, 1 , 12), Date(2012, 3, 1))); assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection(PosInfInterval!Date(Date(1990, 7, 6))) == Interval!Date(Date(1990, 7 , 6), Date(2012, 3, 1))); assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection(PosInfInterval!Date(Date(1999, 1, 12))) == Interval!Date(Date(1999, 1 , 12), Date(2012, 3, 1))); assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection(NegInfInterval!Date(Date(1999, 7, 6))) == NegInfInterval!Date(Date(1999, 7 , 6))); assert(NegInfInterval!Date(Date(2012, 3, 1)).intersection(NegInfInterval!Date(Date(2013, 1, 12))) == NegInfInterval!Date(Date(2012, 3 , 1))); } } //Test NegInfInterval's isAdjacent(). unittest { version(testStdDateTime) { auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static void testInterval(in NegInfInterval!Date negInfInterval, in Interval!Date interval) { negInfInterval.isAdjacent(interval); } assertThrown!DateTimeException(testInterval(negInfInterval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assert(!negInfInterval.isAdjacent(negInfInterval)); assert(!negInfInterval.isAdjacent(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3)))); assert(!negInfInterval.isAdjacent(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3)))); assert(!negInfInterval.isAdjacent(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4)))); assert(!negInfInterval.isAdjacent(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5)))); assert(!negInfInterval.isAdjacent(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7)))); assert(!negInfInterval.isAdjacent(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8)))); assert(!negInfInterval.isAdjacent(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6)))); assert(!negInfInterval.isAdjacent(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7)))); assert(!negInfInterval.isAdjacent(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7)))); assert(!negInfInterval.isAdjacent(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8)))); assert(negInfInterval.isAdjacent(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8)))); assert(!negInfInterval.isAdjacent(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); assert(!negInfInterval.isAdjacent(NegInfInterval!Date(Date(2010, 7, 3)))); assert(!negInfInterval.isAdjacent(NegInfInterval!Date(Date(2010, 7, 4)))); assert(!negInfInterval.isAdjacent(NegInfInterval!Date(Date(2010, 7, 5)))); assert(!negInfInterval.isAdjacent(NegInfInterval!Date(Date(2012, 1, 6)))); assert(!negInfInterval.isAdjacent(NegInfInterval!Date(Date(2012, 1, 7)))); assert(!negInfInterval.isAdjacent(NegInfInterval!Date(Date(2012, 1, 8)))); assert(!NegInfInterval!Date(Date(2010, 7, 3)).isAdjacent(negInfInterval)); assert(!NegInfInterval!Date(Date(2010, 7, 4)).isAdjacent(negInfInterval)); assert(!NegInfInterval!Date(Date(2010, 7, 5)).isAdjacent(negInfInterval)); assert(!NegInfInterval!Date(Date(2012, 1, 6)).isAdjacent(negInfInterval)); assert(!NegInfInterval!Date(Date(2012, 1, 7)).isAdjacent(negInfInterval)); assert(!NegInfInterval!Date(Date(2012, 1, 8)).isAdjacent(negInfInterval)); assert(!negInfInterval.isAdjacent(PosInfInterval!Date(Date(2010, 7, 3)))); assert(!negInfInterval.isAdjacent(PosInfInterval!Date(Date(2010, 7, 4)))); assert(!negInfInterval.isAdjacent(PosInfInterval!Date(Date(2010, 7, 5)))); assert(!negInfInterval.isAdjacent(PosInfInterval!Date(Date(2012, 1, 6)))); assert(negInfInterval.isAdjacent(PosInfInterval!Date(Date(2012, 1, 7)))); assert(!negInfInterval.isAdjacent(PosInfInterval!Date(Date(2012, 1, 8)))); auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, negInfInterval.isAdjacent(interval))); static assert(__traits(compiles, negInfInterval.isAdjacent(cInterval))); static assert(__traits(compiles, negInfInterval.isAdjacent(iInterval))); static assert(__traits(compiles, negInfInterval.isAdjacent(posInfInterval))); static assert(__traits(compiles, negInfInterval.isAdjacent(cPosInfInterval))); static assert(__traits(compiles, negInfInterval.isAdjacent(iPosInfInterval))); static assert(__traits(compiles, negInfInterval.isAdjacent(negInfInterval))); static assert(__traits(compiles, negInfInterval.isAdjacent(cNegInfInterval))); static assert(__traits(compiles, negInfInterval.isAdjacent(iNegInfInterval))); static assert(__traits(compiles, cNegInfInterval.isAdjacent(interval))); static assert(__traits(compiles, cNegInfInterval.isAdjacent(cInterval))); static assert(__traits(compiles, cNegInfInterval.isAdjacent(iInterval))); static assert(__traits(compiles, cNegInfInterval.isAdjacent(posInfInterval))); static assert(__traits(compiles, cNegInfInterval.isAdjacent(cPosInfInterval))); static assert(__traits(compiles, cNegInfInterval.isAdjacent(iPosInfInterval))); static assert(__traits(compiles, cNegInfInterval.isAdjacent(negInfInterval))); static assert(__traits(compiles, cNegInfInterval.isAdjacent(cNegInfInterval))); static assert(__traits(compiles, cNegInfInterval.isAdjacent(iNegInfInterval))); static assert(__traits(compiles, iNegInfInterval.isAdjacent(interval))); static assert(__traits(compiles, iNegInfInterval.isAdjacent(cInterval))); static assert(__traits(compiles, iNegInfInterval.isAdjacent(iInterval))); static assert(__traits(compiles, iNegInfInterval.isAdjacent(posInfInterval))); static assert(__traits(compiles, iNegInfInterval.isAdjacent(cPosInfInterval))); static assert(__traits(compiles, iNegInfInterval.isAdjacent(iPosInfInterval))); static assert(__traits(compiles, iNegInfInterval.isAdjacent(negInfInterval))); static assert(__traits(compiles, iNegInfInterval.isAdjacent(cNegInfInterval))); static assert(__traits(compiles, iNegInfInterval.isAdjacent(iNegInfInterval))); //Verify Examples. assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent(Interval!Date(Date(1999, 1, 12), Date(2012, 3, 1)))); assert(NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent(Interval!Date(Date(2012, 3, 1), Date(2019, 2, 2)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent(Interval!Date(Date(2022, 10, 19), Date(2027, 6, 3)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent(PosInfInterval!Date(Date(1999, 5, 4)))); assert(NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent(PosInfInterval!Date(Date(2012, 3, 1)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent(NegInfInterval!Date(Date(1996, 5, 4)))); assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent(NegInfInterval!Date(Date(2012, 3, 1)))); } } //Test NegInfInterval's merge(). unittest { version(testStdDateTime) { auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static void testInterval(I, J)(in I interval1, in J interval2) { interval1.merge(interval2); } assertThrown!DateTimeException(testInterval(negInfInterval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); assertThrown!DateTimeException(testInterval(negInfInterval, Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9)))); _assertPred!"=="(negInfInterval.merge(negInfInterval), negInfInterval); _assertPred!"=="(negInfInterval.merge(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.merge(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3))), NegInfInterval!Date(Date(2013, 7, 3))); _assertPred!"=="(negInfInterval.merge(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.merge(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.merge(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.merge(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8))), NegInfInterval!Date(Date(2012, 1, 8))); _assertPred!"=="(negInfInterval.merge(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.merge(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.merge(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.merge(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8))), NegInfInterval!Date(Date(2012, 1, 8))); _assertPred!"=="(negInfInterval.merge(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8))), NegInfInterval!Date(Date(2012, 1, 8))); _assertPred!"=="(negInfInterval.merge(NegInfInterval!Date(Date(2010, 7, 3))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.merge(NegInfInterval!Date(Date(2010, 7, 4))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.merge(NegInfInterval!Date(Date(2010, 7, 5))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.merge(NegInfInterval!Date(Date(2012, 1, 6))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.merge(NegInfInterval!Date(Date(2012, 1, 7))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.merge(NegInfInterval!Date(Date(2012, 1, 8))), NegInfInterval!Date(Date(2012, 1, 8))); _assertPred!"=="(NegInfInterval!Date(Date(2010, 7, 3)).merge(negInfInterval), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(NegInfInterval!Date(Date(2010, 7, 4)).merge(negInfInterval), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(NegInfInterval!Date(Date(2010, 7, 5)).merge(negInfInterval), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(NegInfInterval!Date(Date(2012, 1, 6)).merge(negInfInterval), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(NegInfInterval!Date(Date(2012, 1, 7)).merge(negInfInterval), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(NegInfInterval!Date(Date(2012, 1, 8)).merge(negInfInterval), NegInfInterval!Date(Date(2012, 1, 8))); static assert(!__traits(compiles, negInfInterval.merge(PosInfInterval!Date(Date(2010, 7, 3))))); static assert(!__traits(compiles, negInfInterval.merge(PosInfInterval!Date(Date(2010, 7, 4))))); static assert(!__traits(compiles, negInfInterval.merge(PosInfInterval!Date(Date(2010, 7, 5))))); static assert(!__traits(compiles, negInfInterval.merge(PosInfInterval!Date(Date(2012, 1, 6))))); static assert(!__traits(compiles, negInfInterval.merge(PosInfInterval!Date(Date(2012, 1, 7))))); static assert(!__traits(compiles, negInfInterval.merge(PosInfInterval!Date(Date(2012, 1, 8))))); auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, negInfInterval.merge(interval))); static assert(__traits(compiles, negInfInterval.merge(cInterval))); static assert(__traits(compiles, negInfInterval.merge(iInterval))); static assert(!__traits(compiles, negInfInterval.merge(posInfInterval))); static assert(!__traits(compiles, negInfInterval.merge(cPosInfInterval))); static assert(!__traits(compiles, negInfInterval.merge(iPosInfInterval))); static assert(__traits(compiles, negInfInterval.merge(negInfInterval))); static assert(__traits(compiles, negInfInterval.merge(cNegInfInterval))); static assert(__traits(compiles, negInfInterval.merge(iNegInfInterval))); static assert(__traits(compiles, cNegInfInterval.merge(interval))); static assert(__traits(compiles, cNegInfInterval.merge(cInterval))); static assert(__traits(compiles, cNegInfInterval.merge(iInterval))); static assert(!__traits(compiles, cNegInfInterval.merge(posInfInterval))); static assert(!__traits(compiles, cNegInfInterval.merge(cPosInfInterval))); static assert(!__traits(compiles, cNegInfInterval.merge(iPosInfInterval))); static assert(__traits(compiles, cNegInfInterval.merge(negInfInterval))); static assert(__traits(compiles, cNegInfInterval.merge(cNegInfInterval))); static assert(__traits(compiles, cNegInfInterval.merge(iNegInfInterval))); static assert(__traits(compiles, iNegInfInterval.merge(interval))); static assert(__traits(compiles, iNegInfInterval.merge(cInterval))); static assert(__traits(compiles, iNegInfInterval.merge(iInterval))); static assert(!__traits(compiles, iNegInfInterval.merge(posInfInterval))); static assert(!__traits(compiles, iNegInfInterval.merge(cPosInfInterval))); static assert(!__traits(compiles, iNegInfInterval.merge(iPosInfInterval))); static assert(__traits(compiles, iNegInfInterval.merge(negInfInterval))); static assert(__traits(compiles, iNegInfInterval.merge(cNegInfInterval))); static assert(__traits(compiles, iNegInfInterval.merge(iNegInfInterval))); //Verify Examples. assert(NegInfInterval!Date(Date(2012, 3, 1)).merge(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == NegInfInterval!Date(Date(2012, 3 , 1))); assert(NegInfInterval!Date(Date(2012, 3, 1)).merge(Interval!Date(Date(1999, 1, 12), Date(2015, 9, 2))) == NegInfInterval!Date(Date(2015, 9 , 2))); assert(NegInfInterval!Date(Date(2012, 3, 1)).merge(NegInfInterval!Date(Date(1999, 7, 6))) == NegInfInterval!Date(Date(2012, 3 , 1))); assert(NegInfInterval!Date(Date(2012, 3, 1)).merge(NegInfInterval!Date(Date(2013, 1, 12))) == NegInfInterval!Date(Date(2013, 1 , 12))); } } //Test NegInfInterval's span(). unittest { version(testStdDateTime) { auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static void testInterval(I, J)(in I interval1, in J interval2) { interval1.span(interval2); } assertThrown!DateTimeException(testInterval(negInfInterval, Interval!Date(Date(2010, 7, 4), dur!"days"(0)))); _assertPred!"=="(negInfInterval.span(negInfInterval), negInfInterval); _assertPred!"=="(negInfInterval.span(Interval!Date(Date(2010, 7, 1), Date(2010, 7, 3))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.span(Interval!Date(Date(2010, 7, 1), Date(2013, 7, 3))), NegInfInterval!Date(Date(2013, 7, 3))); _assertPred!"=="(negInfInterval.span(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 4))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.span(Interval!Date(Date(2010, 7, 3), Date(2010, 7, 5))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.span(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 7))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.span(Interval!Date(Date(2010, 7, 3), Date(2012, 1, 8))), NegInfInterval!Date(Date(2012, 1, 8))); _assertPred!"=="(negInfInterval.span(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 6))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.span(Interval!Date(Date(2010, 7, 5), Date(2012, 1, 7))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.span(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 7))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.span(Interval!Date(Date(2012, 1, 6), Date(2012, 1, 8))), NegInfInterval!Date(Date(2012, 1, 8))); _assertPred!"=="(negInfInterval.span(Interval!Date(Date(2012, 1, 7), Date(2012, 1, 8))), NegInfInterval!Date(Date(2012, 1, 8))); _assertPred!"=="(negInfInterval.span(Interval!Date(Date(2012, 1, 8), Date(2012, 1, 9))), NegInfInterval!Date(Date(2012, 1, 9))); _assertPred!"=="(negInfInterval.span(NegInfInterval!Date(Date(2010, 7, 3))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.span(NegInfInterval!Date(Date(2010, 7, 4))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.span(NegInfInterval!Date(Date(2010, 7, 5))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.span(NegInfInterval!Date(Date(2012, 1, 6))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.span(NegInfInterval!Date(Date(2012, 1, 7))), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(negInfInterval.span(NegInfInterval!Date(Date(2012, 1, 8))), NegInfInterval!Date(Date(2012, 1, 8))); _assertPred!"=="(NegInfInterval!Date(Date(2010, 7, 3)).span(negInfInterval), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(NegInfInterval!Date(Date(2010, 7, 4)).span(negInfInterval), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(NegInfInterval!Date(Date(2010, 7, 5)).span(negInfInterval), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(NegInfInterval!Date(Date(2012, 1, 6)).span(negInfInterval), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(NegInfInterval!Date(Date(2012, 1, 7)).span(negInfInterval), NegInfInterval!Date(Date(2012, 1, 7))); _assertPred!"=="(NegInfInterval!Date(Date(2012, 1, 8)).span(negInfInterval), NegInfInterval!Date(Date(2012, 1, 8))); static assert(!__traits(compiles, negInfInterval.span(PosInfInterval!Date(Date(2010, 7, 3))))); static assert(!__traits(compiles, negInfInterval.span(PosInfInterval!Date(Date(2010, 7, 4))))); static assert(!__traits(compiles, negInfInterval.span(PosInfInterval!Date(Date(2010, 7, 5))))); static assert(!__traits(compiles, negInfInterval.span(PosInfInterval!Date(Date(2012, 1, 6))))); static assert(!__traits(compiles, negInfInterval.span(PosInfInterval!Date(Date(2012, 1, 7))))); static assert(!__traits(compiles, negInfInterval.span(PosInfInterval!Date(Date(2012, 1, 8))))); auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); const cInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); immutable iInterval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); immutable iPosInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, negInfInterval.span(interval))); static assert(__traits(compiles, negInfInterval.span(cInterval))); static assert(__traits(compiles, negInfInterval.span(iInterval))); static assert(!__traits(compiles, negInfInterval.span(posInfInterval))); static assert(!__traits(compiles, negInfInterval.span(cPosInfInterval))); static assert(!__traits(compiles, negInfInterval.span(iPosInfInterval))); static assert(__traits(compiles, negInfInterval.span(negInfInterval))); static assert(__traits(compiles, negInfInterval.span(cNegInfInterval))); static assert(__traits(compiles, negInfInterval.span(iNegInfInterval))); static assert(__traits(compiles, cNegInfInterval.span(interval))); static assert(__traits(compiles, cNegInfInterval.span(cInterval))); static assert(__traits(compiles, cNegInfInterval.span(iInterval))); static assert(!__traits(compiles, cNegInfInterval.span(posInfInterval))); static assert(!__traits(compiles, cNegInfInterval.span(cPosInfInterval))); static assert(!__traits(compiles, cNegInfInterval.span(iPosInfInterval))); static assert(__traits(compiles, cNegInfInterval.span(negInfInterval))); static assert(__traits(compiles, cNegInfInterval.span(cNegInfInterval))); static assert(__traits(compiles, cNegInfInterval.span(iNegInfInterval))); static assert(__traits(compiles, iNegInfInterval.span(interval))); static assert(__traits(compiles, iNegInfInterval.span(cInterval))); static assert(__traits(compiles, iNegInfInterval.span(iInterval))); static assert(!__traits(compiles, iNegInfInterval.span(posInfInterval))); static assert(!__traits(compiles, iNegInfInterval.span(cPosInfInterval))); static assert(!__traits(compiles, iNegInfInterval.span(iPosInfInterval))); static assert(__traits(compiles, iNegInfInterval.span(negInfInterval))); static assert(__traits(compiles, iNegInfInterval.span(cNegInfInterval))); static assert(__traits(compiles, iNegInfInterval.span(iNegInfInterval))); //Verify Examples. assert(NegInfInterval!Date(Date(2012, 3, 1)).span(Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == NegInfInterval!Date(Date(2012, 3 , 1))); assert(NegInfInterval!Date(Date(2012, 3, 1)).span(Interval!Date(Date(1999, 1, 12), Date(2015, 9, 2))) == NegInfInterval!Date(Date(2015, 9 , 2))); assert(NegInfInterval!Date(Date(1600, 1, 7)).span(Interval!Date(Date(2012, 3, 11), Date(2017, 7, 1))) == NegInfInterval!Date(Date(2017, 7 , 1))); assert(NegInfInterval!Date(Date(2012, 3, 1)).span(NegInfInterval!Date(Date(1999, 7, 6))) == NegInfInterval!Date(Date(2012, 3 , 1))); assert(NegInfInterval!Date(Date(2012, 3, 1)).span(NegInfInterval!Date(Date(2013, 1, 12))) == NegInfInterval!Date(Date(2013, 1 , 12))); } } //Test NegInfInterval's shift(). unittest { version(testStdDateTime) { auto interval = NegInfInterval!Date(Date(2012, 1, 7)); static void testInterval(I)(I interval, in Duration duration, in I expected, size_t line = __LINE__) { interval.shift(duration); _assertPred!"=="(interval, expected, "", __FILE__, line); } testInterval(interval, dur!"days"(22), NegInfInterval!Date(Date(2012, 1, 29))); testInterval(interval, dur!"days"(-22), NegInfInterval!Date(Date(2011, 12, 16))); const cInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(!__traits(compiles, cInterval.shift(dur!"days"(5)))); static assert(!__traits(compiles, iInterval.shift(dur!"days"(5)))); //Verify Examples. auto interval1 = NegInfInterval!Date(Date(2012, 4, 5)); auto interval2 = NegInfInterval!Date(Date(2012, 4, 5)); interval1.shift(dur!"days"(50)); assert(interval1 == NegInfInterval!Date(Date(2012, 5, 25))); interval2.shift(dur!"days"(-50)); assert(interval2 == NegInfInterval!Date( Date(2012, 2, 15))); } } //Test NegInfInterval's shift(int, int, AllowDayOverflow). unittest { version(testStdDateTime) { { auto interval = NegInfInterval!Date(Date(2012, 1, 7)); static void testIntervalFail(I)(I interval, int years, int months) { interval.shift(years, months); } static void testInterval(I)(I interval, int years, int months, AllowDayOverflow allow, in I expected, size_t line = __LINE__) { interval.shift(years, months, allow); _assertPred!"=="(interval, expected, "", __FILE__, line); } testInterval(interval, 5, 0, AllowDayOverflow.yes, NegInfInterval!Date(Date(2017, 1, 7))); testInterval(interval, -5, 0, AllowDayOverflow.yes, NegInfInterval!Date(Date(2007, 1, 7))); auto interval2 = NegInfInterval!Date(Date(2010, 5, 31)); testInterval(interval2, 1, 1, AllowDayOverflow.yes, NegInfInterval!Date(Date(2011, 7, 1))); testInterval(interval2, 1, -1, AllowDayOverflow.yes, NegInfInterval!Date(Date(2011, 5, 1))); testInterval(interval2, -1, -1, AllowDayOverflow.yes, NegInfInterval!Date(Date(2009, 5, 1))); testInterval(interval2, -1, 1, AllowDayOverflow.yes, NegInfInterval!Date(Date(2009, 7, 1))); testInterval(interval2, 1, 1, AllowDayOverflow.no, NegInfInterval!Date(Date(2011, 6, 30))); testInterval(interval2, 1, -1, AllowDayOverflow.no, NegInfInterval!Date(Date(2011, 4, 30))); testInterval(interval2, -1, -1, AllowDayOverflow.no, NegInfInterval!Date(Date(2009, 4, 30))); testInterval(interval2, -1, 1, AllowDayOverflow.no, NegInfInterval!Date(Date(2009, 6, 30))); } const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(!__traits(compiles, cNegInfInterval.shift(1))); static assert(!__traits(compiles, iNegInfInterval.shift(1))); //Verify Examples. auto interval1 = NegInfInterval!Date(Date(2012, 3, 1)); auto interval2 = NegInfInterval!Date(Date(2012, 3, 1)); interval1.shift(2); assert(interval1 == NegInfInterval!Date(Date(2014, 3, 1))); interval2.shift(-2); assert(interval2 == NegInfInterval!Date(Date(2010, 3, 1))); } } //Test NegInfInterval's expand(). unittest { version(testStdDateTime) { auto interval = NegInfInterval!Date(Date(2012, 1, 7)); static void testInterval(I)(I interval, in Duration duration, in I expected, size_t line = __LINE__) { interval.expand(duration); _assertPred!"=="(interval, expected, "", __FILE__, line); } testInterval(interval, dur!"days"(22), NegInfInterval!Date(Date(2012, 1, 29))); testInterval(interval, dur!"days"(-22), NegInfInterval!Date(Date(2011, 12, 16))); const cInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(!__traits(compiles, cInterval.expand(dur!"days"(5)))); static assert(!__traits(compiles, iInterval.expand(dur!"days"(5)))); //Verify Examples. auto interval1 = NegInfInterval!Date(Date(2012, 3, 1)); auto interval2 = NegInfInterval!Date(Date(2012, 3, 1)); interval1.expand(dur!"days"(2)); assert(interval1 == NegInfInterval!Date(Date(2012, 3, 3))); interval2.expand(dur!"days"(-2)); assert(interval2 == NegInfInterval!Date(Date(2012, 2, 28))); } } //Test NegInfInterval's expand(int, int, AllowDayOverflow). unittest { version(testStdDateTime) { { auto interval = NegInfInterval!Date(Date(2012, 1, 7)); static void testInterval(I)(I interval, int years, int months, AllowDayOverflow allow, in I expected, size_t line = __LINE__) { interval.expand(years, months, allow); _assertPred!"=="(interval, expected, "", __FILE__, line); } testInterval(interval, 5, 0, AllowDayOverflow.yes, NegInfInterval!Date(Date(2017, 1, 7))); testInterval(interval, -5, 0, AllowDayOverflow.yes, NegInfInterval!Date(Date(2007, 1, 7))); auto interval2 = NegInfInterval!Date(Date(2010, 5, 31)); testInterval(interval2, 1, 1, AllowDayOverflow.yes, NegInfInterval!Date(Date(2011, 7, 1))); testInterval(interval2, 1, -1, AllowDayOverflow.yes, NegInfInterval!Date(Date(2011, 5, 1))); testInterval(interval2, -1, -1, AllowDayOverflow.yes, NegInfInterval!Date(Date(2009, 5, 1))); testInterval(interval2, -1, 1, AllowDayOverflow.yes, NegInfInterval!Date(Date(2009, 7, 1))); testInterval(interval2, 1, 1, AllowDayOverflow.no, NegInfInterval!Date(Date(2011, 6, 30))); testInterval(interval2, 1, -1, AllowDayOverflow.no, NegInfInterval!Date(Date(2011, 4, 30))); testInterval(interval2, -1, -1, AllowDayOverflow.no, NegInfInterval!Date(Date(2009, 4, 30))); testInterval(interval2, -1, 1, AllowDayOverflow.no, NegInfInterval!Date( Date(2009, 6, 30))); } const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(!__traits(compiles, cNegInfInterval.expand(1))); static assert(!__traits(compiles, iNegInfInterval.expand(1))); //Verify Examples. auto interval1 = NegInfInterval!Date(Date(2012, 3, 1)); auto interval2 = NegInfInterval!Date(Date(2012, 3, 1)); interval1.expand(2); assert(interval1 == NegInfInterval!Date(Date(2014, 3, 1))); interval2.expand(-2); assert(interval2 == NegInfInterval!Date(Date(2010, 3, 1))); } } //Test NegInfInterval's bwdRange(). unittest { version(testStdDateTime) { auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static void testInterval(NegInfInterval!Date negInfInterval) { negInfInterval.bwdRange(everyDayOfWeek!(Date, Direction.fwd)(DayOfWeek.fri)).popFront(); } assertThrown!DateTimeException(testInterval(negInfInterval)); _assertPred!"=="(NegInfInterval!Date(Date(2010, 10, 1)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri)).front, Date(2010, 10, 1)); _assertPred!"=="(NegInfInterval!Date(Date(2010, 10, 1)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri), PopFirst.yes).front, Date(2010, 9, 24)); //Verify Examples. auto interval = NegInfInterval!Date(Date(2010, 9, 9)); auto func = delegate (in Date date) { if((date.day & 1) == 0) return date - dur!"days"(2); return date - dur!"days"(1); }; auto range = interval.bwdRange(func); //An odd day. Using PopFirst.yes would have made this Date(2010, 9, 8). assert(range.front == Date(2010, 9, 9)); range.popFront(); assert(range.front == Date(2010, 9, 8)); range.popFront(); assert(range.front == Date(2010, 9, 6)); range.popFront(); assert(range.front == Date(2010, 9, 4)); range.popFront(); assert(range.front == Date(2010, 9, 2)); range.popFront(); assert(!range.empty); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, cNegInfInterval.bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri)))); static assert(__traits(compiles, iNegInfInterval.bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri)))); } } //Test NegInfInterval's toString(). unittest { version(testStdDateTime) { _assertPred!"=="(NegInfInterval!Date(Date(2012, 1, 7)).toString(), "[-∞ - 2012-Jan-07)"); const cNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); immutable iNegInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); static assert(__traits(compiles, cNegInfInterval.toString())); static assert(__traits(compiles, iNegInfInterval.toString())); } } /++ Range-generating function. Returns a delegate which returns the next time point with the given $(D DayOfWeek) in a range. Using this delegate allows iteration over successive time points which are all the same day of the week. e.g. passing $(D DayOfWeek.mon) to $(D everyDayOfWeek) would result in a delegate which could be used to iterate over all of the Mondays in a range. Params: dir = The direction to iterate in. If passing the return value to $(D fwdRange), use $(D Direction.fwd). If passing it to $(D bwdRange), use $(D Direction.bwd). dayOfWeek = The week that each time point in the range will be. Examples: -------------------- auto interval = Interval!Date(Date(2010, 9, 2), Date(2010, 9, 27)); auto func = everyDayOfWeek!Date(DayOfWeek.mon); auto range = interval.fwdRange(func); //A Thursday. Using PopFirst.yes would have made this Date(2010, 9, 6). assert(range.front == Date(2010, 9, 2)); range.popFront(); assert(range.front == Date(2010, 9, 6)); range.popFront(); assert(range.front == Date(2010, 9, 13)); range.popFront(); assert(range.front == Date(2010, 9, 20)); range.popFront(); assert(range.empty); -------------------- +/ static TP delegate(in TP) everyDayOfWeek(TP, Direction dir = Direction.fwd)(DayOfWeek dayOfWeek) nothrow if(isTimePoint!TP && (dir == Direction.fwd || dir == Direction.bwd) && __traits(hasMember, TP, "dayOfWeek") && !__traits(isStaticFunction, TP.dayOfWeek) && is(ReturnType!(TP.dayOfWeek) == DayOfWeek) && (functionAttributes!(TP.dayOfWeek) & FunctionAttribute.property) && (functionAttributes!(TP.dayOfWeek) & FunctionAttribute.nothrow_)) { TP func(in TP tp) { TP retval = cast(TP)tp; immutable days = daysToDayOfWeek(retval.dayOfWeek, dayOfWeek); static if(dir == Direction.fwd) immutable adjustedDays = days == 0 ? 7 : days; else immutable adjustedDays = days == 0 ? -7 : days - 7; return retval += dur!"days"(adjustedDays); } return &func; } unittest { version(testStdDateTime) { auto funcFwd = everyDayOfWeek!Date(DayOfWeek.mon); auto funcBwd = everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.mon); _assertPred!"=="(funcFwd(Date(2010, 8, 28)), Date(2010, 8, 30)); _assertPred!"=="(funcFwd(Date(2010, 8, 29)), Date(2010, 8, 30)); _assertPred!"=="(funcFwd(Date(2010, 8, 30)), Date(2010, 9, 6)); _assertPred!"=="(funcFwd(Date(2010, 8, 31)), Date(2010, 9, 6)); _assertPred!"=="(funcFwd(Date(2010, 9, 1)), Date(2010, 9, 6)); _assertPred!"=="(funcFwd(Date(2010, 9, 2)), Date(2010, 9, 6)); _assertPred!"=="(funcFwd(Date(2010, 9, 3)), Date(2010, 9, 6)); _assertPred!"=="(funcFwd(Date(2010, 9, 4)), Date(2010, 9, 6)); _assertPred!"=="(funcFwd(Date(2010, 9, 5)), Date(2010, 9, 6)); _assertPred!"=="(funcFwd(Date(2010, 9, 6)), Date(2010, 9, 13)); _assertPred!"=="(funcFwd(Date(2010, 9, 7)), Date(2010, 9, 13)); _assertPred!"=="(funcBwd(Date(2010, 8, 28)), Date(2010, 8, 23)); _assertPred!"=="(funcBwd(Date(2010, 8, 29)), Date(2010, 8, 23)); _assertPred!"=="(funcBwd(Date(2010, 8, 30)), Date(2010, 8, 23)); _assertPred!"=="(funcBwd(Date(2010, 8, 31)), Date(2010, 8, 30)); _assertPred!"=="(funcBwd(Date(2010, 9, 1)), Date(2010, 8, 30)); _assertPred!"=="(funcBwd(Date(2010, 9, 2)), Date(2010, 8, 30)); _assertPred!"=="(funcBwd(Date(2010, 9, 3)), Date(2010, 8, 30)); _assertPred!"=="(funcBwd(Date(2010, 9, 4)), Date(2010, 8, 30)); _assertPred!"=="(funcBwd(Date(2010, 9, 5)), Date(2010, 8, 30)); _assertPred!"=="(funcBwd(Date(2010, 9, 6)), Date(2010, 8, 30)); _assertPred!"=="(funcBwd(Date(2010, 9, 7)), Date(2010, 9, 6)); static assert(!__traits(compiles, everyDayOfWeek!(TimeOfDay)(DayOfWeek.mon))); static assert(__traits(compiles, everyDayOfWeek!(DateTime)(DayOfWeek.mon))); static assert(__traits(compiles, everyDayOfWeek!(SysTime)(DayOfWeek.mon))); //Verify Examples. auto interval = Interval!Date(Date(2010, 9, 2), Date(2010, 9, 27)); auto func = everyDayOfWeek!Date(DayOfWeek.mon); auto range = interval.fwdRange(func); //A Thursday. Using PopFirst.yes would have made this Date(2010, 9, 6). assert(range.front == Date(2010, 9, 2)); range.popFront(); assert(range.front == Date(2010, 9, 6)); range.popFront(); assert(range.front == Date(2010, 9, 13)); range.popFront(); assert(range.front == Date(2010, 9, 20)); range.popFront(); assert(range.empty); } } /++ Range-generating function. Returns a delegate which returns the next time point with the given month which would be reached by adding months to the given time point. So, using this delegate allows iteration over successive time points which are in the same month but different years. For example, iterate over each successive December 25th in an interval by starting with a date which had the 25th as its day and passed $(D Month.dec) to $(D everyMonth) to create the delegate. Since it wouldn't really make sense to be iterating over a specific month and end up with some of the time points in the succeeding month or two years after the previous time point, $(D AllowDayOverflow.no) is always used when calculating the next time point. Params: dir = The direction to iterate in. If passing the return value to $(D fwdRange), use $(D Direction.fwd). If passing it to $(D bwdRange), use $(D Direction.bwd). month = The month that each time point in the range will be in. Examples: -------------------- auto interval = Interval!Date(Date(2000, 1, 30), Date(2004, 8, 5)); auto func = everyMonth!(Date)(Month.feb); auto range = interval.fwdRange(func); //Using PopFirst.yes would have made this Date(2010, 2, 29). assert(range.front == Date(2000, 1, 30)); range.popFront(); assert(range.front == Date(2000, 2, 29)); range.popFront(); assert(range.front == Date(2001, 2, 28)); range.popFront(); assert(range.front == Date(2002, 2, 28)); range.popFront(); assert(range.front == Date(2003, 2, 28)); range.popFront(); assert(range.front == Date(2004, 2, 28)); range.popFront(); assert(range.empty); -------------------- +/ static TP delegate(in TP) everyMonth(TP, Direction dir = Direction.fwd)(int month) if(isTimePoint!TP && (dir == Direction.fwd || dir == Direction.bwd) && __traits(hasMember, TP, "month") && !__traits(isStaticFunction, TP.month) && is(ReturnType!(TP.month) == Month) && (functionAttributes!(TP.month) & FunctionAttribute.property) && (functionAttributes!(TP.month) & FunctionAttribute.nothrow_)) { enforceValid!"months"(month); TP func(in TP tp) { TP retval = cast(TP)tp; immutable months = monthsToMonth(retval.month, month); static if(dir == Direction.fwd) immutable adjustedMonths = months == 0 ? 12 : months; else immutable adjustedMonths = months == 0 ? -12 : months - 12; retval.add!"months"(adjustedMonths, AllowDayOverflow.no); if(retval.month != month) { retval.add!"months"(-1); assert(retval.month == month); } return retval; } return &func; } unittest { version(testStdDateTime) { auto funcFwd = everyMonth!Date(Month.jun); auto funcBwd = everyMonth!(Date, Direction.bwd)(Month.jun); _assertPred!"=="(funcFwd(Date(2010, 5, 31)), Date(2010, 6, 30)); _assertPred!"=="(funcFwd(Date(2010, 6, 30)), Date(2011, 6, 30)); _assertPred!"=="(funcFwd(Date(2010, 7, 31)), Date(2011, 6, 30)); _assertPred!"=="(funcFwd(Date(2010, 8, 31)), Date(2011, 6, 30)); _assertPred!"=="(funcFwd(Date(2010, 9, 30)), Date(2011, 6, 30)); _assertPred!"=="(funcFwd(Date(2010, 10, 31)), Date(2011, 6, 30)); _assertPred!"=="(funcFwd(Date(2010, 11, 30)), Date(2011, 6, 30)); _assertPred!"=="(funcFwd(Date(2010, 12, 31)), Date(2011, 6, 30)); _assertPred!"=="(funcFwd(Date(2011, 1, 31)), Date(2011, 6, 30)); _assertPred!"=="(funcFwd(Date(2011, 2, 28)), Date(2011, 6, 28)); _assertPred!"=="(funcFwd(Date(2011, 3, 31)), Date(2011, 6, 30)); _assertPred!"=="(funcFwd(Date(2011, 4, 30)), Date(2011, 6, 30)); _assertPred!"=="(funcFwd(Date(2011, 5, 31)), Date(2011, 6, 30)); _assertPred!"=="(funcFwd(Date(2011, 6, 30)), Date(2012, 6, 30)); _assertPred!"=="(funcFwd(Date(2011, 7, 31)), Date(2012, 6, 30)); _assertPred!"=="(funcBwd(Date(2010, 5, 31)), Date(2009, 6, 30)); _assertPred!"=="(funcBwd(Date(2010, 6, 30)), Date(2009, 6, 30)); _assertPred!"=="(funcBwd(Date(2010, 7, 31)), Date(2010, 6, 30)); _assertPred!"=="(funcBwd(Date(2010, 8, 31)), Date(2010, 6, 30)); _assertPred!"=="(funcBwd(Date(2010, 9, 30)), Date(2010, 6, 30)); _assertPred!"=="(funcBwd(Date(2010, 10, 31)), Date(2010, 6, 30)); _assertPred!"=="(funcBwd(Date(2010, 11, 30)), Date(2010, 6, 30)); _assertPred!"=="(funcBwd(Date(2010, 12, 31)), Date(2010, 6, 30)); _assertPred!"=="(funcBwd(Date(2011, 1, 31)), Date(2010, 6, 30)); _assertPred!"=="(funcBwd(Date(2011, 2, 28)), Date(2010, 6, 28)); _assertPred!"=="(funcBwd(Date(2011, 3, 31)), Date(2010, 6, 30)); _assertPred!"=="(funcBwd(Date(2011, 4, 30)), Date(2010, 6, 30)); _assertPred!"=="(funcBwd(Date(2011, 5, 31)), Date(2010, 6, 30)); _assertPred!"=="(funcBwd(Date(2011, 6, 30)), Date(2010, 6, 30)); _assertPred!"=="(funcBwd(Date(2011, 7, 30)), Date(2011, 6, 30)); static assert(!__traits(compiles, everyMonth!(TimeOfDay)(Month.jan))); static assert(__traits(compiles, everyMonth!(DateTime)(Month.jan))); static assert(__traits(compiles, everyMonth!(SysTime)(Month.jan))); //Verify Examples. auto interval = Interval!Date(Date(2000, 1, 30), Date(2004, 8, 5)); auto func = everyMonth!(Date)(Month.feb); auto range = interval.fwdRange(func); //Using PopFirst.yes would have made this Date(2010, 2, 29). assert(range.front == Date(2000, 1, 30)); range.popFront(); assert(range.front == Date(2000, 2, 29)); range.popFront(); assert(range.front == Date(2001, 2, 28)); range.popFront(); assert(range.front == Date(2002, 2, 28)); range.popFront(); assert(range.front == Date(2003, 2, 28)); range.popFront(); assert(range.front == Date(2004, 2, 28)); range.popFront(); assert(range.empty); } } /++ Range-generating function. Returns a delegate which returns the next time point which is the given duration later. Using this delegate allows iteration over successive time points which are apart by the given duration e.g. passing $(D dur!"days"(3)) to $(D everyDuration) would result in a delegate which could be used to iterate over a range of days which are each 3 days apart. Params: dir = The direction to iterate in. If passing the return value to $(D fwdRange), use $(D Direction.fwd). If passing it to $(D bwdRange), use $(D Direction.bwd). duration = The duration which separates each successive time point in the range. Examples: -------------------- auto interval = Interval!Date(Date(2010, 9, 2), Date(2010, 9, 27)); auto func = everyDuration!Date(dur!"days"(8)); auto range = interval.fwdRange(func); //Using PopFirst.yes would have made this Date(2010, 9, 10). assert(range.front == Date(2010, 9, 2)); range.popFront(); assert(range.front == Date(2010, 9, 10)); range.popFront(); assert(range.front == Date(2010, 9, 18)); range.popFront(); assert(range.front == Date(2010, 9, 26)); range.popFront(); assert(range.empty); -------------------- +/ static TP delegate(in TP) everyDuration(TP, Direction dir = Direction.fwd, D) (D duration) nothrow if(isTimePoint!TP && __traits(compiles, TP.init + duration) && (dir == Direction.fwd || dir == Direction.bwd)) { TP func(in TP tp) { static if(dir == Direction.fwd) return tp + duration; else return tp - duration; } return &func; } unittest { version(testStdDateTime) { auto funcFwd = everyDuration!Date(dur!"days"(27)); auto funcBwd = everyDuration!(Date, Direction.bwd)(dur!"days"(27)); _assertPred!"=="(funcFwd(Date(2009, 12, 25)), Date(2010, 1, 21)); _assertPred!"=="(funcFwd(Date(2009, 12, 26)), Date(2010, 1, 22)); _assertPred!"=="(funcFwd(Date(2009, 12, 27)), Date(2010, 1, 23)); _assertPred!"=="(funcFwd(Date(2009, 12, 28)), Date(2010, 1, 24)); _assertPred!"=="(funcBwd(Date(2010, 1, 21)), Date(2009, 12, 25)); _assertPred!"=="(funcBwd(Date(2010, 1, 22)), Date(2009, 12, 26)); _assertPred!"=="(funcBwd(Date(2010, 1, 23)), Date(2009, 12, 27)); _assertPred!"=="(funcBwd(Date(2010, 1, 24)), Date(2009, 12, 28)); static assert(__traits(compiles, everyDuration!Date(dur!"hnsecs"(1)))); static assert(__traits(compiles, everyDuration!TimeOfDay(dur!"hnsecs"(1)))); static assert(__traits(compiles, everyDuration!DateTime(dur!"hnsecs"(1)))); static assert(__traits(compiles, everyDuration!SysTime(dur!"hnsecs"(1)))); //Verify Examples. auto interval = Interval!Date(Date(2010, 9, 2), Date(2010, 9, 27)); auto func = everyDuration!Date(dur!"days"(8)); auto range = interval.fwdRange(func); //Using PopFirst.yes would have made this Date(2010, 9, 10). assert(range.front == Date(2010, 9, 2)); range.popFront(); assert(range.front == Date(2010, 9, 10)); range.popFront(); assert(range.front == Date(2010, 9, 18)); range.popFront(); assert(range.front == Date(2010, 9, 26)); range.popFront(); assert(range.empty); } } /++ Range-generating function. Returns a delegate which returns the next time point which is the given number of years, month, and duration later. The difference between this version of $(D everyDuration) and the version which just takes a $(D Duration) is that this one also takes the number of years and months (along with an $(D AllowDayOverflow) to indicate whether adding years and months should allow the days to overflow). Note that if iterating forward, $(D add!"years"()) is called on the given time point, then $(D add!"months"()), and finally the duration is added to it. However, if iterating backwards, the duration is added first, then $(D add!"months"()) is called, and finally $(D add!"years"()) is called. That way, going backwards generates close to the same time points that iterating forward does, but since adding years and months is not entirely reversible (due to possible day overflow, regardless of whether $(D AllowDayOverflow.yes) or $(D AllowDayOverflow.no) is used), it can't be guaranteed that iterating backwards will give the same time points as iterating forward would have (even assuming that the end of the range is a time point which would be returned by the delegate when iterating forward from $(D begin)). Params: dir = The direction to iterate in. If passing the return value to $(D fwdRange), use $(D Direction.fwd). If passing it to $(D bwdRange), use $(D Direction.bwd). years = The number of years to add to the time point passed to the delegate. months = The number of months to add to the time point passed to the delegate. allowOverflow = Whether the days should be allowed to overflow on $(D begin) and $(D end), causing their month to increment. duration = The duration to add to the time point passed to the delegate. Examples: -------------------- auto interval = Interval!Date(Date(2010, 9, 2), Date(2025, 9, 27)); auto func = everyDuration!Date(4, 1, AllowDayOverflow.yes, dur!"days"(2)); auto range = interval.fwdRange(func); //Using PopFirst.yes would have made this Date(2014, 10, 12). assert(range.front == Date(2010, 9, 2)); range.popFront(); assert(range.front == Date(2014, 10, 4)); range.popFront(); assert(range.front == Date(2018, 11, 6)); range.popFront(); assert(range.front == Date(2022, 12, 8)); range.popFront(); assert(range.empty); -------------------- +/ static TP delegate(in TP) everyDuration(TP, Direction dir = Direction.fwd, D) (int years, int months = 0, AllowDayOverflow allowOverflow = AllowDayOverflow.yes, D duration = dur!"days"(0)) nothrow if(isTimePoint!TP && __traits(compiles, TP.init + duration) && __traits(compiles, TP.init.add!"years"(years)) && __traits(compiles, TP.init.add!"months"(months)) && (dir == Direction.fwd || dir == Direction.bwd)) { TP func(in TP tp) { static if(dir == Direction.fwd) { TP retval = cast(TP)tp; retval.add!"years"(years, allowOverflow); retval.add!"months"(months, allowOverflow); return retval + duration; } else { TP retval = tp - duration; retval.add!"months"(-months, allowOverflow); retval.add!"years"(-years, allowOverflow); return retval; } } return &func; } unittest { version(testStdDateTime) { { auto funcFwd = everyDuration!Date(1, 2, AllowDayOverflow.yes, dur!"days"(3)); auto funcBwd = everyDuration!(Date, Direction.bwd)(1, 2, AllowDayOverflow.yes, dur!"days"(3)); _assertPred!"=="(funcFwd(Date(2009, 12, 25)), Date(2011, 2, 28)); _assertPred!"=="(funcFwd(Date(2009, 12, 26)), Date(2011, 3, 1)); _assertPred!"=="(funcFwd(Date(2009, 12, 27)), Date(2011, 3, 2)); _assertPred!"=="(funcFwd(Date(2009, 12, 28)), Date(2011, 3, 3)); _assertPred!"=="(funcFwd(Date(2009, 12, 29)), Date(2011, 3, 4)); _assertPred!"=="(funcBwd(Date(2011, 2, 28)), Date(2009, 12, 25)); _assertPred!"=="(funcBwd(Date(2011, 3, 1)), Date(2009, 12, 26)); _assertPred!"=="(funcBwd(Date(2011, 3, 2)), Date(2009, 12, 27)); _assertPred!"=="(funcBwd(Date(2011, 3, 3)), Date(2009, 12, 28)); _assertPred!"=="(funcBwd(Date(2011, 3, 4)), Date(2010, 1, 1)); } { auto funcFwd = everyDuration!Date(1, 2, AllowDayOverflow.no, dur!"days"(3)); auto funcBwd = everyDuration!(Date, Direction.bwd)(1, 2, AllowDayOverflow.yes, dur!"days"(3)); _assertPred!"=="(funcFwd(Date(2009, 12, 25)), Date(2011, 2, 28)); _assertPred!"=="(funcFwd(Date(2009, 12, 26)), Date(2011, 3, 1)); _assertPred!"=="(funcFwd(Date(2009, 12, 27)), Date(2011, 3, 2)); _assertPred!"=="(funcFwd(Date(2009, 12, 28)), Date(2011, 3, 3)); _assertPred!"=="(funcFwd(Date(2009, 12, 29)), Date(2011, 3, 3)); _assertPred!"=="(funcBwd(Date(2011, 2, 28)), Date(2009, 12, 25)); _assertPred!"=="(funcBwd(Date(2011, 3, 1)), Date(2009, 12, 26)); _assertPred!"=="(funcBwd(Date(2011, 3, 2)), Date(2009, 12, 27)); _assertPred!"=="(funcBwd(Date(2011, 3, 3)), Date(2009, 12, 28)); _assertPred!"=="(funcBwd(Date(2011, 3, 4)), Date(2010, 1, 1)); } static assert(__traits(compiles, everyDuration!Date(1, 2, AllowDayOverflow.yes, dur!"hnsecs"(1)))); static assert(!__traits(compiles, everyDuration!TimeOfDay(1, 2, AllowDayOverflow.yes, dur!"hnsecs"(1)))); static assert(__traits(compiles, everyDuration!DateTime(1, 2, AllowDayOverflow.yes, dur!"hnsecs"(1)))); static assert(__traits(compiles, everyDuration!SysTime(1, 2, AllowDayOverflow.yes, dur!"hnsecs"(1)))); //Verify Examples. auto interval = Interval!Date(Date(2010, 9, 2), Date(2025, 9, 27)); auto func = everyDuration!Date(4, 1, AllowDayOverflow.yes, dur!"days"(2)); auto range = interval.fwdRange(func); //Using PopFirst.yes would have made this Date(2014, 10, 12). assert(range.front == Date(2010, 9, 2)); range.popFront(); assert(range.front == Date(2014, 10, 4)); range.popFront(); assert(range.front == Date(2018, 11, 6)); range.popFront(); assert(range.front == Date(2022, 12, 8)); range.popFront(); assert(range.empty); } } //TODO Add function to create a range generating function based on a date recurrence pattern string. // This may or may not involve creating a date recurrence pattern class of some sort - probably // yes if we want to make it easy to build them. However, there is a standard recurrence // pattern string format which we'd want to support with a range generator (though if we have // the class/struct, we'd probably want a version of the range generating function which took // that rather than a string). //============================================================================== // Section with ranges. //============================================================================== /++ A range over an $(D Interval). $(D IntervalRange) is only ever constructed by $(D Interval). However, when it is constructed, it is given a function, $(D func), which is used to generate the time points which are iterated over. $(D func) takes a time point and returns a time point of the same type. For instance, to iterate over all of the days in the interval $(D Interval!Date), pass a function to $(D Interval)'s $(D fwdRange) where that function took a $(D Date) and returned a $(D Date) which was one day later. That function would then be used by $(D IntervalRange)'s $(D popFront) to iterate over the $(D Date)s in the interval. If $(D dir == Direction.fwd), then a range iterates forward in time, whereas if $(D dir == Direction.bwd), then it iterates backwards in time. So, if $(D dir == Direction.fwd) then $(D front == interval.begin), whereas if $(D dir == Direction.bwd) then $(D front == interval.end). $(D func) must generate a time point going in the proper direction of iteration, or a $(D DateTimeException) will be thrown. So, to iterate forward in time, the time point that $(D func) generates must be later in time than the one passed to it. If it's either identical or earlier in time, then a $(D DateTimeException) will be thrown. To iterate backwards, then the generated time point must be before the time point which was passed in. If the generated time point is ever passed the edge of the range in the proper direction, then the edge of that range will be used instead. So, if iterating forward, and the generated time point is past the interval's $(D end), then $(D front) becomes $(D end). If iterating backwards, and the generated time point is before $(D begin), then $(D front) becomes $(D begin). In either case, the range would then be empty. Also note that while normally the $(D begin) of an interval is included in it and its $(D end) is excluded from it, if $(D dir == Direction.bwd), then $(D begin) is treated as excluded and $(D end) is treated as included. This allows for the same behavior in both directions. This works because none of $(D Interval)'s functions which care about whether $(D begin) or $(D end) is included or excluded are ever called by $(D IntervalRange). $(D interval) returns a normal interval, regardless of whether $(D dir == Direction.fwd) or if $(D dir == Direction.bwd), so any $(D Interval) functions which are called on it which care about whether $(D begin) or $(D end) are included or excluded will treat $(D begin) as included and $(D end) as excluded. +/ struct IntervalRange(TP, Direction dir) if(isTimePoint!TP && dir != Direction.both) { public: /++ Params: rhs = The $(D IntervalRange) to assign to this one. +/ /+ref+/ IntervalRange opAssign(ref IntervalRange rhs) pure nothrow { _interval = rhs._interval; _func = rhs._func; return this; } /++ Whether this $(D IntervalRange) is empty. +/ @property bool empty() const pure nothrow { return _interval.empty; } /++ The first time point in the range. Throws: $(D DateTimeException) if the range is empty. +/ @property TP front() const pure { _enforceNotEmpty(); static if(dir == Direction.fwd) return _interval.begin; else return _interval.end; } /++ Pops $(D front) from the range, using $(D func) to generate the next time point in the range. If the generated time point is beyond the edge of the range, then $(D front) is set to that edge, and the range is then empty. So, if iterating forwards, and the generated time point is greater than the interval's $(D end), then $(D front) is set to $(D end). If iterating backwards, and the generated time point is less than the interval's $(D begin), then $(D front) is set to $(D begin). Throws: $(D DateTimeException) if the range is empty or if the generated time point is in the wrong direction (i.e. if iterating forward and the generated time point is before $(D front), or if iterating backwards and the generated time point is after $(D front)). +/ void popFront() { _enforceNotEmpty(); static if(dir == Direction.fwd) { auto begin = _func(_interval.begin); if(begin > _interval.end) begin = _interval.end; _enforceCorrectDirection(begin); _interval.begin = begin; } else { auto end = _func(_interval.end); if(end < _interval.begin) end = _interval.begin; _enforceCorrectDirection(end); _interval.end = end; } } /++ Returns a copy of $(D this). +/ @property IntervalRange save() pure nothrow { return this; } /++ The interval that this $(D IntervalRange) currently covers. +/ @property Interval!TP interval() const pure nothrow { return cast(Interval!TP)_interval; } /++ The function used to generate the next time point in the range. +/ TP delegate(in TP) func() pure nothrow @property { return _func; } /++ The $(D Direction) that this range iterates in. +/ @property Direction direction() const pure nothrow { return dir; } private: /+ Params: interval = The interval that this range covers. func = The function used to generate the time points which are iterated over. +/ this(in Interval!TP interval, TP delegate(in TP) func) pure nothrow { _func = func; _interval = interval; } /+ Throws: $(D DateTimeException) if this interval is empty. +/ void _enforceNotEmpty(size_t line = __LINE__) const pure { if(empty) throw new DateTimeException("Invalid operation for an empty IntervalRange.", __FILE__, line); } /+ Throws: $(D DateTimeException) if $(D_PARAM newTP) is in the wrong direction. +/ void _enforceCorrectDirection(in TP newTP, size_t line = __LINE__) const { static if(dir == Direction.fwd) { enforce(newTP > _interval._begin, new DateTimeException(format("Generated time point is before previous begin: prev [%s] new [%s]", interval._begin, newTP), __FILE__, line)); } else { enforce(newTP < _interval._end, new DateTimeException(format("Generated time point is after previous end: prev [%s] new [%s]", interval._end, newTP), __FILE__, line)); } } Interval!TP _interval; TP delegate(in TP) _func; } //Test that IntervalRange satisfies the range predicates that it's supposed to satisfy. unittest { version(testStdDateTime) { static assert(isInputRange!(IntervalRange!(Date, Direction.fwd))); static assert(isForwardRange!(IntervalRange!(Date, Direction.fwd))); //Commented out due to bug http://d.puremagic.com/issues/show_bug.cgi?id=4895 //static assert(!isOutputRange!(IntervalRange!(Date, Direction.fwd), Date)); static assert(!isBidirectionalRange!(IntervalRange!(Date, Direction.fwd))); static assert(!isRandomAccessRange!(IntervalRange!(Date, Direction.fwd))); static assert(!hasSwappableElements!(IntervalRange!(Date, Direction.fwd))); static assert(!hasAssignableElements!(IntervalRange!(Date, Direction.fwd))); static assert(!hasLength!(IntervalRange!(Date, Direction.fwd))); static assert(!isInfinite!(IntervalRange!(Date, Direction.fwd))); static assert(!hasSlicing!(IntervalRange!(Date, Direction.fwd))); static assert(is(ElementType!(IntervalRange!(Date, Direction.fwd)) == Date)); static assert(is(ElementType!(IntervalRange!(TimeOfDay, Direction.fwd)) == TimeOfDay)); static assert(is(ElementType!(IntervalRange!(DateTime, Direction.fwd)) == DateTime)); static assert(is(ElementType!(IntervalRange!(SysTime, Direction.fwd)) == SysTime)); } } //Test construction of IntervalRange. unittest { version(testStdDateTime) { { Date dateFunc(in Date date) { return date; } auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto ir = IntervalRange!(Date, Direction.fwd)(interval, &dateFunc); } { TimeOfDay todFunc(in TimeOfDay tod) { return tod; } auto interval = Interval!TimeOfDay(TimeOfDay(12, 1, 7), TimeOfDay(14, 0, 0)); auto ir = IntervalRange!(TimeOfDay, Direction.fwd)(interval, &todFunc); } { DateTime dtFunc(in DateTime dt) { return dt; } auto interval = Interval!DateTime(DateTime(2010, 7, 4, 12, 1, 7), DateTime(2012, 1, 7, 14, 0, 0)); auto ir = IntervalRange!(DateTime, Direction.fwd)(interval, &dtFunc); } { SysTime stFunc(in SysTime st) { return cast(SysTime)st; } auto interval = Interval!SysTime(SysTime(DateTime(2010, 7, 4, 12, 1, 7)), SysTime(DateTime(2012, 1, 7, 14, 0, 0))); auto ir = IntervalRange!(SysTime, Direction.fwd)(interval, &stFunc); } } } //Test IntervalRange's empty(). unittest { version(testStdDateTime) { //fwd { auto range = Interval!Date(Date(2010, 9, 19), Date(2010, 9, 21)).fwdRange(everyDayOfWeek!Date(DayOfWeek.fri)); assert(!range.empty); range.popFront(); assert(range.empty); const cRange = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)).fwdRange(everyDayOfWeek!Date(DayOfWeek.fri)); static assert(__traits(compiles, cRange.empty)); //Apparently, creating an immutable IntervalRange!Date doesn't work, so we can't test if //empty works with it. However, since an immutable range is pretty useless, it's no great loss. } //bwd { auto range = Interval!Date(Date(2010, 9, 19), Date(2010, 9, 21)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri)); assert(!range.empty); range.popFront(); assert(range.empty); const cRange = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri)); static assert(__traits(compiles, cRange.empty)); //Apparently, creating an immutable IntervalRange!Date doesn't work, so we can't test if //empty works with it. However, since an immutable range is pretty useless, it's no great loss. } } } //Test IntervalRange's front. unittest { version(testStdDateTime) { //fwd { auto emptyRange = Interval!Date(Date(2010, 9, 19), Date(2010, 9, 20)).fwdRange(everyDayOfWeek!Date(DayOfWeek.wed), PopFirst.yes); assertThrown!DateTimeException((in IntervalRange!(Date, Direction.fwd) range){range.front;}(emptyRange)); auto range = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)).fwdRange(everyDayOfWeek!Date(DayOfWeek.wed)); _assertPred!"=="(range.front, Date(2010, 7, 4)); auto poppedRange = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)).fwdRange(everyDayOfWeek!Date(DayOfWeek.wed), PopFirst.yes); _assertPred!"=="(poppedRange.front, Date(2010, 7, 7)); const cRange = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)).fwdRange(everyDayOfWeek!Date(DayOfWeek.fri)); static assert(__traits(compiles, cRange.front)); } //bwd { auto emptyRange = Interval!Date(Date(2010, 9, 19), Date(2010, 9, 20)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.wed), PopFirst.yes); assertThrown!DateTimeException((in IntervalRange!(Date, Direction.bwd) range){range.front;}(emptyRange)); auto range = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.wed)); _assertPred!"=="(range.front, Date(2012, 1, 7)); auto poppedRange = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.wed), PopFirst.yes); _assertPred!"=="(poppedRange.front, Date(2012, 1, 4)); const cRange = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri)); static assert(__traits(compiles, cRange.front)); } } } //Test IntervalRange's popFront(). unittest { version(testStdDateTime) { //fwd { auto emptyRange = Interval!Date(Date(2010, 9, 19), Date(2010, 9, 20)).fwdRange(everyDayOfWeek!Date(DayOfWeek.wed), PopFirst.yes); assertThrown!DateTimeException((IntervalRange!(Date, Direction.fwd) range){range.popFront();}(emptyRange)); auto range = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)).fwdRange(everyDayOfWeek!Date(DayOfWeek.wed), PopFirst.yes); auto expected = range.front; foreach(date; range) { _assertPred!"=="(date, expected); expected += dur!"days"(7); } _assertPred!"=="(walkLength(range), 79); const cRange = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)).fwdRange(everyDayOfWeek!Date(DayOfWeek.fri)); static assert(__traits(compiles, cRange.front)); } //bwd { auto emptyRange = Interval!Date(Date(2010, 9, 19), Date(2010, 9, 20)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.wed), PopFirst.yes); assertThrown!DateTimeException((IntervalRange!(Date, Direction.bwd) range){range.popFront();}(emptyRange)); auto range = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.wed), PopFirst.yes); auto expected = range.front; foreach(date; range) { _assertPred!"=="(date, expected); expected += dur!"days"(-7); } _assertPred!"=="(walkLength(range), 79); const cRange = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri)); static assert(!__traits(compiles, cRange.popFront())); } } } //Test IntervalRange's save. unittest { version(testStdDateTime) { //fwd { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto func = everyDayOfWeek!Date(DayOfWeek.fri); auto range = interval.fwdRange(func); assert(range.save == range); } //bwd { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto func = everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri); auto range = interval.bwdRange(func); assert(range.save == range); } } } //Test IntervalRange's interval. unittest { version(testStdDateTime) { //fwd { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto func = everyDayOfWeek!Date(DayOfWeek.fri); auto range = interval.fwdRange(func); assert(range.interval == interval); const cRange = range; static assert(__traits(compiles, cRange.interval)); } //bwd { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto func = everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri); auto range = interval.bwdRange(func); assert(range.interval == interval); const cRange = range; static assert(__traits(compiles, cRange.interval)); } } } //Test IntervalRange's func. unittest { version(testStdDateTime) { //fwd { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto func = everyDayOfWeek!Date(DayOfWeek.fri); auto range = interval.fwdRange(func); assert(range.func == func); } //bwd { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto func = everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri); auto range = interval.bwdRange(func); assert(range.func == func); } } } //Test IntervalRange's direction. unittest { version(testStdDateTime) { //fwd { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto func = everyDayOfWeek!Date(DayOfWeek.fri); auto range = interval.fwdRange(func); assert(range.direction == Direction.fwd); const cRange = range; static assert(__traits(compiles, cRange.direction)); } //bwd { auto interval = Interval!Date(Date(2010, 7, 4), Date(2012, 1, 7)); auto func = everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri); auto range = interval.bwdRange(func); assert(range.direction == Direction.bwd); const cRange = range; static assert(__traits(compiles, cRange.direction)); } } } /++ A range over a $(D PosInfInterval). It is an infinite range. $(D PosInfIntervalRange) is only ever constructed by $(D PosInfInterval). However, when it is constructed, it is given a function, $(D func), which is used to generate the time points which are iterated over. $(D func) takes a time point and returns a time point of the same type. For instance, to iterate over all of the days in the interval $(D PosInfInterval!Date), pass a function to $(D PosInfInterval)'s $(D fwdRange) where that function took a $(D Date) and returned a $(D Date) which was one day later. That function would then be used by $(D PosInfIntervalRange)'s $(D popFront) to iterate over the $(D Date)s in the interval - though obviously, since the range is infinite, use a function such as $(D std.range.take) with it rather than iterating over $(I all) of the dates. As the interval goes to positive infinity, the range is always iterated over forwards, never backwards. $(D func) must generate a time point going in the proper direction of iteration, or a $(D DateTimeException) will be thrown. So, the time points that $(D func) generates must be later in time than the one passed to it. If it's either identical or earlier in time, then a $(D DateTimeException) will be thrown. +/ struct PosInfIntervalRange(TP) if(isTimePoint!TP) { public: /++ Params: rhs = The $(D PosInfIntervalRange) to assign to this one. +/ /+ref+/ PosInfIntervalRange opAssign(ref PosInfIntervalRange rhs) pure nothrow { _interval = rhs._interval; _func = rhs._func; return this; } /++ This is an infinite range, so it is never empty. +/ enum bool empty = false; /++ The first time point in the range. +/ @property TP front() const pure nothrow { return _interval.begin; } /++ Pops $(D front) from the range, using $(D func) to generate the next time point in the range. Throws: $(D DateTimeException) if the generated time point is less than $(D front). +/ void popFront() { auto begin = _func(_interval.begin); _enforceCorrectDirection(begin); _interval.begin = begin; } /++ Returns a copy of $(D this). +/ @property PosInfIntervalRange save() pure nothrow { return this; } /++ The interval that this range currently covers. +/ @property PosInfInterval!TP interval() const pure nothrow { return cast(PosInfInterval!TP)_interval; } /++ The function used to generate the next time point in the range. +/ TP delegate(in TP) func() pure nothrow @property { return _func; } private: /+ Params: interval = The interval that this range covers. func = The function used to generate the time points which are iterated over. +/ this(in PosInfInterval!TP interval, TP delegate(in TP) func) pure nothrow { _func = func; _interval = interval; } /+ Throws: $(D DateTimeException) if $(D_PARAME newTP) is in the wrong direction. +/ void _enforceCorrectDirection(in TP newTP, size_t line = __LINE__) const { enforce(newTP > _interval._begin, new DateTimeException(format("Generated time point is before previous begin: prev [%s] new [%s]", interval._begin, newTP), __FILE__, line)); } PosInfInterval!TP _interval; TP delegate(in TP) _func; } //Test that PosInfIntervalRange satisfies the range predicates that it's supposed to satisfy. unittest { version(testStdDateTime) { static assert(isInputRange!(PosInfIntervalRange!Date)); static assert(isForwardRange!(PosInfIntervalRange!Date)); static assert(isInfinite!(PosInfIntervalRange!Date)); //Commented out due to bug http://d.puremagic.com/issues/show_bug.cgi?id=4895 //static assert(!isOutputRange!(PosInfIntervalRange!Date, Date)); static assert(!isBidirectionalRange!(PosInfIntervalRange!Date)); static assert(!isRandomAccessRange!(PosInfIntervalRange!Date)); static assert(!hasSwappableElements!(PosInfIntervalRange!Date)); static assert(!hasAssignableElements!(PosInfIntervalRange!Date)); static assert(!hasLength!(PosInfIntervalRange!Date)); static assert(!hasSlicing!(PosInfIntervalRange!Date)); static assert(is(ElementType!(PosInfIntervalRange!Date) == Date)); static assert(is(ElementType!(PosInfIntervalRange!TimeOfDay) == TimeOfDay)); static assert(is(ElementType!(PosInfIntervalRange!DateTime) == DateTime)); static assert(is(ElementType!(PosInfIntervalRange!SysTime) == SysTime)); } } //Test construction of PosInfIntervalRange. unittest { version(testStdDateTime) { { Date dateFunc(in Date date) { return date; } auto posInfInterval = PosInfInterval!Date(Date(2010, 7, 4)); auto ir = PosInfIntervalRange!Date(posInfInterval, &dateFunc); } { TimeOfDay todFunc(in TimeOfDay tod) { return tod; } auto posInfInterval = PosInfInterval!TimeOfDay(TimeOfDay(12, 1, 7)); auto ir = PosInfIntervalRange!(TimeOfDay)(posInfInterval, &todFunc); } { DateTime dtFunc(in DateTime dt) { return dt; } auto posInfInterval = PosInfInterval!DateTime(DateTime(2010, 7, 4, 12, 1, 7)); auto ir = PosInfIntervalRange!(DateTime)(posInfInterval, &dtFunc); } { SysTime stFunc(in SysTime st) { return cast(SysTime)st; } auto posInfInterval = PosInfInterval!SysTime(SysTime(DateTime(2010, 7, 4, 12, 1, 7))); auto ir = PosInfIntervalRange!(SysTime)(posInfInterval, &stFunc); } } } //Test PosInfIntervalRange's front. unittest { version(testStdDateTime) { auto range = PosInfInterval!Date(Date(2010, 7, 4)).fwdRange(everyDayOfWeek!Date(DayOfWeek.wed)); _assertPred!"=="(range.front, Date(2010, 7, 4)); auto poppedRange = PosInfInterval!Date(Date(2010, 7, 4)).fwdRange(everyDayOfWeek!Date(DayOfWeek.wed), PopFirst.yes); _assertPred!"=="(poppedRange.front, Date(2010, 7, 7)); const cRange = PosInfInterval!Date(Date(2010, 7, 4)).fwdRange(everyDayOfWeek!Date(DayOfWeek.fri)); static assert(__traits(compiles, cRange.front)); } } //Test PosInfIntervalRange's popFront(). unittest { version(testStdDateTime) { auto range = PosInfInterval!Date(Date(2010, 7, 4)).fwdRange(everyDayOfWeek!Date(DayOfWeek.wed), PopFirst.yes); auto expected = range.front; foreach(date; take(range, 79)) { _assertPred!"=="(date, expected); expected += dur!"days"(7); } const cRange = PosInfInterval!Date(Date(2010, 7, 4)).fwdRange(everyDayOfWeek!Date(DayOfWeek.fri)); static assert(!__traits(compiles, cRange.popFront())); } } //Test PosInfIntervalRange's save. unittest { version(testStdDateTime) { auto interval = PosInfInterval!Date(Date(2010, 7, 4)); auto func = everyDayOfWeek!Date(DayOfWeek.fri); auto range = interval.fwdRange(func); assert(range.save == range); } } //Test PosInfIntervalRange's interval. unittest { version(testStdDateTime) { auto interval = PosInfInterval!Date(Date(2010, 7, 4)); auto func = everyDayOfWeek!Date(DayOfWeek.fri); auto range = interval.fwdRange(func); assert(range.interval == interval); const cRange = range; static assert(__traits(compiles, cRange.interval)); } } //Test PosInfIntervalRange's func. unittest { version(testStdDateTime) { auto interval = PosInfInterval!Date(Date(2010, 7, 4)); auto func = everyDayOfWeek!Date(DayOfWeek.fri); auto range = interval.fwdRange(func); assert(range.func == func); } } /++ A range over a $(D NegInfInterval). It is an infinite range. $(D NegInfIntervalRange) is only ever constructed by $(D NegInfInterval). However, when it is constructed, it is given a function, $(D func), which is used to generate the time points which are iterated over. $(D func) takes a time point and returns a time point of the same type. For instance, to iterate over all of the days in the interval $(D NegInfInterval!Date), pass a function to $(D NegInfInterval)'s $(D bwdRange) where that function took a $(D Date) and returned a $(D Date) which was one day earlier. That function would then be used by $(D NegInfIntervalRange)'s $(D popFront) to iterate over the $(D Date)s in the interval - though obviously, since the range is infinite, use a function such as $(D std.range.take) with it rather than iterating over $(I all) of the dates. As the interval goes to negative infinity, the range is always iterated over backwards, never forwards. $(D func) must generate a time point going in the proper direction of iteration, or a $(D DateTimeException) will be thrown. So, the time points that $(D func) generates must be earlier in time than the one passed to it. If it's either identical or later in time, then a $(D DateTimeException) will be thrown. Also note that while normally the $(D end) of an interval is excluded from it, $(D NegInfIntervalRange) treats it as if it were included. This allows for the same behavior as with $(D PosInfIntervalRange). This works because none of $(D NegInfInterval)'s functions which care about whether $(D end) is included or excluded are ever called by $(D NegInfIntervalRange). $(D interval) returns a normal interval, so any $(D NegInfInterval) functions which are called on it which care about whether $(D end) is included or excluded will treat $(D end) as excluded. +/ struct NegInfIntervalRange(TP) if(isTimePoint!TP) { public: /++ Params: rhs = The $(D NegInfIntervalRange) to assign to this one. +/ /+ref+/ NegInfIntervalRange opAssign(ref NegInfIntervalRange rhs) pure nothrow { _interval = rhs._interval; _func = rhs._func; return this; } /++ This is an infinite range, so it is never empty. +/ enum bool empty = false; /++ The first time point in the range. +/ @property TP front() const pure nothrow { return _interval.end; } /++ Pops $(D front) from the range, using $(D func) to generate the next time point in the range. Throws: $(D DateTimeException) if the generated time point is greater than $(D front). +/ void popFront() { auto end = _func(_interval.end); _enforceCorrectDirection(end); _interval.end = end; } /++ Returns a copy of $(D this). +/ @property NegInfIntervalRange save() pure nothrow { return this; } /++ The interval that this range currently covers. +/ @property NegInfInterval!TP interval() const pure nothrow { return cast(NegInfInterval!TP)_interval; } /++ The function used to generate the next time point in the range. +/ TP delegate(in TP) func() pure nothrow @property { return _func; } private: /+ Params: interval = The interval that this range covers. func = The function used to generate the time points which are iterated over. +/ this(in NegInfInterval!TP interval, TP delegate(in TP) func) pure nothrow { _func = func; _interval = interval; } /+ Throws: $(D DateTimeException) if $(D_PARAM newTP) is in the wrong direction. +/ void _enforceCorrectDirection(in TP newTP, size_t line = __LINE__) const { enforce(newTP < _interval._end, new DateTimeException(format("Generated time point is before previous end: prev [%s] new [%s]", interval._end, newTP), __FILE__, line)); } NegInfInterval!TP _interval; TP delegate(in TP) _func; } //Test that NegInfIntervalRange satisfies the range predicates that it's supposed to satisfy. unittest { version(testStdDateTime) { static assert(isInputRange!(NegInfIntervalRange!Date)); static assert(isForwardRange!(NegInfIntervalRange!Date)); static assert(isInfinite!(NegInfIntervalRange!Date)); //Commented out due to bug http://d.puremagic.com/issues/show_bug.cgi?id=4895 //static assert(!isOutputRange!(NegInfIntervalRange!Date, Date)); static assert(!isBidirectionalRange!(NegInfIntervalRange!Date)); static assert(!isRandomAccessRange!(NegInfIntervalRange!Date)); static assert(!hasSwappableElements!(NegInfIntervalRange!Date)); static assert(!hasAssignableElements!(NegInfIntervalRange!Date)); static assert(!hasLength!(NegInfIntervalRange!Date)); static assert(!hasSlicing!(NegInfIntervalRange!Date)); static assert(is(ElementType!(NegInfIntervalRange!Date) == Date)); static assert(is(ElementType!(NegInfIntervalRange!TimeOfDay) == TimeOfDay)); static assert(is(ElementType!(NegInfIntervalRange!DateTime) == DateTime)); } } //Test construction of NegInfIntervalRange. unittest { version(testStdDateTime) { { Date dateFunc(in Date date) { return date; } auto negInfInterval = NegInfInterval!Date(Date(2012, 1, 7)); auto ir = NegInfIntervalRange!Date(negInfInterval, &dateFunc); } { TimeOfDay todFunc(in TimeOfDay tod) { return tod; } auto negInfInterval = NegInfInterval!TimeOfDay(TimeOfDay(14, 0, 0)); auto ir = NegInfIntervalRange!(TimeOfDay)(negInfInterval, &todFunc); } { DateTime dtFunc(in DateTime dt) { return dt; } auto negInfInterval = NegInfInterval!DateTime(DateTime(2012, 1, 7, 14, 0, 0)); auto ir = NegInfIntervalRange!(DateTime)(negInfInterval, &dtFunc); } { SysTime stFunc(in SysTime st) { return cast(SysTime)(st); } auto negInfInterval = NegInfInterval!SysTime(SysTime(DateTime(2012, 1, 7, 14, 0, 0))); auto ir = NegInfIntervalRange!(SysTime)(negInfInterval, &stFunc); } } } //Test NegInfIntervalRange's front. unittest { version(testStdDateTime) { auto range = NegInfInterval!Date(Date(2012, 1, 7)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.wed)); _assertPred!"=="(range.front, Date(2012, 1, 7)); auto poppedRange = NegInfInterval!Date(Date(2012, 1, 7)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.wed), PopFirst.yes); _assertPred!"=="(poppedRange.front, Date(2012, 1, 4)); const cRange = NegInfInterval!Date(Date(2012, 1, 7)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri)); static assert(__traits(compiles, cRange.front)); } } //Test NegInfIntervalRange's popFront(). unittest { version(testStdDateTime) { auto range = NegInfInterval!Date(Date(2012, 1, 7)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.wed), PopFirst.yes); auto expected = range.front; foreach(date; take(range, 79)) { _assertPred!"=="(date, expected); expected += dur!"days"(-7); } const cRange = NegInfInterval!Date(Date(2012, 1, 7)).bwdRange(everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri)); static assert(!__traits(compiles, cRange.popFront())); } } //Test NegInfIntervalRange's save. unittest { version(testStdDateTime) { auto interval = NegInfInterval!Date(Date(2012, 1, 7)); auto func = everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri); auto range = interval.bwdRange(func); assert(range.save == range); } } //Test NegInfIntervalRange's interval. unittest { version(testStdDateTime) { auto interval = NegInfInterval!Date(Date(2012, 1, 7)); auto func = everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri); auto range = interval.bwdRange(func); assert(range.interval == interval); const cRange = range; static assert(__traits(compiles, cRange.interval)); } } //Test NegInfIntervalRange's func. unittest { version(testStdDateTime) { auto interval = NegInfInterval!Date(Date(2012, 1, 7)); auto func = everyDayOfWeek!(Date, Direction.bwd)(DayOfWeek.fri); auto range = interval.bwdRange(func); assert(range.func == func); } } //============================================================================== // Section with time zones. //============================================================================== /++ Represents a time zone. It is used with $(D SysTime) to indicate the time zone of a $(D SysTime). +/ abstract class TimeZone { public: /++ The name of the time zone per the TZ Database. This is the name used to get a $(D TimeZone) by name with $(D TimeZone.getTimeZone). See_Also: $(WEB en.wikipedia.org/wiki/Tz_database, Wikipedia entry on TZ Database)<br> $(WEB en.wikipedia.org/wiki/List_of_tz_database_time_zones, List of Time Zones) +/ @property string name() const nothrow { return _name; } /++ Typically, the abbreviation (generally 3 or 4 letters) for the time zone when DST is $(I not) in effect (e.g. PST). It is not necessarily unique. However, on Windows, it may be the unabbreviated name (e.g. Pacific Standard Time). Regardless, it is not the same as name. +/ @property string stdName() const nothrow { return _stdName; } /++ Typically, the abbreviation (generally 3 or 4 letters) for the time zone when DST $(I is) in effect (e.g. PDT). It is not necessarily unique. However, on Windows, it may be the unabbreviated name (e.g. Pacific Daylight Time). Regardless, it is not the same as name. +/ @property string dstName() const nothrow { return _dstName; } /++ Whether this time zone has Daylight Savings Time at any point in time. Note that for some time zone types it may not have DST for current dates but will still return true for $(D hasDST) because the time zone did at some point have DST. +/ @property abstract bool hasDST() const nothrow; /++ Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in UTC time (i.e. std time) and returns whether DST is effect in this time zone at the given point in time. Params: stdTime = The UTC time that needs to be checked for DST in this time zone. +/ abstract bool dstInEffect(long stdTime) const nothrow; /++ Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in UTC time (i.e. std time) and converts it to this time zone's time. Params: stdTime = The UTC time that needs to be adjusted to this time zone's time. +/ abstract long utcToTZ(long stdTime) const nothrow; /++ Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in this time zone's time and converts it to UTC (i.e. std time). Params: adjTime = The time in this time zone that needs to be adjusted to UTC time. +/ abstract long tzToUTC(long adjTime) const nothrow; /++ Returns what the offset from UTC is at the given std time. It includes the DST offset in effect at that time (if any). Params: stdTime = The UTC time for which to get the offset from UTC for this time zone. +/ Duration utcOffsetAt(long stdTime) const nothrow { return dur!"hnsecs"(utcToTZ(stdTime) - stdTime); } /++ Returns a $(D TimeZone) with the give name per the TZ Database. This returns a $(D PosixTimeZone) on Posix systems and a $(D WindowsTimeZone) on Windows systems. For $(D PosixTimeZone) on Windows, call $(D PosixTimeZone.getTimeZone) directly and give it the location of the TZ Database time zone files on disk. On Windows, the given TZ Database name is converted to the corresponding time zone name on Windows prior to calling $(D WindowsTimeZone.getTimeZone). This function allows for the same time zone names on both Windows and Posix systems. See_Also: $(WEB en.wikipedia.org/wiki/Tz_database, Wikipedia entry on TZ Database)<br> $(WEB en.wikipedia.org/wiki/List_of_tz_database_time_zones, List of Time Zones)<br> $(WEB unicode.org/repos/cldr-tmp/trunk/diff/supplemental/zone_tzid.html, Windows <-> TZ Database Name Conversion Table) Params: name = The TZ Database name of the desired time zone Throws: $(D DateTimeException) if the given time zone could not be found. Examples: -------------------- auto tz = TimeZone.getTimeZone("America/Los_Angeles"); -------------------- +/ static immutable(TimeZone) getTimeZone(string name) { version(Posix) return PosixTimeZone.getTimeZone(name); else version(Windows) return WindowsTimeZone.getTimeZone(tzDatabaseNameToWindowsTZName(name)); } //Since reading in the time zone files could be expensive, most unit tests //are consolidated into this one unittest block which minimizes how often it //reads a time zone file. version(testStdDateTime) unittest { version(Posix) scope(exit) clearTZEnvVar(); static immutable(TimeZone) testTZ(string tzName, string stdName, string dstName, Duration utcOffset, Duration dstOffset, bool north = true) { scope(failure) writefln("Failed time zone: %s", tzName); immutable tz = TimeZone.getTimeZone(tzName); immutable hasDST = dstOffset != dur!"hnsecs"(0); version(Posix) _assertPred!"=="(tz.name, tzName); else version(Windows) _assertPred!"=="(tz.name, stdName); //_assertPred!"=="(tz.stdName, stdName); //Locale-dependent //_assertPred!"=="(tz.dstName, dstName); //Locale-dependent _assertPred!"=="(tz.hasDST, hasDST); immutable stdDate = DateTime(2010, north ? 1 : 7, 1, 6, 0, 0); immutable dstDate = DateTime(2010, north ? 7 : 1, 1, 6, 0, 0); auto std = SysTime(stdDate, tz); auto dst = SysTime(dstDate, tz); auto stdUTC = SysTime(stdDate - utcOffset, UTC()); auto dstUTC = SysTime(stdDate - utcOffset + dstOffset, UTC()); assert(!std.dstInEffect); _assertPred!"=="(dst.dstInEffect, hasDST); _assertPred!"=="(tz.utcOffsetAt(std.stdTime), utcOffset); _assertPred!"=="(tz.utcOffsetAt(dst.stdTime), utcOffset + dstOffset); _assertPred!"=="(cast(DateTime)std, stdDate); _assertPred!"=="(cast(DateTime)dst, dstDate); _assertPred!"=="(std, stdUTC); version(Posix) { setTZEnvVar(tzName); static void testTM(in SysTime st) { time_t unixTime = st.toUnixTime(); tm* osTimeInfo = localtime(&unixTime); tm ourTimeInfo = st.toTM(); _assertPred!"=="(ourTimeInfo.tm_sec, osTimeInfo.tm_sec); _assertPred!"=="(ourTimeInfo.tm_min, osTimeInfo.tm_min); _assertPred!"=="(ourTimeInfo.tm_hour, osTimeInfo.tm_hour); _assertPred!"=="(ourTimeInfo.tm_mday, osTimeInfo.tm_mday); _assertPred!"=="(ourTimeInfo.tm_mon, osTimeInfo.tm_mon); _assertPred!"=="(ourTimeInfo.tm_year, osTimeInfo.tm_year); _assertPred!"=="(ourTimeInfo.tm_wday, osTimeInfo.tm_wday); _assertPred!"=="(ourTimeInfo.tm_yday, osTimeInfo.tm_yday); _assertPred!"=="(ourTimeInfo.tm_isdst, osTimeInfo.tm_isdst); _assertPred!"=="(ourTimeInfo.tm_gmtoff, osTimeInfo.tm_gmtoff); _assertPred!"=="(to!string(ourTimeInfo.tm_zone), to!string(osTimeInfo.tm_zone)); } testTM(std); testTM(dst); //Apparently, right/ does not exist on Mac OS X. I don't know //whether or not it exists on FreeBSD. It's rather pointless //normally, since the Posix standard requires that leap seconds //be ignored, so it does make some sense that right/ wouldn't //be there, but since PosixTimeZone _does_ use leap seconds if //the time zone file does, we'll test that functionality if the //appropriate files exist. if((PosixTimeZone.defaultTZDatabaseDir ~ "right/" ~ tzName).exists()) { auto leapTZ = PosixTimeZone.getTimeZone("right/" ~ tzName); assert(leapTZ.name == "right/" ~ tzName); //assert(leapTZ.stdName == stdName); //Locale-dependent //assert(leapTZ.dstName == dstName); //Locale-dependent assert(leapTZ.hasDST == hasDST); auto leapSTD = SysTime(std.stdTime, leapTZ); auto leapDST = SysTime(dst.stdTime, leapTZ); assert(!leapSTD.dstInEffect); assert(leapDST.dstInEffect == hasDST); _assertPred!"=="(leapSTD.stdTime, std.stdTime); _assertPred!"=="(leapDST.stdTime, dst.stdTime); //Whenever a leap second is added/removed, //this will have to be adjusted. //enum leapDiff = convert!("seconds", "hnsecs")(25); //_assertPred!"=="(leapSTD.adjTime - leapDiff, std.adjTime); //_assertPred!"=="(leapDST.adjTime - leapDiff, dst.adjTime); } } return tz; } auto dstSwitches = [/+America/Los_Angeles+/ tuple(DateTime(2012, 3, 11), DateTime(2012, 11, 4), 2, 2), /+America/New_York+/ tuple(DateTime(2012, 3, 11), DateTime(2012, 11, 4), 2, 2), ///+America/Santiago+/ tuple(DateTime(2011, 8, 21), DateTime(2011, 5, 8), 0, 0), /+Europe/London+/ tuple(DateTime(2012, 3, 25), DateTime(2012, 10, 28), 1, 2), /+Europe/Paris+/ tuple(DateTime(2012, 3, 25), DateTime(2012, 10, 28), 2, 3), /+Australia/Adelaide+/ tuple(DateTime(2012, 10, 7), DateTime(2012, 4, 1), 2, 3)]; version(Posix) { version(FreeBSD) enum utcZone = "Etc/UTC"; version(linux) enum utcZone = "UTC"; version(OSX) enum utcZone = "UTC"; auto tzs = [testTZ("America/Los_Angeles", "PST", "PDT", dur!"hours"(-8), dur!"hours"(1)), testTZ("America/New_York", "EST", "EDT", dur!"hours"(-5), dur!"hours"(1)), //testTZ("America/Santiago", "CLT", "CLST", dur!"hours"(-4), dur!"hours"(1), false), testTZ("Europe/London", "GMT", "BST", dur!"hours"(0), dur!"hours"(1)), testTZ("Europe/Paris", "CET", "CEST", dur!"hours"(1), dur!"hours"(1)), //Per www.timeanddate.com, it should be "CST" and "CDT", //but the OS insists that it's "CST" for both. We should //probably figure out how to report an error in the TZ //database and report it. testTZ("Australia/Adelaide", "CST", "CST", dur!"hours"(9) + dur!"minutes"(30), dur!"hours"(1), false)]; testTZ(utcZone, "UTC", "UTC", dur!"hours"(0), dur!"hours"(0)); assertThrown!DateTimeException(PosixTimeZone.getTimeZone("hello_world")); } else version(Windows) { auto tzs = [testTZ("America/Los_Angeles", "Pacific Standard Time", "Pacific Daylight Time", dur!"hours"(-8), dur!"hours"(1)), testTZ("America/New_York", "Eastern Standard Time", "Eastern Daylight Time", dur!"hours"(-5), dur!"hours"(1)), //testTZ("America/Santiago", "Pacific SA Standard Time", //"Pacific SA Daylight Time", dur!"hours"(-4), dur!"hours"(1), false), testTZ("Europe/London", "GMT Standard Time", "GMT Daylight Time", dur!"hours"(0), dur!"hours"(1)), testTZ("Europe/Paris", "Romance Standard Time", "Romance Daylight Time", dur!"hours"(1), dur!"hours"(1)), testTZ("Australia/Adelaide", "Cen. Australia Standard Time", "Cen. Australia Daylight Time", dur!"hours"(9) + dur!"minutes"(30), dur!"hours"(1), false)]; testTZ("Atlantic/Reykjavik", "Greenwich Standard Time", "Greenwich Daylight Time", dur!"hours"(0), dur!"hours"(0)); assertThrown!DateTimeException(WindowsTimeZone.getTimeZone("hello_world")); } else assert(0, "OS not supported."); foreach(i; 0 .. tzs.length) { auto tz = tzs[i]; immutable spring = dstSwitches[i][2]; immutable fall = dstSwitches[i][3]; auto stdOffset = SysTime(dstSwitches[i][0] + dur!"days"(-1), tz).utcOffset; auto dstOffset = stdOffset + dur!"hours"(1); //Verify that creating a SysTime in the given time zone results //in a SysTime with the correct std time during and surrounding //a DST switch. foreach(hour; -12 .. 13) { auto st = SysTime(dstSwitches[i][0] + dur!"hours"(hour), tz); immutable targetHour = hour < 0 ? hour + 24 : hour; static void testHour(SysTime st, int hour, string tzName, size_t line = __LINE__) { enforce(st.hour == hour, new AssertError(format("[%s] [%s]: [%s] [%s]", st, tzName, st.hour, hour), __FILE__, line)); } void testOffset1(Duration offset, bool dstInEffect, size_t line = __LINE__) { AssertError msg(string tag) { return new AssertError(format("%s [%s] [%s]: [%s] [%s] [%s]", tag, st, tz.name, st.utcOffset, stdOffset, dstOffset), __FILE__, line); } enforce(st.dstInEffect == dstInEffect, msg("1")); enforce(st.utcOffset == offset, msg("2")); enforce((st + dur!"minutes"(1)).utcOffset == offset, msg("3")); } if(hour == spring) { testHour(st, spring + 1, tz.name); testHour(st + dur!"minutes"(1), spring + 1, tz.name); } else { testHour(st, targetHour, tz.name); testHour(st + dur!"minutes"(1), targetHour, tz.name); } if(hour < spring) testOffset1(stdOffset, false); else testOffset1(dstOffset, true); st = SysTime(dstSwitches[i][1] + dur!"hours"(hour), tz); testHour(st, targetHour, tz.name); //Verify that 01:00 is the first 01:00 (or whatever hour before the switch is). if(hour == fall - 1) testHour(st + dur!"hours"(1), targetHour, tz.name); if(hour < fall) testOffset1(dstOffset, true); else testOffset1(stdOffset, false); } //Verify that converting a time in UTC to a time in another //time zone results in the correct time during and surrounding //a DST switch. bool first = true; auto springSwitch = SysTime(dstSwitches[i][0] + dur!"hours"(spring), UTC()) - stdOffset; auto fallSwitch = SysTime(dstSwitches[i][1] + dur!"hours"(fall), UTC()) - dstOffset; //@@@BUG@@@ 3659 makes this necessary. auto fallSwitchMinus1 = fallSwitch - dur!"hours"(1); foreach(hour; -24 .. 25) { auto utc = SysTime(dstSwitches[i][0] + dur!"hours"(hour), UTC()); auto local = utc.toOtherTZ(tz); void testOffset2(Duration offset, size_t line = __LINE__) { AssertError msg(string tag) { return new AssertError(format("%s [%s] [%s]: [%s] [%s]", tag, hour, tz.name, utc, local), __FILE__, line); } enforce((utc + offset).hour == local.hour, msg("1")); enforce((utc + offset + dur!"minutes"(1)).hour == local.hour, msg("2")); } if(utc < springSwitch) testOffset2(stdOffset); else testOffset2(dstOffset); utc = SysTime(dstSwitches[i][1] + dur!"hours"(hour), UTC()); local = utc.toOtherTZ(tz); if(utc == fallSwitch || utc == fallSwitchMinus1) { if(first) { testOffset2(dstOffset); first = false; } else testOffset2(stdOffset); } else if(utc > fallSwitch) testOffset2(stdOffset); else testOffset2(dstOffset); } } } /++ Returns a list of the names of the time zones installed on the system. Providing a sub-name narrows down the list of time zones (which can number in the thousands). For example, passing in "America" as the sub-name returns only the time zones which begin with "America". On Windows, this function will convert the Windows time zone names to the corresponding TZ Database names with $(D windowsTZNameToTZDatabaseName). To get the actual Windows time zone names, use $(D WindowsTimeZone.getInstalledTZNames) directly. Params: subName = The first part of the time zones desired. Throws: $(D FileException) on Posix systems if it fails to read from disk. $(D DateTimeException) on Windows systems if it fails to read the registry. +/ static string[] getInstalledTZNames(string subName = "") { version(Posix) return PosixTimeZone.getInstalledTZNames(subName); else version(Windows) { auto windowsNames = WindowsTimeZone.getInstalledTZNames(); auto retval = appender!(string[])(); foreach(winName; windowsNames) { auto tzName = windowsTZNameToTZDatabaseName(winName); if(tzName.startsWith(subName)) retval.put(tzName); } sort(retval.data); return retval.data; } } unittest { version(testStdDateTime) { static void testPZSuccess(string tzName) { scope(failure) writefln("TZName which threw: %s", tzName); TimeZone.getTimeZone(tzName); } auto tzNames = getInstalledTZNames(); foreach(tzName; tzNames) assertNotThrown!DateTimeException(testPZSuccess(tzName)); } } private: /+ Params: name = The TZ Database name for the time zone. stdName = The abbreviation for the time zone during std time. dstName = The abbreviation for the time zone during DST. +/ this(string name, string stdName, string dstName) immutable pure { _name = name; _stdName = stdName; _dstName = dstName; } immutable string _name; immutable string _stdName; immutable string _dstName; } /++ A TimeZone which represents the current local time zone on the system running your program. This uses the underlying C calls to adjust the time rather than using specific D code based off of system settings to calculate the time such as $(D PosixTimeZone) and $(D WindowsTimeZone) do. That also means that it will use whatever the current time zone is on the system, even if the system's time zone changes while the program is running. +/ final class LocalTime : TimeZone { public: /++ $(D LocalTime) is a singleton class. $(D LocalTime) returns its only instance. +/ static immutable(LocalTime) opCall() pure nothrow { alias pure nothrow immutable(LocalTime) function() FuncType; return (cast(FuncType)&singleton)(); } version(StdDdoc) { /++ The name of the time zone per the TZ Database. This is the name used to get a $(D TimeZone) by name with $(D TimeZone.getTimeZone). Note that this always returns the empty string. This is because time zones cannot be uniquely identified by the attributes given by the OS (such as the $(D stdName) and $(D dstName)), and neither Posix systems nor Windows systems provide an easy way to get the TZ Database name of the local time zone. See_Also: $(WEB en.wikipedia.org/wiki/Tz_database, Wikipedia entry on TZ Database)<br> $(WEB en.wikipedia.org/wiki/List_of_tz_database_time_zones, List of Time Zones) +/ @property override string name() const nothrow; } /++ Typically, the abbreviation (generally 3 or 4 letters) for the time zone when DST is $(I not) in effect (e.g. PST). It is not necessarily unique. However, on Windows, it may be the unabbreviated name (e.g. Pacific Standard Time). Regardless, it is not the same as name. This property is overridden because the local time of the system could change while the program is running and we need to determine it dynamically rather than it being fixed like it would be with most time zones. +/ @property override string stdName() const nothrow { version(Posix) { try return to!string(tzname[0]); catch(Exception e) assert(0, "to!string(tzname[0]) failed."); } else version(Windows) { try { TIME_ZONE_INFORMATION tzInfo; GetTimeZoneInformation(&tzInfo); //Cannot use to!string() like this should, probably due to bug http://d.puremagic.com/issues/show_bug.cgi?id=5016 //return to!string(tzInfo.StandardName); wchar[32] str; foreach(i, ref wchar c; str) c = tzInfo.StandardName[i]; string retval; foreach(dchar c; str) { if(c == '\0') break; retval ~= c; } return retval; } catch(Exception e) assert(0, "GetTimeZoneInformation() threw."); } } unittest { version(testStdDateTime) { assert(LocalTime().stdName !is null); version(Posix) { scope(exit) clearTZEnvVar(); setTZEnvVar("America/Los_Angeles"); _assertPred!"=="(LocalTime().stdName, "PST"); setTZEnvVar("America/New_York"); _assertPred!"=="(LocalTime().stdName, "EST"); } } } /++ Typically, the abbreviation (generally 3 or 4 letters) for the time zone when DST $(I is) in effect (e.g. PDT). It is not necessarily unique. However, on Windows, it may be the unabbreviated name (e.g. Pacific Daylight Time). Regardless, it is not the same as name. This property is overridden because the local time of the system could change while the program is running and we need to determine it dynamically rather than it being fixed like it would be with most time zones. +/ @property override string dstName() const nothrow { version(Posix) { try return to!string(tzname[1]); catch(Exception e) assert(0, "to!string(tzname[1]) failed."); } else version(Windows) { try { TIME_ZONE_INFORMATION tzInfo; GetTimeZoneInformation(&tzInfo); //Cannot use to!string() like this should, probably due to bug http://d.puremagic.com/issues/show_bug.cgi?id=5016 //return to!string(tzInfo.DaylightName); wchar[32] str; foreach(i, ref wchar c; str) c = tzInfo.DaylightName[i]; string retval; foreach(dchar c; str) { if(c == '\0') break; retval ~= c; } return retval; } catch(Exception e) assert(0, "GetTimeZoneInformation() threw."); } } unittest { version(testStdDateTime) { assert(LocalTime().dstName !is null); version(Posix) { scope(exit) clearTZEnvVar(); setTZEnvVar("America/Los_Angeles"); _assertPred!"=="(LocalTime().dstName, "PDT"); setTZEnvVar("America/New_York"); _assertPred!"=="(LocalTime().dstName, "EDT"); } } } /++ Whether this time zone has Daylight Savings Time at any point in time. Note that for some time zone types it may not have DST for current dates but will still return true for $(D hasDST) because the time zone did at some point have DST. +/ @property override bool hasDST() const nothrow { version(Posix) { static if(is(typeof(daylight))) return cast(bool)(daylight); else { try { auto currYear = (cast(Date)Clock.currTime()).year; auto janOffset = SysTime(Date(currYear, 1, 4), this).stdTime - SysTime(Date(currYear, 1, 4), UTC()).stdTime; auto julyOffset = SysTime(Date(currYear, 7, 4), this).stdTime - SysTime(Date(currYear, 7, 4), UTC()).stdTime; return janOffset != julyOffset; } catch(Exception e) assert(0, "Clock.currTime() threw."); } } else version(Windows) { try { TIME_ZONE_INFORMATION tzInfo; GetTimeZoneInformation(&tzInfo); return tzInfo.DaylightDate.wMonth != 0; } catch(Exception e) assert(0, "GetTimeZoneInformation() threw."); } } unittest { version(testStdDateTime) { LocalTime().hasDST; version(Posix) { scope(exit) clearTZEnvVar(); setTZEnvVar("America/Los_Angeles"); assert(LocalTime().hasDST); setTZEnvVar("America/New_York"); assert(LocalTime().hasDST); setTZEnvVar("UTC"); assert(!LocalTime().hasDST); } } } /++ Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in UTC time (i.e. std time) and returns whether DST is in effect in this time zone at the given point in time. Params: stdTime = The UTC time that needs to be checked for DST in this time zone. +/ override bool dstInEffect(long stdTime) const nothrow { time_t unixTime = stdTimeToUnixTime(stdTime); version(Posix) { tm* timeInfo = localtime(&unixTime); return cast(bool)(timeInfo.tm_isdst); } else version(Windows) { //Apparently Windows isn't smart enough to deal with negative time_t. if(unixTime >= 0) { tm* timeInfo = localtime(&unixTime); if(timeInfo) return cast(bool)(timeInfo.tm_isdst); } TIME_ZONE_INFORMATION tzInfo; try GetTimeZoneInformation(&tzInfo); catch(Exception e) assert(0, "The impossible happened. GetTimeZoneInformation() threw."); return WindowsTimeZone._dstInEffect(&tzInfo, stdTime); } } unittest { version(testStdDateTime) { auto currTime = Clock.currStdTime; LocalTime().dstInEffect(currTime); } } /++ Returns hnsecs in the local time zone using the standard C function calls on Posix systems and the standard Windows system calls on Windows systems to adjust the time to the appropriate time zone from std time. Params: stdTime = The UTC time that needs to be adjusted to this time zone's time. See_Also: $(D TimeZone.utcToTZ) +/ override long utcToTZ(long stdTime) const nothrow { version(Posix) { time_t unixTime = stdTimeToUnixTime(stdTime); tm* timeInfo = localtime(&unixTime); return stdTime + convert!("seconds", "hnsecs")(timeInfo.tm_gmtoff); } else version(Windows) { TIME_ZONE_INFORMATION tzInfo; try GetTimeZoneInformation(&tzInfo); catch(Exception e) assert(0, "GetTimeZoneInformation() threw."); return WindowsTimeZone._utcToTZ(&tzInfo, stdTime, hasDST); } } unittest { version(testStdDateTime) { LocalTime().utcToTZ(0); } } /++ Returns std time using the standard C function calls on Posix systems and the standard Windows system calls on Windows systems to adjust the time to UTC from the appropriate time zone. See_Also: $(D TimeZone.tzToUTC) Params: adjTime = The time in this time zone that needs to be adjusted to UTC time. +/ override long tzToUTC(long adjTime) const nothrow { version(Posix) { time_t unixTime = stdTimeToUnixTime(adjTime); immutable past = unixTime - cast(time_t)convert!("days", "seconds")(1); tm* timeInfo = localtime(past < unixTime ? &past : &unixTime); immutable pastOffset = timeInfo.tm_gmtoff; immutable future = unixTime + cast(time_t)convert!("days", "seconds")(1); timeInfo = localtime(future > unixTime ? &future : &unixTime); immutable futureOffset = timeInfo.tm_gmtoff; if(pastOffset == futureOffset) return adjTime - convert!("seconds", "hnsecs")(pastOffset); if(pastOffset < futureOffset) unixTime -= cast(time_t)convert!("hours", "seconds")(1); unixTime -= pastOffset; timeInfo = localtime(&unixTime); return adjTime - convert!("seconds", "hnsecs")(timeInfo.tm_gmtoff); } else version(Windows) { TIME_ZONE_INFORMATION tzInfo; try GetTimeZoneInformation(&tzInfo); catch(Exception e) assert(0, "GetTimeZoneInformation() threw."); return WindowsTimeZone._tzToUTC(&tzInfo, adjTime, hasDST); } } unittest { version(testStdDateTime) { assert(LocalTime().tzToUTC(LocalTime().utcToTZ(0)) == 0); assert(LocalTime().utcToTZ(LocalTime().tzToUTC(0)) == 0); _assertPred!"=="(LocalTime().tzToUTC(LocalTime().utcToTZ(0)), 0); _assertPred!"=="(LocalTime().utcToTZ(LocalTime().tzToUTC(0)), 0); version(Posix) { scope(exit) clearTZEnvVar(); auto tzInfos = [tuple("America/Los_Angeles", DateTime(2012, 3, 11), DateTime(2012, 11, 4), 2, 2), tuple("America/New_York", DateTime(2012, 3, 11), DateTime(2012, 11, 4), 2, 2), //tuple("America/Santiago", DateTime(2011, 8, 21), DateTime(2011, 5, 8), 0, 0), tuple("Atlantic/Azores", DateTime(2011, 3, 27), DateTime(2011, 10, 30), 0, 1), tuple("Europe/London", DateTime(2012, 3, 25), DateTime(2012, 10, 28), 1, 2), tuple("Europe/Paris", DateTime(2012, 3, 25), DateTime(2012, 10, 28), 2, 3), tuple("Australia/Adelaide", DateTime(2012, 10, 7), DateTime(2012, 4, 1), 2, 3)]; foreach(i; 0 .. tzInfos.length) { auto tzName = tzInfos[i][0]; setTZEnvVar(tzName); immutable spring = tzInfos[i][3]; immutable fall = tzInfos[i][4]; auto stdOffset = SysTime(tzInfos[i][1] + dur!"hours"(-12)).utcOffset; auto dstOffset = stdOffset + dur!"hours"(1); //Verify that creating a SysTime in the given time zone results //in a SysTime with the correct std time during and surrounding //a DST switch. foreach(hour; -12 .. 13) { auto st = SysTime(tzInfos[i][1] + dur!"hours"(hour)); immutable targetHour = hour < 0 ? hour + 24 : hour; static void testHour(SysTime st, int hour, string tzName, size_t line = __LINE__) { enforce(st.hour == hour, new AssertError(format("[%s] [%s]: [%s] [%s]", st, tzName, st.hour, hour), __FILE__, line)); } void testOffset1(Duration offset, bool dstInEffect, size_t line = __LINE__) { AssertError msg(string tag) { return new AssertError(format("%s [%s] [%s]: [%s] [%s] [%s]", tag, st, tzName, st.utcOffset, stdOffset, dstOffset), __FILE__, line); } enforce(st.dstInEffect == dstInEffect, msg("1")); enforce(st.utcOffset == offset, msg("2")); enforce((st + dur!"minutes"(1)).utcOffset == offset, msg("3")); } if(hour == spring) { testHour(st, spring + 1, tzName); testHour(st + dur!"minutes"(1), spring + 1, tzName); } else { testHour(st, targetHour, tzName); testHour(st + dur!"minutes"(1), targetHour, tzName); } if(hour < spring) testOffset1(stdOffset, false); else testOffset1(dstOffset, true); st = SysTime(tzInfos[i][2] + dur!"hours"(hour)); testHour(st, targetHour, tzName); //Verify that 01:00 is the first 01:00 (or whatever hour before the switch is). if(hour == fall - 1) testHour(st + dur!"hours"(1), targetHour, tzName); if(hour < fall) testOffset1(dstOffset, true); else testOffset1(stdOffset, false); } //Verify that converting a time in UTC to a time in another //time zone results in the correct time during and surrounding //a DST switch. bool first = true; auto springSwitch = SysTime(tzInfos[i][1] + dur!"hours"(spring), UTC()) - stdOffset; auto fallSwitch = SysTime(tzInfos[i][2] + dur!"hours"(fall), UTC()) - dstOffset; //@@@BUG@@@ 3659 makes this necessary. auto fallSwitchMinus1 = fallSwitch - dur!"hours"(1); foreach(hour; -24 .. 25) { auto utc = SysTime(tzInfos[i][1] + dur!"hours"(hour), UTC()); auto local = utc.toLocalTime(); void testOffset2(Duration offset, size_t line = __LINE__) { AssertError msg(string tag) { return new AssertError(format("%s [%s] [%s]: [%s] [%s]", tag, hour, tzName, utc, local), __FILE__, line); } enforce((utc + offset).hour == local.hour, msg("1")); enforce((utc + offset + dur!"minutes"(1)).hour == local.hour, msg("2")); } if(utc < springSwitch) testOffset2(stdOffset); else testOffset2(dstOffset); utc = SysTime(tzInfos[i][2] + dur!"hours"(hour), UTC()); local = utc.toLocalTime(); if(utc == fallSwitch || utc == fallSwitchMinus1) { if(first) { testOffset2(dstOffset); first = false; } else testOffset2(stdOffset); } else if(utc > fallSwitch) testOffset2(stdOffset); else testOffset2(dstOffset); } } } } } private: this() immutable { super("", "", ""); tzset(); } static shared LocalTime _localTime; static bool _initialized; static immutable(LocalTime) singleton() { //TODO Make this use double-checked locking once shared has been fixed //to use memory fences properly. if(!_initialized) { synchronized { if(!_localTime) _localTime = cast(shared LocalTime)new immutable(LocalTime)(); } _initialized = true; } return cast(immutable LocalTime)_localTime; } } /++ A $(D TimeZone) which represents UTC. +/ final class UTC : TimeZone { public: /++ $(D UTC) is a singleton class. $(D UTC) returns its only instance. +/ static immutable(UTC) opCall() pure nothrow { alias pure nothrow immutable(UTC) function() FuncType; return (cast(FuncType)&singleton)(); } /++ Always returns false. +/ @property override bool hasDST() const nothrow { return false; } /++ Always returns false. +/ override bool dstInEffect(long stdTime) const nothrow { return false; } /++ Returns the given hnsecs without changing them at all. Params: stdTime = The UTC time that needs to be adjusted to this time zone's time. See_Also: $(D TimeZone.utcToTZ) +/ override long utcToTZ(long stdTime) const nothrow { return stdTime; } unittest { version(testStdDateTime) { _assertPred!"=="(UTC().utcToTZ(0), 0); version(Posix) { scope(exit) clearTZEnvVar(); setTZEnvVar("UTC"); auto std = SysTime(Date(2010, 1, 1)); auto dst = SysTime(Date(2010, 7, 1)); _assertPred!"=="(UTC().utcToTZ(std.stdTime), std.stdTime); _assertPred!"=="(UTC().utcToTZ(dst.stdTime), dst.stdTime); } } } /++ Returns the given hnsecs without changing them at all. See_Also: $(D TimeZone.tzToUTC) Params: adjTime = The time in this time zone that needs to be adjusted to UTC time. +/ override long tzToUTC(long adjTime) const nothrow { return adjTime; } unittest { version(testStdDateTime) { _assertPred!"=="(UTC().tzToUTC(0), 0); version(Posix) { scope(exit) clearTZEnvVar(); setTZEnvVar("UTC"); auto std = SysTime(Date(2010, 1, 1)); auto dst = SysTime(Date(2010, 7, 1)); _assertPred!"=="(UTC().tzToUTC(std.stdTime), std.stdTime); _assertPred!"=="(UTC().tzToUTC(dst.stdTime), dst.stdTime); } } } /++ Returns a $(CXREF time, Duration) of 0. Params: stdTime = The UTC time for which to get the offset from UTC for this time zone. +/ override Duration utcOffsetAt(long stdTime) const nothrow { return dur!"hnsecs"(0); } private: this() immutable pure { super("UTC", "UTC", "UTC"); } static shared UTC _utc; static bool _initialized; static immutable(UTC) singleton() { //TODO Make this use double-checked locking once shared has been fixed //to use memory fences properly. if(!_initialized) { synchronized { if(!_utc) _utc = cast(shared UTC)new immutable(UTC)(); } _initialized = true; } return cast(immutable UTC)_utc; } } /++ Represents a time zone with an offset (in minutes, west is negative) from UTC but no DST. It's primarily used as the time zone in the result of $(D SysTime)'s $(D fromISOString), $(D fromISOExtString), and $(D fromSimpleString). $(D name) and $(D dstName) are always the empty string since this time zone has no DST, and while it may be meant to represent a time zone which is in the TZ Database, obviously it's not likely to be following the exact rules of any of the time zones in the TZ Database, so it makes no sense to set it. +/ final class SimpleTimeZone : TimeZone { public: /++ Always returns false. +/ @property override bool hasDST() const nothrow { return false; } /++ Always returns false. +/ override bool dstInEffect(long stdTime) const nothrow { return false; } /++ Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in UTC time (i.e. std time) and converts it to this time zone's time. Params: stdTime = The UTC time that needs to be adjusted to this time zone's time. +/ override long utcToTZ(long stdTime) const nothrow { return stdTime + _utcOffset.total!"hnsecs"(); } version(testStdDateTime) unittest { auto west = new SimpleTimeZone(dur!"hours"(-8)); auto east = new SimpleTimeZone(dur!"hours"(8)); assert(west.utcToTZ(0) == -288_000_000_000L); assert(east.utcToTZ(0) == 288_000_000_000L); assert(west.utcToTZ(54_321_234_567_890L) == 54_033_234_567_890L); const cstz = west; static assert(__traits(compiles, west.utcToTZ(50002))); static assert(__traits(compiles, cstz.utcToTZ(50002))); } /++ Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in this time zone's time and converts it to UTC (i.e. std time). Params: adjTime = The time in this time zone that needs to be adjusted to UTC time. +/ override long tzToUTC(long adjTime) const nothrow { return adjTime - _utcOffset.total!"hnsecs"(); } version(testStdDateTime) unittest { auto west = new SimpleTimeZone(dur!"hours"(-8)); auto east = new SimpleTimeZone(dur!"hours"(8)); assert(west.tzToUTC(-288_000_000_000L) == 0); assert(east.tzToUTC(288_000_000_000L) == 0); assert(west.tzToUTC(54_033_234_567_890L) == 54_321_234_567_890L); const cstz = west; static assert(__traits(compiles, west.tzToUTC(20005))); static assert(__traits(compiles, cstz.tzToUTC(20005))); } /++ Returns utcOffset as a $(CXREF time, Duration). Params: stdTime = The UTC time for which to get the offset from UTC for this time zone. +/ override Duration utcOffsetAt(long stdTime) const nothrow { return _utcOffset; } /++ Params: utcOffset = This time zone's offset from UTC in minutes with west of UTC being negative (it is added to UTC to get the adjusted time). stdName = The $(D stdName) for this time zone. +/ this(Duration utcOffset, string stdName = "") immutable { //FIXME This probably needs to be changed to something like (-12 - 13). enforceEx!DateTimeException(abs(utcOffset) < dur!"minutes"(1440), "Offset from UTC must be within range (-24:00 - 24:00)."); super("", stdName, ""); this._utcOffset = utcOffset; } /++ Ditto +/ this(int utcOffset, string stdName = "") immutable { this(dur!"minutes"(utcOffset), stdName); } version(testStdDateTime) unittest { foreach(stz; [new SimpleTimeZone(dur!"hours"(-8), "PST"), new SimpleTimeZone(-8 * 60, "PST")]) { assert(stz.name == ""); assert(stz.stdName == "PST"); assert(stz.dstName == ""); assert(stz.utcOffset == -8 * 60); } } /++ The number of minutes the offset from UTC is (negative is west of UTC, positive is east). +/ @property int utcOffset() @safe const pure nothrow { return cast(int)_utcOffset.total!"minutes"(); } private: /+ Returns a time zone as a string with an offset from UTC. Time zone offsets will be in the form +HH:MM or -HH:MM. Params: utcOffset = The number of minutes offset from UTC (negative means west). +/ static string toISOString(Duration utcOffset) { immutable absOffset = abs(utcOffset); enforceEx!DateTimeException(absOffset < dur!"minutes"(1440), "Offset from UTC must be within range (-24:00 - 24:00)."); if(utcOffset < Duration.zero) return format("-%02d:%02d", absOffset.hours, absOffset.minutes); return format("+%02d:%02d", absOffset.hours, absOffset.minutes); } version(testStdDateTime) unittest { static string testSTZInvalid(Duration offset) { return SimpleTimeZone.toISOString(offset); } assertThrown!DateTimeException(testSTZInvalid(dur!"minutes"(1440))); assertThrown!DateTimeException(testSTZInvalid(dur!"minutes"(-1440))); assert(toISOString(dur!"minutes"(0)) == "+00:00"); assert(toISOString(dur!"minutes"(1)) == "+00:01"); assert(toISOString(dur!"minutes"(10)) == "+00:10"); assert(toISOString(dur!"minutes"(59)) == "+00:59"); assert(toISOString(dur!"minutes"(60)) == "+01:00"); assert(toISOString(dur!"minutes"(90)) == "+01:30"); assert(toISOString(dur!"minutes"(120)) == "+02:00"); assert(toISOString(dur!"minutes"(480)) == "+08:00"); assert(toISOString(dur!"minutes"(1439)) == "+23:59"); assert(toISOString(dur!"minutes"(-1)) == "-00:01"); assert(toISOString(dur!"minutes"(-10)) == "-00:10"); assert(toISOString(dur!"minutes"(-59)) == "-00:59"); assert(toISOString(dur!"minutes"(-60)) == "-01:00"); assert(toISOString(dur!"minutes"(-90)) == "-01:30"); assert(toISOString(dur!"minutes"(-120)) == "-02:00"); assert(toISOString(dur!"minutes"(-480)) == "-08:00"); assert(toISOString(dur!"minutes"(-1439)) == "-23:59"); } /+ Takes a time zone as a string with an offset from UTC and returns a $(LREF SimpleTimeZone) which matches. The accepted formats for time zone offsets are +H, -H, +HH, -HH, +H:MM, -H:MM, +HH:MM, and -HH:MM. Params: isoString = A string which represents a time zone in the ISO format. +/ static immutable(SimpleTimeZone) fromISOString(S)(S isoString) if(isSomeString!S) { auto dstr = to!dstring(strip(isoString)); enforce(dstr.startsWith("-") || dstr.startsWith("+"), new DateTimeException("Invalid ISO String")); auto sign = dstr.startsWith("-") ? -1 : 1; dstr.popFront(); enforce(!dstr.empty, new DateTimeException("Invalid ISO String")); immutable colon = dstr.stds_indexOf(":"); dstring hoursStr; dstring minutesStr; if(colon != -1) { hoursStr = dstr[0 .. colon]; minutesStr = dstr[colon + 1 .. $]; enforce(minutesStr.length == 2, new DateTimeException(format("Invalid ISO String: %s", dstr))); } else hoursStr = dstr; enforce(!canFind!(not!isDigit)(hoursStr), new DateTimeException(format("Invalid ISO String: %s", dstr))); enforce(!canFind!(not!isDigit)(minutesStr), new DateTimeException(format("Invalid ISO String: %s", dstr))); immutable hours = to!int(hoursStr); immutable minutes = minutesStr.empty ? 0 : to!int(minutesStr); return new SimpleTimeZone(sign * (dur!"hours"(hours) + dur!"minutes"(minutes))); } version(testStdDateTime) unittest { assertThrown!DateTimeException(SimpleTimeZone.fromISOString("")); assertThrown!DateTimeException(SimpleTimeZone.fromISOString("Z")); assertThrown!DateTimeException(SimpleTimeZone.fromISOString("-")); assertThrown!DateTimeException(SimpleTimeZone.fromISOString("+")); assertThrown!DateTimeException(SimpleTimeZone.fromISOString("-:")); assertThrown!DateTimeException(SimpleTimeZone.fromISOString("+:")); assertThrown!DateTimeException(SimpleTimeZone.fromISOString("-1:")); assertThrown!DateTimeException(SimpleTimeZone.fromISOString("+1:")); assertThrown!DateTimeException(SimpleTimeZone.fromISOString("1")); assertThrown!DateTimeException(SimpleTimeZone.fromISOString("-24:00")); assertThrown!DateTimeException(SimpleTimeZone.fromISOString("+24:00")); assertThrown!DateTimeException(SimpleTimeZone.fromISOString("+1:0")); assert(SimpleTimeZone.fromISOString("+00:00").utcOffset == (new SimpleTimeZone(dur!"minutes"(0))).utcOffset); assert(SimpleTimeZone.fromISOString("+00:01").utcOffset == (new SimpleTimeZone(dur!"minutes"(1))).utcOffset); assert(SimpleTimeZone.fromISOString("+00:10").utcOffset == (new SimpleTimeZone(dur!"minutes"(10))).utcOffset); assert(SimpleTimeZone.fromISOString("+00:59").utcOffset == (new SimpleTimeZone(dur!"minutes"(59))).utcOffset); assert(SimpleTimeZone.fromISOString("+01:00").utcOffset == (new SimpleTimeZone(dur!"minutes"(60))).utcOffset); assert(SimpleTimeZone.fromISOString("+01:30").utcOffset == (new SimpleTimeZone(dur!"minutes"(90))).utcOffset); assert(SimpleTimeZone.fromISOString("+02:00").utcOffset == (new SimpleTimeZone(dur!"minutes"(120))).utcOffset); assert(SimpleTimeZone.fromISOString("+08:00").utcOffset == (new SimpleTimeZone(dur!"minutes"(480))).utcOffset); assert(SimpleTimeZone.fromISOString("+23:59").utcOffset == (new SimpleTimeZone(dur!"minutes"(1439))).utcOffset); assert(SimpleTimeZone.fromISOString("-00:01").utcOffset == (new SimpleTimeZone(dur!"minutes"(-1))).utcOffset); assert(SimpleTimeZone.fromISOString("-00:10").utcOffset == (new SimpleTimeZone(dur!"minutes"(-10))).utcOffset); assert(SimpleTimeZone.fromISOString("-00:59").utcOffset == (new SimpleTimeZone(dur!"minutes"(-59))).utcOffset); assert(SimpleTimeZone.fromISOString("-01:00").utcOffset == (new SimpleTimeZone(dur!"minutes"(-60))).utcOffset); assert(SimpleTimeZone.fromISOString("-01:30").utcOffset == (new SimpleTimeZone(dur!"minutes"(-90))).utcOffset); assert(SimpleTimeZone.fromISOString("-02:00").utcOffset == (new SimpleTimeZone(dur!"minutes"(-120))).utcOffset); assert(SimpleTimeZone.fromISOString("-08:00").utcOffset == (new SimpleTimeZone(dur!"minutes"(-480))).utcOffset); assert(SimpleTimeZone.fromISOString("-23:59").utcOffset == (new SimpleTimeZone(dur!"minutes"(-1439))).utcOffset); assert(SimpleTimeZone.fromISOString("+0").utcOffset == (new SimpleTimeZone(dur!"minutes"(0))).utcOffset); assert(SimpleTimeZone.fromISOString("+1").utcOffset == (new SimpleTimeZone(dur!"minutes"(60))).utcOffset); assert(SimpleTimeZone.fromISOString("+2").utcOffset == (new SimpleTimeZone(dur!"minutes"(120))).utcOffset); assert(SimpleTimeZone.fromISOString("+23").utcOffset == (new SimpleTimeZone(dur!"minutes"(1380))).utcOffset); assert(SimpleTimeZone.fromISOString("+2").utcOffset == (new SimpleTimeZone(dur!"minutes"(120))).utcOffset); assert(SimpleTimeZone.fromISOString("+0").utcOffset == (new SimpleTimeZone(dur!"minutes"(0))).utcOffset); assert(SimpleTimeZone.fromISOString("+1").utcOffset == (new SimpleTimeZone(dur!"minutes"(60))).utcOffset); assert(SimpleTimeZone.fromISOString("+2").utcOffset == (new SimpleTimeZone(dur!"minutes"(120))).utcOffset); assert(SimpleTimeZone.fromISOString("+23").utcOffset == (new SimpleTimeZone(dur!"minutes"(1380))).utcOffset); assert(SimpleTimeZone.fromISOString("+1:00").utcOffset == (new SimpleTimeZone(dur!"minutes"(60))).utcOffset); assert(SimpleTimeZone.fromISOString("+1:01").utcOffset == (new SimpleTimeZone(dur!"minutes"(61))).utcOffset); assert(SimpleTimeZone.fromISOString("-0").utcOffset == (new SimpleTimeZone(dur!"minutes"(0))).utcOffset); assert(SimpleTimeZone.fromISOString("-1").utcOffset == (new SimpleTimeZone(dur!"minutes"(-60))).utcOffset); assert(SimpleTimeZone.fromISOString("-2").utcOffset == (new SimpleTimeZone(dur!"minutes"(-120))).utcOffset); assert(SimpleTimeZone.fromISOString("-23").utcOffset == (new SimpleTimeZone(dur!"minutes"(-1380))).utcOffset); assert(SimpleTimeZone.fromISOString("-1:00").utcOffset == (new SimpleTimeZone(dur!"minutes"(-60))).utcOffset); assert(SimpleTimeZone.fromISOString("-1:01").utcOffset == (new SimpleTimeZone(dur!"minutes"(-61))).utcOffset); } //Test that converting from an ISO string to a SimpleTimeZone to an ISO String works properly. version(testStdDateTime) unittest { static void testSTZ(in string isoString, int expectedOffset, size_t line = __LINE__) { auto stz = SimpleTimeZone.fromISOString(isoString); _assertPred!"=="(stz.utcOffset, expectedOffset, "", __FILE__, line); auto result = SimpleTimeZone.toISOString(dur!"minutes"(stz.utcOffset)); _assertPred!"=="(result, isoString, "", __FILE__, line); } testSTZ("+00:00", 0); testSTZ("+00:01", 1); testSTZ("+00:10", 10); testSTZ("+00:59", 59); testSTZ("+01:00", 60); testSTZ("+01:30", 90); testSTZ("+02:00", 120); testSTZ("+08:00", 480); testSTZ("+08:00", 480); testSTZ("+23:59", 1439); testSTZ("-00:01", -1); testSTZ("-00:10", -10); testSTZ("-00:59", -59); testSTZ("-01:00", -60); testSTZ("-01:30", -90); testSTZ("-02:00", -120); testSTZ("-08:00", -480); testSTZ("-08:00", -480); testSTZ("-23:59", -1439); } immutable Duration _utcOffset; } /++ Represents a time zone from a TZ Database time zone file. Files from the TZ Database are how Posix systems hold their time zone information. Unfortunately, Windows does not use the TZ Database. To use the TZ Database, use $(LREF PosixTimeZone) (which reads its information from the TZ Database files on disk) on Windows by providing the TZ Database files and telling $(D PosixTimeZone.getTimeZone) where the directory holding them is. To get a $(D PosixTimeZone), either call $(D PosixTimeZone.getTimeZone) (which allows specifying the location the time zone files) or call $(D TimeZone.getTimeZone) (which will give a $(D PosixTimeZone) on Posix systems and a $(D WindowsTimeZone) on Windows systems). Note: Unless your system's local time zone deals with leap seconds (which is highly unlikely), then the only way to get a time zone which takes leap seconds into account is to use $(D PosixTimeZone) with a time zone whose name starts with "right/". Those time zone files do include leap seconds, and $(D PosixTimeZone) will take them into account (though posix systems which use a "right/" time zone as their local time zone will $(I not) take leap seconds into account even though they're in the file). See_Also: $(WEB www.iana.org/time-zones, Home of the TZ Database files)<br> $(WEB en.wikipedia.org/wiki/Tz_database, Wikipedia entry on TZ Database)<br> $(WEB en.wikipedia.org/wiki/List_of_tz_database_time_zones, List of Time Zones) +/ final class PosixTimeZone : TimeZone { public: /++ Whether this time zone has Daylight Savings Time at any point in time. Note that for some time zone types it may not have DST for current dates but will still return true for $(D hasDST) because the time zone did at some point have DST. +/ @property override bool hasDST() const nothrow { return _hasDST; } /++ Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in UTC time (i.e. std time) and returns whether DST is in effect in this time zone at the given point in time. Params: stdTime = The UTC time that needs to be checked for DST in this time zone. +/ override bool dstInEffect(long stdTime) const nothrow { assert(!_transitions.empty); try { immutable unixTime = stdTimeToUnixTime(stdTime); immutable found = countUntil!"b < a.timeT"(cast(Transition[])_transitions, unixTime); if(found == -1) return _transitions.back.ttInfo.isDST; immutable transition = found == 0 ? _transitions[0] : _transitions[found - 1]; return transition.ttInfo.isDST; } catch(Exception e) assert(0, format("Unexpected Exception: %s", e)); } /++ Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in UTC time (i.e. std time) and converts it to this time zone's time. Params: stdTime = The UTC time that needs to be adjusted to this time zone's time. +/ override long utcToTZ(long stdTime) const nothrow { assert(!_transitions.empty); try { immutable leapSecs = calculateLeapSeconds(stdTime); immutable unixTime = stdTimeToUnixTime(stdTime); immutable found = countUntil!"b < a.timeT"(cast(Transition[])_transitions, unixTime); if(found == -1) return stdTime + convert!("seconds", "hnsecs")(_transitions.back.ttInfo.utcOffset + leapSecs); immutable transition = found == 0 ? _transitions[0] : _transitions[found - 1]; return stdTime + convert!("seconds", "hnsecs")(transition.ttInfo.utcOffset + leapSecs); } catch(Exception e) assert(0, format("Unexpected Exception: %s", e)); } /++ Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in this time zone's time and converts it to UTC (i.e. std time). Params: adjTime = The time in this time zone that needs to be adjusted to UTC time. +/ override long tzToUTC(long adjTime) const nothrow { assert(!_transitions.empty); try { immutable leapSecs = calculateLeapSeconds(adjTime); time_t unixTime = stdTimeToUnixTime(adjTime); immutable past = unixTime - convert!("days", "seconds")(1); immutable future = unixTime + convert!("days", "seconds")(1); immutable pastFound = countUntil!"b < a.timeT"(cast(Transition[])_transitions, past); if(pastFound == -1) return adjTime - convert!("seconds", "hnsecs")(_transitions.back.ttInfo.utcOffset + leapSecs); immutable futureFound = countUntil!"b < a.timeT"(cast(Transition[])_transitions[pastFound .. $], future); immutable pastTrans = pastFound == 0 ? _transitions[0] : _transitions[pastFound - 1]; if(futureFound == 0) return adjTime - convert!("seconds", "hnsecs")(pastTrans.ttInfo.utcOffset + leapSecs); immutable futureTrans = futureFound == -1 ? _transitions.back : _transitions[pastFound + futureFound - 1]; immutable pastOffset = pastTrans.ttInfo.utcOffset; if(pastOffset < futureTrans.ttInfo.utcOffset) unixTime -= convert!("hours", "seconds")(1); immutable found = countUntil!"b < a.timeT"(cast(Transition[])_transitions[pastFound .. $], unixTime - pastOffset); if(found == -1) return adjTime - convert!("seconds", "hnsecs")(_transitions.back.ttInfo.utcOffset + leapSecs); immutable transition = found == 0 ? pastTrans : _transitions[pastFound + found - 1]; return adjTime - convert!("seconds", "hnsecs")(transition.ttInfo.utcOffset + leapSecs); } catch(Exception e) assert(0, format("Unexpected Exception: %s", e)); } version(Posix) { /++ The default directory where the TZ Database files are. It's empty for Windows, since Windows doesn't have them. +/ enum defaultTZDatabaseDir = "/usr/share/zoneinfo/"; } else version(Windows) { /++ The default directory where the TZ Database files are. It's empty for Windows, since Windows doesn't have them. +/ enum defaultTZDatabaseDir = ""; } /++ Returns a $(D TimeZone) with the give name per the TZ Database. The time zone information is fetched from the TZ Database time zone files in the given directory. See_Also: $(WEB en.wikipedia.org/wiki/Tz_database, Wikipedia entry on TZ Database)<br> $(WEB en.wikipedia.org/wiki/List_of_tz_database_time_zones, List of Time Zones) Params: name = The TZ Database name of the desired time zone tzDatabaseDir = The directory where the TZ Database files are located. Because these files are not located on Windows systems, provide them and give their location here to use $(D PosixTimeZone)s. Throws: $(D DateTimeException) if the given time zone could not be found or $(D FileException) if the TZ Database file could not be opened. Examples: -------------------- auto tz = PosixTimeZone.getTimeZone("America/Los_Angeles"); assert(tz.name == "America/Los_Angeles"); assert(tz.stdName == "PST"); assert(tz.dstName == "PDT"); -------------------- +/ //TODO make it possible for tzDatabaseDir to be gzipped tar file rather than an uncompressed // directory. static immutable(PosixTimeZone) getTimeZone(string name, string tzDatabaseDir = defaultTZDatabaseDir) { name = strip(name); enforce(tzDatabaseDir.exists, new DateTimeException(format("Directory %s does not exist.", tzDatabaseDir))); enforce(tzDatabaseDir.isDir, new DateTimeException(format("%s is not a directory.", tzDatabaseDir))); version(Posix) auto file = tzDatabaseDir ~ name; else version(Windows) auto file = tzDatabaseDir ~ replace(strip(name), "/", dirSeparator); enforce(file.exists, new DateTimeException(format("File %s does not exist.", file))); enforce(file.isFile, new DateTimeException(format("%s is not a file.", file))); auto tzFile = File(file); immutable gmtZone = file.canFind("GMT"); try { _enforceValidTZFile(readVal!(char[])(tzFile, 4) == "TZif"); immutable char tzFileVersion = readVal!char(tzFile); _enforceValidTZFile(tzFileVersion == '\0' || tzFileVersion == '2'); { auto zeroBlock = readVal!(ubyte[])(tzFile, 15); bool allZeroes = true; foreach(val; zeroBlock) { if(val != 0) { allZeroes = false; break; } } _enforceValidTZFile(allZeroes); } //The number of UTC/local indicators stored in the file. auto tzh_ttisgmtcnt = readVal!int(tzFile); //The number of standard/wall indicators stored in the file. auto tzh_ttisstdcnt = readVal!int(tzFile); //The number of leap seconds for which data is stored in the file. auto tzh_leapcnt = readVal!int(tzFile); //The number of "transition times" for which data is stored in the file. auto tzh_timecnt = readVal!int(tzFile); //The number of "local time types" for which data is stored in the file (must not be zero). auto tzh_typecnt = readVal!int(tzFile); _enforceValidTZFile(tzh_typecnt != 0); //The number of characters of "timezone abbreviation strings" stored in the file. auto tzh_charcnt = readVal!int(tzFile); //time_ts where DST transitions occur. auto transitionTimeTs = new long[](tzh_timecnt); foreach(ref transition; transitionTimeTs) transition = readVal!int(tzFile); //Indices into ttinfo structs indicating the changes //to be made at the corresponding DST transition. auto ttInfoIndices = new ubyte[](tzh_timecnt); foreach(ref ttInfoIndex; ttInfoIndices) ttInfoIndex = readVal!ubyte(tzFile); //ttinfos which give info on DST transitions. auto tempTTInfos = new TempTTInfo[](tzh_typecnt); foreach(ref ttInfo; tempTTInfos) ttInfo = readVal!TempTTInfo(tzFile); //The array of time zone abbreviation characters. auto tzAbbrevChars = readVal!(char[])(tzFile, tzh_charcnt); auto leapSeconds = new LeapSecond[](tzh_leapcnt); foreach(ref leapSecond; leapSeconds) { //The time_t when the leap second occurs. auto timeT = readVal!int(tzFile); //The total number of leap seconds to be applied after //the corresponding leap second. auto total = readVal!int(tzFile); leapSecond = LeapSecond(timeT, total); } //Indicate whether each corresponding DST transition were specified //in standard time or wall clock time. auto transitionIsStd = new bool[](tzh_ttisstdcnt); foreach(ref isStd; transitionIsStd) isStd = readVal!bool(tzFile); //Indicate whether each corresponding DST transition associated with //local time types are specified in UTC or local time. auto transitionInUTC = new bool[](tzh_ttisgmtcnt); foreach(ref inUTC; transitionInUTC) inUTC = readVal!bool(tzFile); _enforceValidTZFile(!tzFile.eof); //If version 2, the information is duplicated in 64-bit. if(tzFileVersion == '2') { _enforceValidTZFile(readVal!(char[])(tzFile, 4) == "TZif"); _enforceValidTZFile(readVal!(char)(tzFile) == '2'); { auto zeroBlock = readVal!(ubyte[])(tzFile, 15); bool allZeroes = true; foreach(val; zeroBlock) { if(val != 0) { allZeroes = false; break; } } _enforceValidTZFile(allZeroes); } //The number of UTC/local indicators stored in the file. tzh_ttisgmtcnt = readVal!int(tzFile); //The number of standard/wall indicators stored in the file. tzh_ttisstdcnt = readVal!int(tzFile); //The number of leap seconds for which data is stored in the file. tzh_leapcnt = readVal!int(tzFile); //The number of "transition times" for which data is stored in the file. tzh_timecnt = readVal!int(tzFile); //The number of "local time types" for which data is stored in the file (must not be zero). tzh_typecnt = readVal!int(tzFile); _enforceValidTZFile(tzh_typecnt != 0); //The number of characters of "timezone abbreviation strings" stored in the file. tzh_charcnt = readVal!int(tzFile); //time_ts where DST transitions occur. transitionTimeTs = new long[](tzh_timecnt); foreach(ref transition; transitionTimeTs) transition = readVal!long(tzFile); //Indices into ttinfo structs indicating the changes //to be made at the corresponding DST transition. ttInfoIndices = new ubyte[](tzh_timecnt); foreach(ref ttInfoIndex; ttInfoIndices) ttInfoIndex = readVal!ubyte(tzFile); //ttinfos which give info on DST transitions. tempTTInfos = new TempTTInfo[](tzh_typecnt); foreach(ref ttInfo; tempTTInfos) ttInfo = readVal!TempTTInfo(tzFile); //The array of time zone abbreviation characters. tzAbbrevChars = readVal!(char[])(tzFile, tzh_charcnt); leapSeconds = new LeapSecond[](tzh_leapcnt); foreach(ref leapSecond; leapSeconds) { //The time_t when the leap second occurs. auto timeT = readVal!long(tzFile); //The total number of leap seconds to be applied after //the corresponding leap second. auto total = readVal!int(tzFile); leapSecond = LeapSecond(timeT, total); } //Indicate whether each corresponding DST transition were specified //in standard time or wall clock time. transitionIsStd = new bool[](tzh_ttisstdcnt); foreach(ref isStd; transitionIsStd) isStd = readVal!bool(tzFile); //Indicate whether each corresponding DST transition associated with //local time types are specified in UTC or local time. transitionInUTC = new bool[](tzh_ttisgmtcnt); foreach(ref inUTC; transitionInUTC) inUTC = readVal!bool(tzFile); } _enforceValidTZFile(tzFile.readln().strip().empty); auto posixEnvStr = tzFile.readln().strip(); _enforceValidTZFile(tzFile.readln().strip().empty); _enforceValidTZFile(tzFile.eof); auto transitionTypes = new TransitionType*[](tempTTInfos.length); foreach(i, ref ttype; transitionTypes) { bool isStd = false; if(i < transitionIsStd.length && !transitionIsStd.empty) isStd = transitionIsStd[i]; bool inUTC = false; if(i < transitionInUTC.length && !transitionInUTC.empty) inUTC = transitionInUTC[i]; ttype = new TransitionType(isStd, inUTC); } auto ttInfos = new immutable(TTInfo)*[](tempTTInfos.length); foreach(i, ref ttInfo; ttInfos) { auto tempTTInfo = tempTTInfos[i]; if(gmtZone) tempTTInfo.tt_gmtoff = -tempTTInfo.tt_gmtoff; auto abbrevChars = tzAbbrevChars[tempTTInfo.tt_abbrind .. $]; string abbrev = abbrevChars[0 .. abbrevChars.stds_indexOf("\0")].idup; ttInfo = new immutable(TTInfo)(tempTTInfos[i], abbrev); } auto tempTransitions = new TempTransition[](transitionTimeTs.length); foreach(i, ref tempTransition; tempTransitions) { immutable ttiIndex = ttInfoIndices[i]; auto transitionTimeT = transitionTimeTs[i]; auto ttype = transitionTypes[ttiIndex]; auto ttInfo = ttInfos[ttiIndex]; tempTransition = TempTransition(transitionTimeT, ttInfo, ttype); } if(tempTransitions.empty) { _enforceValidTZFile(ttInfos.length == 1 && transitionTypes.length == 1); tempTransitions ~= TempTransition(0, ttInfos[0], transitionTypes[0]); } sort!"a.timeT < b.timeT"(tempTransitions); sort!"a.timeT < b.timeT"(leapSeconds); auto transitions = new Transition[](tempTransitions.length); foreach(i, ref transition; transitions) { auto tempTransition = tempTransitions[i]; auto transitionTimeT = tempTransition.timeT; auto ttInfo = tempTransition.ttInfo; auto ttype = tempTransition.ttype; _enforceValidTZFile(i == 0 || transitionTimeT > tempTransitions[i - 1].timeT); transition = Transition(transitionTimeT, ttInfo); } string stdName; string dstName; bool hasDST = false; foreach(transition; retro(transitions)) { auto ttInfo = transition.ttInfo; if(ttInfo.isDST) { if(dstName.empty) dstName = ttInfo.abbrev; hasDST = true; } else { if(stdName.empty) stdName = ttInfo.abbrev; } if(!stdName.empty && !dstName.empty) break; } return new PosixTimeZone(transitions.idup, leapSeconds.idup, name, stdName, dstName, hasDST); } catch(DateTimeException dte) throw dte; catch(Exception e) throw new DateTimeException("Not a valid TZ data file", __FILE__, __LINE__, e); } /++ Returns a list of the names of the time zones installed on the system. Providing a sub-name narrows down the list of time zones (which can number in the thousands). For example, passing in "America" as the sub-name returns only the time zones which begin with "America". Params: subName = The first part of the desired time zones. Throws: $(D FileException) if it fails to read from disk. +/ static string[] getInstalledTZNames(string subName = "", string tzDatabaseDir = defaultTZDatabaseDir) { version(Posix) subName = strip(subName); else version(Windows) subName = replace(strip(subName), "/", dirSeparator); if(!tzDatabaseDir.endsWith(dirSeparator)) tzDatabaseDir ~= dirSeparator; enforce(tzDatabaseDir.exists, new DateTimeException(format("Directory %s does not exist.", tzDatabaseDir))); enforce(tzDatabaseDir.isDir, new DateTimeException(format("%s is not a directory.", tzDatabaseDir))); auto timezones = appender!(string[])(); foreach(DirEntry dentry; dirEntries(tzDatabaseDir, SpanMode.depth)) { if(dentry.isFile) { auto tzName = dentry.name[tzDatabaseDir.length .. $]; if(!tzName.extension().empty || !tzName.startsWith(subName) || tzName == "+VERSION") { continue; } timezones.put(tzName); } } sort(timezones.data); return timezones.data; } unittest { version(testStdDateTime) { version(Posix) { static void testPTZSuccess(string tzName) { scope(failure) writefln("TZName which threw: %s", tzName); PosixTimeZone.getTimeZone(tzName); } static void testPTZFailure(string tzName) { scope(success) writefln("TZName which was supposed to throw: %s", tzName); PosixTimeZone.getTimeZone(tzName); } auto tzNames = getInstalledTZNames(); foreach(tzName; tzNames) assertNotThrown!DateTimeException(testPTZSuccess(tzName)); foreach(DirEntry dentry; dirEntries(defaultTZDatabaseDir, SpanMode.depth)) { if(dentry.isFile) { auto tzName = dentry.name[defaultTZDatabaseDir.length .. $]; if(!canFind(tzNames, tzName)) assertThrown!DateTimeException(testPTZFailure(tzName)); } } } } } private: /+ Holds information on when a time transition occures (usually a transition to or from DST) as well as a pointer to the $(D TTInfo) which holds information on the utc offset passed the transition. +/ struct Transition { this(long timeT, immutable (TTInfo)* ttInfo) { this.timeT = timeT; this.ttInfo = ttInfo; } long timeT; immutable (TTInfo)* ttInfo; } /+ Holds information on when a leap second occurs. +/ struct LeapSecond { this(long timeT, int total) { this.timeT = timeT; this.total = total; } long timeT; int total; } /+ Holds information on the utc offset after a transition as well as whether DST is in effect after that transition. +/ struct TTInfo { this(in TempTTInfo tempTTInfo, string abbrev) immutable { utcOffset = tempTTInfo.tt_gmtoff; isDST = tempTTInfo.tt_isdst; this.abbrev = abbrev; } immutable int utcOffset; /// Offset from UTC. immutable bool isDST; /// Whether DST is in effect. immutable string abbrev; /// The current abbreviation for the time zone. } /+ Struct used to hold information relating to $(D TTInfo) while organizing the time zone information prior to putting it in its final form. +/ struct TempTTInfo { this(int gmtOff, bool isDST, ubyte abbrInd) { tt_gmtoff = gmtOff; tt_isdst = isDST; tt_abbrind = abbrInd; } int tt_gmtoff; bool tt_isdst; ubyte tt_abbrind; } /+ Struct used to hold information relating to $(D Transition) while organizing the time zone information prior to putting it in its final form. +/ struct TempTransition { this(long timeT, immutable (TTInfo)* ttInfo, TransitionType* ttype) { this.timeT = timeT; this.ttInfo = ttInfo; this.ttype = ttype; } long timeT; immutable (TTInfo)* ttInfo; TransitionType* ttype; } /+ Struct used to hold information relating to $(D Transition) and $(D TTInfo) while organizing the time zone information prior to putting it in its final form. +/ struct TransitionType { this(bool isStd, bool inUTC) { this.isStd = isStd; this.inUTC = inUTC; } /// Whether the transition is in std time (as opposed to wall clock time). bool isStd; /// Whether the transition is in UTC (as opposed to local time). bool inUTC; } /+ Reads an int from a TZ file. +/ static T readVal(T)(ref File tzFile) if((isIntegral!T || isSomeChar!T) || is(Unqual!T == bool)) { import std.bitmanip; T[1] buff; _enforceValidTZFile(!tzFile.eof); tzFile.rawRead(buff); return bigEndianToNative!T(cast(ubyte[T.sizeof])buff); } /+ Reads an array of values from a TZ file. +/ static T readVal(T)(ref File tzFile, size_t length) if(isArray!T) { auto buff = new T(length); _enforceValidTZFile(!tzFile.eof); tzFile.rawRead(buff); return buff; } /+ Reads a $(D TempTTInfo) from a TZ file. +/ static T readVal(T)(ref File tzFile) if(is(T == TempTTInfo)) { return TempTTInfo(readVal!int(tzFile), readVal!bool(tzFile), readVal!ubyte(tzFile)); } /+ Throws: $(D DateTimeException) if $(D result) is false. +/ static void _enforceValidTZFile(bool result, size_t line = __LINE__) { if(!result) throw new DateTimeException("Not a valid tzdata file.", __FILE__, line); } int calculateLeapSeconds(long stdTime) const nothrow { try { if(_leapSeconds.empty) return 0; immutable unixTime = stdTimeToUnixTime(stdTime); if(_leapSeconds.front.timeT >= unixTime) return 0; immutable found = countUntil!"b < a.timeT"(cast(LeapSecond[])_leapSeconds, unixTime); if(found == -1) return _leapSeconds.back.total; immutable leapSecond = found == 0 ? _leapSeconds[0] : _leapSeconds[found - 1]; return leapSecond.total; } catch(Exception e) assert(0, format("Nothing in calculateLeapSeconds() should be throwing. Caught Exception: %s", e)); } this(immutable Transition[] transitions, immutable LeapSecond[] leapSeconds, string name, string stdName, string dstName, bool hasDST) immutable { if(dstName.empty && !stdName.empty) dstName = stdName; else if(stdName.empty && !dstName.empty) stdName = dstName; super(name, stdName, dstName); if(!transitions.empty) { foreach(i, transition; transitions[0 .. $-1]) _enforceValidTZFile(transition.timeT < transitions[i + 1].timeT); } foreach(i, leapSecond; leapSeconds) _enforceValidTZFile(i == leapSeconds.length - 1 || leapSecond.timeT < leapSeconds[i + 1].timeT); _transitions = transitions; _leapSeconds = leapSeconds; _hasDST = hasDST; } /// List of times when the utc offset changes. immutable Transition[] _transitions; /// List of leap second occurrences. immutable LeapSecond[] _leapSeconds; /// Whether DST is in effect for this time zone at any point in time. immutable bool _hasDST; } version(StdDdoc) { /++ $(BLUE This class is Windows-Only.) Represents a time zone from the Windows registry. Unfortunately, Windows does not use the TZ Database. To use the TZ Database, use $(LREF PosixTimeZone) (which reads its information from the TZ Database files on disk) on Windows by providing the TZ Database files and telling $(D PosixTimeZone.getTimeZone) where the directory holding them is. The TZ Database files and Windows' time zone information frequently do not match. Windows has many errors with regards to when DST switches occur (especially for historical dates). Also, the TZ Database files include far more time zones than Windows does. So, for accurate time zone information, use the TZ Database files with $(LREF PosixTimeZone) rather than $(D WindowsTimeZone). However, because $(D WindowsTimeZone) uses Windows system calls to deal with the time, it's far more likely to match the behavior of other Windows programs. Be aware of the differences when selecting a method. $(D WindowsTimeZone) does not exist on Posix systems. To get a $(D WindowsTimeZone), either call $(D WindowsTimeZone.getTimeZone) or call $(D TimeZone.getTimeZone) (which will give a $(LREF PosixTimeZone) on Posix systems and a $(D WindowsTimeZone) on Windows systems). See_Also: $(WEB www.iana.org/time-zones, Home of the TZ Database files) +/ final class WindowsTimeZone : TimeZone { public: /++ Whether this time zone has Daylight Savings Time at any point in time. Note that for some time zone types it may not have DST for current dates but will still return true for $(D hasDST) because the time zone did at some point have DST. +/ @property override bool hasDST() const nothrow; /++ Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in UTC time (i.e. std time) and returns whether DST is in effect in this time zone at the given point in time. Params: stdTime = The UTC time that needs to be checked for DST in this time zone. +/ override bool dstInEffect(long stdTime) const nothrow; /++ Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in UTC time (i.e. std time) and converts it to this time zone's time. Params: stdTime = The UTC time that needs to be adjusted to this time zone's time. +/ override long utcToTZ(long stdTime) const nothrow; /++ Takes the number of hnsecs (100 ns) since midnight, January 1st, 1 A.D. in this time zone's time and converts it to UTC (i.e. std time). Params: adjTime = The time in this time zone that needs to be adjusted to UTC time. +/ override long tzToUTC(long adjTime) const nothrow; /++ Returns a $(D TimeZone) with the given name per the Windows time zone names. The time zone information is fetched from the Windows registry. See_Also: $(WEB en.wikipedia.org/wiki/Tz_database, Wikipedia entry on TZ Database)<br> $(WEB en.wikipedia.org/wiki/List_of_tz_database_time_zones, List of Time Zones) Params: name = The TZ Database name of the desired time zone. Throws: $(D DateTimeException) if the given time zone could not be found. Examples: -------------------- auto tz = TimeZone.getTimeZone("America/Los_Angeles"); -------------------- +/ static immutable(WindowsTimeZone) getTimeZone(string name); /++ Returns a list of the names of the time zones installed on the system. +/ static string[] getInstalledTZNames(); private: version(Windows) {} else alias void* TIME_ZONE_INFORMATION; static bool _dstInEffect(const TIME_ZONE_INFORMATION* tzInfo, long stdTime) nothrow; static long _utcToTZ(const TIME_ZONE_INFORMATION* tzInfo, long stdTime, bool hasDST) nothrow; static long _tzToUTC(const TIME_ZONE_INFORMATION* tzInfo, long adjTime, bool hasDST) nothrow; this() immutable pure { super("", "", ""); } } } else version(Windows) { final class WindowsTimeZone : TimeZone { public: @property override bool hasDST() const nothrow { return _tzInfo.DaylightDate.wMonth != 0; } override bool dstInEffect(long stdTime) const nothrow { return _dstInEffect(&_tzInfo, stdTime); } override long utcToTZ(long stdTime) const nothrow { return _utcToTZ(&_tzInfo, stdTime, hasDST); } override long tzToUTC(long adjTime) const nothrow { return _tzToUTC(&_tzInfo, adjTime, hasDST); } static immutable(WindowsTimeZone) getTimeZone(string name) { scope baseKey = Registry.localMachine.getKey(`Software\Microsoft\Windows NT\CurrentVersion\Time Zones`); foreach (tzKeyName; baseKey.keyNames) { if (tzKeyName != name) continue; scope tzKey = baseKey.getKey(tzKeyName); scope stdVal = tzKey.getValue("Std"); auto stdName = stdVal.value_SZ; scope dstVal = tzKey.getValue("Dlt"); auto dstName = dstVal.value_SZ; scope tziVal = tzKey.getValue("TZI"); auto binVal = tziVal.value_BINARY; assert(binVal.length == REG_TZI_FORMAT.sizeof); auto tziFmt = cast(REG_TZI_FORMAT*)binVal.ptr; TIME_ZONE_INFORMATION tzInfo; auto wstdName = toUTF16(stdName); auto wdstName = toUTF16(dstName); auto wstdNameLen = wstdName.length > 32 ? 32 : wstdName.length; auto wdstNameLen = wdstName.length > 32 ? 32 : wdstName.length; tzInfo.Bias = tziFmt.Bias; tzInfo.StandardName[0 .. wstdNameLen] = wstdName[0 .. wstdNameLen]; tzInfo.StandardName[wstdNameLen .. $] = '\0'; tzInfo.StandardDate = tziFmt.StandardDate; tzInfo.StandardBias = tziFmt.StandardBias; tzInfo.DaylightName[0 .. wdstNameLen] = wdstName[0 .. wdstNameLen]; tzInfo.DaylightName[wdstNameLen .. $] = '\0'; tzInfo.DaylightDate = tziFmt.DaylightDate; tzInfo.DaylightBias = tziFmt.DaylightBias; return new WindowsTimeZone(name, tzInfo); } throw new DateTimeException(format("Failed to find time zone: %s", name)); } static string[] getInstalledTZNames() { auto timezones = appender!(string[])(); scope baseKey = Registry.localMachine.getKey(`Software\Microsoft\Windows NT\CurrentVersion\Time Zones`); foreach (tzKeyName; baseKey.keyNames) { timezones.put(tzKeyName); } sort(timezones.data); return timezones.data; } unittest { version(testStdDateTime) { static void testWTZSuccess(string tzName) { scope(failure) writefln("TZName which threw: %s", tzName); WindowsTimeZone.getTimeZone(tzName); } auto tzNames = getInstalledTZNames(); foreach(tzName; tzNames) assertNotThrown!DateTimeException(testWTZSuccess(tzName)); } } private: static bool _dstInEffect(const TIME_ZONE_INFORMATION* tzInfo, long stdTime) nothrow { try { if(tzInfo.DaylightDate.wMonth == 0) return false; auto utcDateTime = cast(DateTime)SysTime(stdTime, UTC()); //The limits of what SystemTimeToTzSpecificLocalTime will accept. if(utcDateTime.year < 1601) { if(utcDateTime.month == Month.feb && utcDateTime.day == 29) utcDateTime.day = 28; utcDateTime.year = 1601; } else if(utcDateTime.year > 30_827) { if(utcDateTime.month == Month.feb && utcDateTime.day == 29) utcDateTime.day = 28; utcDateTime.year = 30_827; } //SystemTimeToTzSpecificLocalTime doesn't act correctly at the //beginning or end of the year (bleh). Unless some bizarre time //zone changes DST on January 1st or December 31st, this should //fix the problem. if(utcDateTime.month == Month.jan) { if(utcDateTime.day == 1) utcDateTime.day = 2; } else if(utcDateTime.month == Month.dec && utcDateTime.day == 31) utcDateTime.day = 30; SYSTEMTIME utcTime = void; SYSTEMTIME otherTime = void; utcTime.wYear = utcDateTime.year; utcTime.wMonth = utcDateTime.month; utcTime.wDay = utcDateTime.day; utcTime.wHour = utcDateTime.hour; utcTime.wMinute = utcDateTime.minute; utcTime.wSecond = utcDateTime.second; utcTime.wMilliseconds = 0; immutable result = SystemTimeToTzSpecificLocalTime(cast(TIME_ZONE_INFORMATION*)tzInfo, &utcTime, &otherTime); assert(result); immutable otherDateTime = DateTime(otherTime.wYear, otherTime.wMonth, otherTime.wDay, otherTime.wHour, otherTime.wMinute, otherTime.wSecond); immutable diff = utcDateTime - otherDateTime; immutable minutes = diff.total!"minutes" - tzInfo.Bias; if(minutes == tzInfo.DaylightBias) return true; assert(minutes == tzInfo.StandardBias); return false; } catch(Exception e) assert(0, "DateTime's constructor threw."); } version(testStdDateTime) unittest { TIME_ZONE_INFORMATION tzInfo; GetTimeZoneInformation(&tzInfo); foreach(year; [1600, 1601, 30_827, 30_828]) WindowsTimeZone._dstInEffect(&tzInfo, SysTime(DateTime(year, 1, 1)).stdTime); } static long _utcToTZ(const TIME_ZONE_INFORMATION* tzInfo, long stdTime, bool hasDST) nothrow { if(hasDST && WindowsTimeZone._dstInEffect(tzInfo, stdTime)) return stdTime - convert!("minutes", "hnsecs")(tzInfo.Bias + tzInfo.DaylightBias); return stdTime - convert!("minutes", "hnsecs")(tzInfo.Bias + tzInfo.StandardBias); } static long _tzToUTC(const TIME_ZONE_INFORMATION* tzInfo, long adjTime, bool hasDST) nothrow { if(hasDST) { try { bool dstInEffectForLocalDateTime(DateTime localDateTime) { //The limits of what SystemTimeToTzSpecificLocalTime will accept. if(localDateTime.year < 1601) { if(localDateTime.month == Month.feb && localDateTime.day == 29) localDateTime.day = 28; localDateTime.year = 1601; } else if(localDateTime.year > 30_827) { if(localDateTime.month == Month.feb && localDateTime.day == 29) localDateTime.day = 28; localDateTime.year = 30_827; } //SystemTimeToTzSpecificLocalTime doesn't act correctly at the //beginning or end of the year (bleh). Unless some bizarre time //zone changes DST on January 1st or December 31st, this should //fix the problem. if(localDateTime.month == Month.jan) { if(localDateTime.day == 1) localDateTime.day = 2; } else if(localDateTime.month == Month.dec && localDateTime.day == 31) localDateTime.day = 30; SYSTEMTIME utcTime = void; SYSTEMTIME localTime = void; localTime.wYear = localDateTime.year; localTime.wMonth = localDateTime.month; localTime.wDay = localDateTime.day; localTime.wHour = localDateTime.hour; localTime.wMinute = localDateTime.minute; localTime.wSecond = localDateTime.second; localTime.wMilliseconds = 0; immutable result = TzSpecificLocalTimeToSystemTime(cast(TIME_ZONE_INFORMATION*)tzInfo, &localTime, &utcTime); assert(result); immutable utcDateTime = DateTime(utcTime.wYear, utcTime.wMonth, utcTime.wDay, utcTime.wHour, utcTime.wMinute, utcTime.wSecond); immutable diff = localDateTime - utcDateTime; immutable minutes = -tzInfo.Bias - diff.total!"minutes"; if(minutes == tzInfo.DaylightBias) return true; assert(minutes == tzInfo.StandardBias); return false; } auto localDateTime = cast(DateTime)SysTime(adjTime, UTC()); auto localDateTimeBefore = localDateTime - dur!"hours"(1); auto localDateTimeAfter = localDateTime + dur!"hours"(1); auto dstInEffectNow = dstInEffectForLocalDateTime(localDateTime); auto dstInEffectBefore = dstInEffectForLocalDateTime(localDateTimeBefore); auto dstInEffectAfter = dstInEffectForLocalDateTime(localDateTimeAfter); bool isDST; if(dstInEffectBefore && dstInEffectNow && dstInEffectAfter) isDST = true; else if(!dstInEffectBefore && !dstInEffectNow && !dstInEffectAfter) isDST = false; else if(!dstInEffectBefore && dstInEffectAfter) isDST = false; else if(dstInEffectBefore && !dstInEffectAfter) isDST = dstInEffectNow; else assert(0, "Bad Logic."); if(isDST) return adjTime + convert!("minutes", "hnsecs")(tzInfo.Bias + tzInfo.DaylightBias); } catch(Exception e) assert(0, "SysTime's constructor threw."); } return adjTime + convert!("minutes", "hnsecs")(tzInfo.Bias + tzInfo.StandardBias); } this(string name, TIME_ZONE_INFORMATION tzInfo) immutable { //Cannot use to!string(wchar*), probably due to bug http://d.puremagic.com/issues/show_bug.cgi?id=5016 static string conv(wchar* wcstr) { wcstr[31] = '\0'; wstring retval; for(;; ++wcstr) { if(*wcstr == '\0') break; retval ~= *wcstr; } return to!string(retval); } //super(name, to!string(tzInfo.StandardName.ptr), to!string(tzInfo.DaylightName.ptr)); super(name, conv(tzInfo.StandardName.ptr), conv(tzInfo.DaylightName.ptr)); _tzInfo = tzInfo; } TIME_ZONE_INFORMATION _tzInfo; } } version(StdDdoc) { /++ $(BLUE This function is Posix-Only.) Sets the local time zone on Posix systems with the TZ Database name by setting the TZ environment variable. Unfortunately, there is no way to do it on Windows using the TZ Database name, so this function only exists on Posix systems. +/ void setTZEnvVar(string tzDatabaseName); /++ $(BLUE This function is Posix-Only.) Clears the TZ environment variable. +/ void clearTZEnvVar(); } else version(Posix) { void setTZEnvVar(string tzDatabaseName) nothrow { try { auto value = PosixTimeZone.defaultTZDatabaseDir ~ tzDatabaseName ~ "\0"; setenv("TZ", value.ptr, 1); tzset(); } catch(Exception e) assert(0, "The impossible happened. setenv or tzset threw."); } void clearTZEnvVar() nothrow { try { unsetenv("TZ"); tzset(); } catch(Exception e) assert(0, "The impossible happened. unsetenv or tzset threw."); } } /++ Converts the given TZ Database name to the corresponding Windows time zone name. Note that in a few cases, a TZ Dabatase name corresponds to two different Windows time zone names. So, while in most cases converting from one to the other and back again will result in the same time zone name started with, in a few case, it'll get a different name. Also, there are far more TZ Database names than Windows time zones, so some of the more exotic TZ Database names don't have corresponding Windows time zone names. See_Also: $(WEB unicode.org/repos/cldr-tmp/trunk/diff/supplemental/zone_tzid.html, Windows <-> TZ Database Name Conversion Table) Params: tzName = The TZ Database name to convert. Throws: $(D DateTimeException) if the given $(D_PARAM tzName) cannot be converted. +/ string tzDatabaseNameToWindowsTZName(string tzName) { switch(tzName) { //Most of these come from the link in the documentation, but a few have //been added because they were found in the Windows registry. case "Africa/Cairo": return "Egypt Standard Time"; case "Africa/Casablanca": return "Morocco Standard Time"; case "Africa/Johannesburg": return "South Africa Standard Time"; case "Africa/Lagos": return "W. Central Africa Standard Time"; case "Africa/Nairobi": return "E. Africa Standard Time"; case "Africa/Windhoek": return "Namibia Standard Time"; case "America/Anchorage": return "Alaskan Standard Time"; case "America/Asuncion": return "Paraguay Standard Time"; case "America/Bahia": return "Bahia Standard Time"; case "America/Bogota": return "SA Pacific Standard Time"; case "America/Buenos_Aires": return "Argentina Standard Time"; case "America/Caracas": return "Venezuela Standard Time"; case "America/Cayenne": return "SA Eastern Standard Time"; case "America/Chicago": return "Central Standard Time"; case "America/Chihuahua": return "Mountain Standard Time (Mexico)"; case "America/Cuiaba": return "Central Brazilian Standard Time"; case "America/Denver": return "Mountain Standard Time"; case "America/Godthab": return "Greenland Standard Time"; case "America/Guatemala": return "Central America Standard Time"; case "America/Halifax": return "Atlantic Standard Time"; case "America/La_Paz": return "SA Western Standard Time"; case "America/Los_Angeles": return "Pacific Standard Time"; case "America/Mexico_City": return "Central Standard Time (Mexico)"; case "America/Montevideo": return "Montevideo Standard Time"; case "America/New_York": return "Eastern Standard Time"; case "America/Phoenix": return "US Mountain Standard Time"; case "America/Regina": return "Canada Central Standard Time"; case "America/Santa_Isabel": return "Pacific Standard Time (Mexico)"; case "America/Santiago": return "Pacific SA Standard Time"; case "America/Sao_Paulo": return "E. South America Standard Time"; case "America/St_Johns": return "Newfoundland Standard Time"; case "Asia/Almaty": return "Central Asia Standard Time"; case "Asia/Amman": return "Jordan Standard Time"; case "Asia/Baghdad": return "Arabic Standard Time"; case "Asia/Baku": return "Azerbaijan Standard Time"; case "Asia/Bangkok": return "SE Asia Standard Time"; case "Asia/Beirut": return "Middle East Standard Time"; case "Asia/Calcutta": return "India Standard Time"; case "Asia/Colombo": return "Sri Lanka Standard Time"; case "Asia/Damascus": return "Syria Standard Time"; case "Asia/Dhaka": return "Bangladesh Standard Time"; case "Asia/Dubai": return "Arabian Standard Time"; case "Asia/Irkutsk": return "North Asia East Standard Time"; case "Asia/Jerusalem": return "Israel Standard Time"; case "Asia/Kabul": return "Afghanistan Standard Time"; case "Asia/Kamchatka": return "Kamchatka Standard Time"; case "Asia/Karachi": return "Pakistan Standard Time"; case "Asia/Katmandu": return "Nepal Standard Time"; case "Asia/Krasnoyarsk": return "North Asia Standard Time"; case "Asia/Magadan": return "Magadan Standard Time"; case "Asia/Novosibirsk": return "N. Central Asia Standard Time"; case "Asia/Rangoon": return "Myanmar Standard Time"; case "Asia/Riyadh": return "Arab Standard Time"; case "Asia/Seoul": return "Korea Standard Time"; case "Asia/Shanghai": return "China Standard Time"; case "Asia/Singapore": return "Singapore Standard Time"; case "Asia/Taipei": return "Taipei Standard Time"; case "Asia/Tashkent": return "West Asia Standard Time"; case "Asia/Tbilisi": return "Georgian Standard Time"; case "Asia/Tehran": return "Iran Standard Time"; case "Asia/Tokyo": return "Tokyo Standard Time"; case "Asia/Ulaanbaatar": return "Ulaanbaatar Standard Time"; case "Asia/Vladivostok": return "Vladivostok Standard Time"; case "Asia/Yakutsk": return "Yakutsk Standard Time"; case "Asia/Yekaterinburg": return "Ekaterinburg Standard Time"; case "Asia/Yerevan": return "Caucasus Standard Time"; case "Atlantic/Azores": return "Azores Standard Time"; case "Atlantic/Cape_Verde": return "Cape Verde Standard Time"; case "Atlantic/Reykjavik": return "Greenwich Standard Time"; case "Australia/Adelaide": return "Cen. Australia Standard Time"; case "Australia/Brisbane": return "E. Australia Standard Time"; case "Australia/Darwin": return "AUS Central Standard Time"; case "Australia/Hobart": return "Tasmania Standard Time"; case "Australia/Perth": return "W. Australia Standard Time"; case "Australia/Sydney": return "AUS Eastern Standard Time"; case "Etc/GMT-12": return "UTC+12"; case "Etc/GMT": return "UTC"; case "Etc/GMT+11": return "UTC-11"; case "Etc/GMT+12": return "Dateline Standard Time"; case "Etc/GMT+2": return "Mid-Atlantic Standard Time"; case "Etc/GMT+5": return "US Eastern Standard Time"; case "Europe/Berlin": return "W. Europe Standard Time"; case "Europe/Budapest": return "Central Europe Standard Time"; //This should probably be Turkey Standard Time, but GTB Standard Time //has been around longer and therefore will work on more systems. case "Europe/Istanbul": return "GTB Standard Time"; case "Europe/Kaliningrad": return "Kaliningrad Standard Time"; case "Europe/Kiev": return "FLE Standard Time"; case "Europe/London": return "GMT Standard Time"; case "Europe/Minsk": return "E. Europe Standard Time"; case "Europe/Moscow": return "Russian Standard Time"; case "Europe/Paris": return "Romance Standard Time"; case "Europe/Warsaw": return "Central European Standard Time"; case "Indian/Mauritius": return "Mauritius Standard Time"; case "Pacific/Apia": return "Samoa Standard Time"; case "Pacific/Auckland": return "New Zealand Standard Time"; case "Pacific/Fiji": return "Fiji Standard Time"; case "Pacific/Guadalcanal": return "Central Pacific Standard Time"; case "Pacific/Honolulu": return "Hawaiian Standard Time"; case "Pacific/Port_Moresby": return "West Pacific Standard Time"; case "Pacific/Tongatapu": return "Tonga Standard Time"; default: throw new DateTimeException(format("Could not find Windows time zone name for: %s.", tzName)); } } unittest { version(testStdDateTime) { version(Windows) { static void testTZSuccess(string tzName) { scope(failure) writefln("TZName which threw: %s", tzName); tzDatabaseNameToWindowsTZName(tzName); } auto timeZones = TimeZone.getInstalledTZNames(); foreach(tzname; timeZones) assertNotThrown!DateTimeException(testTZSuccess(tzname)); } } } /++ Converts the given Windows time zone name to a corresponding TZ Database name. See_Also: $(WEB unicode.org/repos/cldr-tmp/trunk/diff/supplemental/zone_tzid.html, Windows <-> TZ Database Name Conversion Table) Params: tzName = The TZ Database name to convert. Throws: $(D DateTimeException) if the given $(D_PARAM tzName) cannot be converted. +/ string windowsTZNameToTZDatabaseName(string tzName) { switch(tzName) { //Most of these come from the link in the documentation, but a few have //been added because they were found in the Windows registry. case "AUS Central Standard Time": return "Australia/Darwin"; case "AUS Eastern Standard Time": return "Australia/Sydney"; case "Afghanistan Standard Time": return "Asia/Kabul"; case "Alaskan Standard Time": return "America/Anchorage"; case "Arab Standard Time": return "Asia/Riyadh"; case "Arabian Standard Time": return "Asia/Dubai"; case "Arabic Standard Time": return "Asia/Baghdad"; case "Argentina Standard Time": return "America/Buenos_Aires"; case "Armenian Standard Time": return "Asia/Yerevan"; case "Atlantic Standard Time": return "America/Halifax"; case "Azerbaijan Standard Time": return "Asia/Baku"; case "Azores Standard Time": return "Atlantic/Azores"; case "Bahia Standard Time": return "America/Bahia"; case "Bangladesh Standard Time": return "Asia/Dhaka"; case "Canada Central Standard Time": return "America/Regina"; case "Cape Verde Standard Time": return "Atlantic/Cape_Verde"; case "Caucasus Standard Time": return "Asia/Yerevan"; case "Cen. Australia Standard Time": return "Australia/Adelaide"; case "Central America Standard Time": return "America/Guatemala"; case "Central Asia Standard Time": return "Asia/Almaty"; case "Central Brazilian Standard Time": return "America/Cuiaba"; case "Central Europe Standard Time": return "Europe/Budapest"; case "Central European Standard Time": return "Europe/Warsaw"; case "Central Pacific Standard Time": return "Pacific/Guadalcanal"; case "Central Standard Time": return "America/Chicago"; case "Central Standard Time (Mexico)": return "America/Mexico_City"; case "China Standard Time": return "Asia/Shanghai"; case "Dateline Standard Time": return "Etc/GMT+12"; case "E. Africa Standard Time": return "Africa/Nairobi"; case "E. Australia Standard Time": return "Australia/Brisbane"; case "E. Europe Standard Time": return "Europe/Minsk"; case "E. South America Standard Time": return "America/Sao_Paulo"; case "Eastern Standard Time": return "America/New_York"; case "Egypt Standard Time": return "Africa/Cairo"; case "Ekaterinburg Standard Time": return "Asia/Yekaterinburg"; case "FLE Standard Time": return "Europe/Kiev"; case "Fiji Standard Time": return "Pacific/Fiji"; case "GMT Standard Time": return "Europe/London"; case "GTB Standard Time": return "Europe/Istanbul"; case "Georgian Standard Time": return "Asia/Tbilisi"; case "Greenland Standard Time": return "America/Godthab"; case "Greenwich Standard Time": return "Atlantic/Reykjavik"; case "Hawaiian Standard Time": return "Pacific/Honolulu"; case "India Standard Time": return "Asia/Calcutta"; case "Iran Standard Time": return "Asia/Tehran"; case "Israel Standard Time": return "Asia/Jerusalem"; case "Jordan Standard Time": return "Asia/Amman"; case "Kaliningrad Standard Time": return "Europe/Kaliningrad"; case "Kamchatka Standard Time": return "Asia/Kamchatka"; case "Korea Standard Time": return "Asia/Seoul"; case "Magadan Standard Time": return "Asia/Magadan"; case "Mauritius Standard Time": return "Indian/Mauritius"; case "Mexico Standard Time": return "America/Mexico_City"; case "Mexico Standard Time 2": return "America/Chihuahua"; case "Mid-Atlantic Standard Time": return "Etc/GMT+2"; case "Middle East Standard Time": return "Asia/Beirut"; case "Montevideo Standard Time": return "America/Montevideo"; case "Morocco Standard Time": return "Africa/Casablanca"; case "Mountain Standard Time": return "America/Denver"; case "Mountain Standard Time (Mexico)": return "America/Chihuahua"; case "Myanmar Standard Time": return "Asia/Rangoon"; case "N. Central Asia Standard Time": return "Asia/Novosibirsk"; case "Namibia Standard Time": return "Africa/Windhoek"; case "Nepal Standard Time": return "Asia/Katmandu"; case "New Zealand Standard Time": return "Pacific/Auckland"; case "Newfoundland Standard Time": return "America/St_Johns"; case "North Asia East Standard Time": return "Asia/Irkutsk"; case "North Asia Standard Time": return "Asia/Krasnoyarsk"; case "Pacific SA Standard Time": return "America/Santiago"; case "Pacific Standard Time": return "America/Los_Angeles"; case "Pacific Standard Time (Mexico)": return "America/Santa_Isabel"; case "Pakistan Standard Time": return "Asia/Karachi"; case "Paraguay Standard Time": return "America/Asuncion"; case "Romance Standard Time": return "Europe/Paris"; case "Russian Standard Time": return "Europe/Moscow"; case "SA Eastern Standard Time": return "America/Cayenne"; case "SA Pacific Standard Time": return "America/Bogota"; case "SA Western Standard Time": return "America/La_Paz"; case "SE Asia Standard Time": return "Asia/Bangkok"; case "Samoa Standard Time": return "Pacific/Apia"; case "Singapore Standard Time": return "Asia/Singapore"; case "South Africa Standard Time": return "Africa/Johannesburg"; case "Sri Lanka Standard Time": return "Asia/Colombo"; case "Syria Standard Time": return "Asia/Damascus"; case "Taipei Standard Time": return "Asia/Taipei"; case "Tasmania Standard Time": return "Australia/Hobart"; case "Tokyo Standard Time": return "Asia/Tokyo"; case "Tonga Standard Time": return "Pacific/Tongatapu"; case "Turkey Standard Time": return "Europe/Istanbul"; case "US Eastern Standard Time": return "Etc/GMT+5"; case "US Mountain Standard Time": return "America/Phoenix"; case "UTC": return "Etc/GMT"; case "UTC+12": return "Etc/GMT-12"; case "UTC-02": return "Etc/GMT+2"; case "UTC-11": return "Etc/GMT+11"; case "Ulaanbaatar Standard Time": return "Asia/Ulaanbaatar"; case "Venezuela Standard Time": return "America/Caracas"; case "Vladivostok Standard Time": return "Asia/Vladivostok"; case "W. Australia Standard Time": return "Australia/Perth"; case "W. Central Africa Standard Time": return "Africa/Lagos"; case "W. Europe Standard Time": return "Europe/Berlin"; case "West Asia Standard Time": return "Asia/Tashkent"; case "West Pacific Standard Time": return "Pacific/Port_Moresby"; case "Yakutsk Standard Time": return "Asia/Yakutsk"; default: throw new DateTimeException(format("Could not find TZ Database name for: %s.", tzName)); } } unittest { version(testStdDateTime) { version(Windows) { static void testTZSuccess(string tzName) { scope(failure) writefln("TZName which threw: %s", tzName); windowsTZNameToTZDatabaseName(tzName); } auto timeZones = WindowsTimeZone.getInstalledTZNames(); foreach(tzname; timeZones) assertNotThrown!DateTimeException(testTZSuccess(tzname)); } } } //============================================================================== // Section with StopWatch and Benchmark Code. //============================================================================== /++ $(D StopWatch) measures time as precisely as possible. This class uses a high-performance counter. On Windows systems, it uses $(D QueryPerformanceCounter), and on Posix systems, it uses $(D clock_gettime) if available, and $(D gettimeofday) otherwise. But the precision of $(D StopWatch) differs from system to system. It is impossible to for it to be the same from system to system since the precision of the system clock varies from system to system, and other system-dependent and situation-dependent stuff (such as the overhead of a context switch between threads) can also affect $(D StopWatch)'s accuracy. Examples: -------------------- void foo() { StopWatch sw; enum n = 100; TickDuration[n] times; TickDuration last = TickDuration.from!"seconds"(0); foreach(i; 0..n) { sw.start(); //start/resume mesuring. foreach(unused; 0..1_000_000) bar(); sw.stop(); //stop/pause measuring. //Return value of peek() after having stopped are the always same. writeln((i + 1) * 1_000_000, " times done, lap time: ", sw.peek().msecs, "[ms]"); times[i] = sw.peek() - last; last = sw.peek(); } real sum = 0; // To know the number of seconds, // use properties of TickDuration. // (seconds, msecs, usecs, hnsecs) foreach(t; times) sum += t.hnsecs; writeln("Average time: ", sum/n, " hnsecs"); } -------------------- +/ @safe struct StopWatch { public: //Verify Example @safe unittest { void writeln(S...)(S args){} static void bar() {} StopWatch sw; enum n = 100; TickDuration[n] times; TickDuration last = TickDuration.from!"seconds"(0); foreach(i; 0..n) { sw.start(); //start/resume mesuring. foreach(unused; 0..1_000_000) bar(); sw.stop(); //stop/pause measuring. //Return value of peek() after having stopped are the always same. writeln((i + 1) * 1_000_000, " times done, lap time: ", sw.peek().msecs, "[ms]"); times[i] = sw.peek() - last; last = sw.peek(); } real sum = 0; // To get the number of seconds, // use properties of TickDuration. // (seconds, msecs, usecs, hnsecs) foreach(t; times) sum += t.hnsecs; writeln("Average time: ", sum/n, " hnsecs"); } /++ Auto start with constructor. +/ this(AutoStart autostart) { if(autostart) start(); } version(testStdDateTime) @safe unittest { auto sw = StopWatch(AutoStart.yes); sw.stop(); } /// bool opEquals(const StopWatch rhs) const pure nothrow { return opEquals(rhs); } /// ditto bool opEquals(const ref StopWatch rhs) const pure nothrow { return _timeStart == rhs._timeStart && _timeMeasured == rhs._timeMeasured; } /++ Resets the stop watch. +/ void reset() { if(_flagStarted) { // Set current system time if StopWatch is measuring. _timeStart = Clock.currSystemTick; } else { // Set zero if StopWatch is not measuring. _timeStart.length = 0; } _timeMeasured.length = 0; } version(testStdDateTime) @safe unittest { StopWatch sw; sw.start(); sw.stop(); sw.reset(); assert(sw.peek().to!("seconds", real)() == 0); } /++ Starts the stop watch. +/ void start() { assert(!_flagStarted); _flagStarted = true; _timeStart = Clock.currSystemTick; } version(testStdDateTime) @trusted unittest { StopWatch sw; sw.start(); auto t1 = sw.peek(); bool doublestart = true; try sw.start(); catch(AssertError e) doublestart = false; assert(!doublestart); sw.stop(); assert((t1 - sw.peek()).to!("seconds", real)() <= 0); } /++ Stops the stop watch. +/ void stop() { assert(_flagStarted); _flagStarted = false; _timeMeasured += Clock.currSystemTick - _timeStart; } version(testStdDateTime) @trusted unittest { StopWatch sw; sw.start(); sw.stop(); auto t1 = sw.peek(); bool doublestop = true; try sw.stop(); catch(AssertError e) doublestop = false; assert(!doublestop); assert((t1 - sw.peek()).to!("seconds", real)() == 0); } /++ Peek at the amount of time which has passed since the stop watch was started. +/ TickDuration peek() const { if(_flagStarted) return Clock.currSystemTick - _timeStart + _timeMeasured; return _timeMeasured; } version(testStdDateTime) @safe unittest { StopWatch sw; sw.start(); auto t1 = sw.peek(); sw.stop(); auto t2 = sw.peek(); auto t3 = sw.peek(); assert(t1 <= t2); assert(t2 == t3); } /++ Set the amount of time which has been measured since the stop watch was started. +/ void setMeasured(TickDuration d) { reset(); _timeMeasured = d; } version(testStdDateTime) @safe unittest { StopWatch sw; TickDuration t0; t0.length = 100; sw.setMeasured(t0); auto t1 = sw.peek(); assert(t0 == t1); } /++ Confirm whether this stopwatch is measuring time. +/ bool running() @property const pure nothrow { return _flagStarted; } version(testStdDateTime) @safe unittest { StopWatch sw1; assert(!sw1.running); sw1.start(); assert(sw1.running); sw1.stop(); assert(!sw1.running); StopWatch sw2 = AutoStart.yes; assert(sw2.running); sw2.stop(); assert(!sw2.running); sw2.start(); assert(sw2.running); } private: // true if observing. bool _flagStarted = false; // TickDuration at the time of StopWatch starting measurement. TickDuration _timeStart; // Total time that StopWatch ran. TickDuration _timeMeasured; } // workaround for bug4886 @safe size_t lengthof(aliases...)() pure nothrow { return aliases.length; } /++ Benchmarks code for speed assessment and comparison. Params: fun = aliases of callable objects (e.g. function names). Each should take no arguments. n = The number of times each function is to be executed. Returns: The amount of time (as a $(CXREF time, TickDuration)) that it took to call each function $(D n) times. The first value is the length of time that it took to call $(D fun[0]) $(D n) times. The second value is the length of time it took to call $(D fun[1]) $(D n) times. Etc. Examples: -------------------- int a; void f0() {} void f1() {auto b = a;} void f2() {auto b = to!(string)(a);} auto r = benchmark!(f0, f1, f2)(10_000); writefln("Milliseconds to call fun[0] n times: %s", r[0].to!("msecs", int)); -------------------- +/ TickDuration[lengthof!(fun)()] benchmark(fun...)(uint n) { TickDuration[lengthof!(fun)()] result; StopWatch sw; sw.start(); foreach(i, unused; fun) { sw.reset(); foreach(j; 0 .. n) fun[i](); result[i] = sw.peek(); } return result; } //Verify Examples. version(testStdDateTime) unittest { void writefln(S...)(S args){} int a; void f0() {} void f1() {auto b = a;} void f2() {auto b = to!(string)(a);} auto r = benchmark!(f0, f1, f2)(10_000); writefln("Milliseconds to call fun[0] n times: %s", r[0].to!("msecs", int)()); } version(testStdDateTime) @safe unittest { int a; void f0() {} //void f1() {auto b = to!(string)(a);} void f2() {auto b = (a);} auto r = benchmark!(f0, f2)(100); } /++ Return value of benchmark with two functions comparing. +/ @safe struct ComparingBenchmarkResult { /++ Evaluation value This returns the evaluation value of performance as the ratio of baseFunc's time over targetFunc's time. If performance is high, this returns a high value. +/ @property real point() const pure nothrow { return _baseTime.length / cast(const real)_targetTime.length; } /++ The time required of the base function +/ @property public TickDuration baseTime() const pure nothrow { return _baseTime; } /++ The time required of the target function +/ @property public TickDuration targetTime() const pure nothrow { return _targetTime; } private: this(TickDuration baseTime, TickDuration targetTime) pure nothrow { _baseTime = baseTime; _targetTime = targetTime; } TickDuration _baseTime; TickDuration _targetTime; } /++ Benchmark with two functions comparing. Params: baseFunc = The function to become the base of the speed. targetFunc = The function that wants to measure speed. times = The number of times each function is to be executed. Examples: -------------------- void f1() { // ... } void f2() { // ... } void main() { auto b = comparingBenchmark!(f1, f2, 0x80); writeln(b.point); } -------------------- +/ ComparingBenchmarkResult comparingBenchmark(alias baseFunc, alias targetFunc, int times = 0xfff)() { auto t = benchmark!(baseFunc, targetFunc)(times); return ComparingBenchmarkResult(t[0], t[1]); } version(testStdDateTime) @safe unittest { void f1x() {} void f2x() {} @safe void f1o() {} @safe void f2o() {} auto b1 = comparingBenchmark!(f1o, f2o, 1)(); // OK //static auto b2 = comparingBenchmark!(f1x, f2x, 1); // NG } version(testStdDateTime) unittest { void f1x() {} void f2x() {} @safe void f1o() {} @safe void f2o() {} auto b1 = comparingBenchmark!(f1o, f2o, 1)(); // OK auto b2 = comparingBenchmark!(f1x, f2x, 1)(); // OK } //Bug# 8450 version(testStdDateTime) unittest { @safe void safeFunc() {} @trusted void trustFunc() {} @system void sysFunc() {} auto safeResult = comparingBenchmark!((){safeFunc();}, (){safeFunc();})(); auto trustResult = comparingBenchmark!((){trustFunc();}, (){trustFunc();})(); auto sysResult = comparingBenchmark!((){sysFunc();}, (){sysFunc();})(); auto mixedResult1 = comparingBenchmark!((){safeFunc();}, (){trustFunc();})(); auto mixedResult2 = comparingBenchmark!((){trustFunc();}, (){sysFunc();})(); auto mixedResult3 = comparingBenchmark!((){safeFunc();}, (){sysFunc();})(); } //============================================================================== // Section with public helper functions and templates. //============================================================================== /++ Whether the given type defines all of the necessary functions for it to function as a time point. +/ template isTimePoint(T) { enum isTimePoint = hasMin!T && hasMax!T && hasOverloadedOpBinaryWithDuration!T && hasOverloadedOpAssignWithDuration!T && hasOverloadedOpBinaryWithSelf!T; } unittest { version(testStdDateTime) { static assert(isTimePoint!(Date)); static assert(isTimePoint!(DateTime)); static assert(isTimePoint!(TimeOfDay)); static assert(isTimePoint!(SysTime)); static assert(isTimePoint!(const Date)); static assert(isTimePoint!(const DateTime)); static assert(isTimePoint!(const TimeOfDay)); static assert(isTimePoint!(const SysTime)); static assert(isTimePoint!(immutable Date)); static assert(isTimePoint!(immutable DateTime)); static assert(isTimePoint!(immutable TimeOfDay)); static assert(isTimePoint!(immutable SysTime)); } } /++ Whether the given Gregorian Year is a leap year. Params: year = The year to to be tested. +/ static bool yearIsLeapYear(int year) pure nothrow { if(year % 400 == 0) return true; if(year % 100 == 0) return false; return year % 4 == 0; } version(testStdDateTime) unittest { foreach(year; [1, 2, 3, 5, 6, 7, 100, 200, 300, 500, 600, 700, 1998, 1999, 2001, 2002, 2003, 2005, 2006, 2007, 2009, 2010, 2011]) { assert(!yearIsLeapYear(year), format("year: %s.", year)); assert(!yearIsLeapYear(-year), format("year: %s.", year)); } foreach(year; [0, 4, 8, 400, 800, 1600, 1996, 2000, 2004, 2008, 2012]) { assert(yearIsLeapYear(year), format("year: %s.", year)); assert(yearIsLeapYear(-year), format("year: %s.", year)); } } /++ Converts a $(D time_t) (which uses midnight, January 1st, 1970 UTC as its epoch and seconds as its units) to std time (which uses midnight, January 1st, 1 A.D. UTC and hnsecs as its units). Params: unixTime = The $(D time_t) to convert. +/ long unixTimeToStdTime(time_t unixTime) pure nothrow { return 621_355_968_000_000_000L + convert!("seconds", "hnsecs")(unixTime); } unittest { version(testStdDateTime) { _assertPred!"=="(unixTimeToStdTime(0), 621_355_968_000_000_000L); //Midnight, January 1st, 1970 _assertPred!"=="(unixTimeToStdTime(86_400), 621_355_968_000_000_000L + 864_000_000_000L); //Midnight, January 2nd, 1970 _assertPred!"=="(unixTimeToStdTime(-86_400), 621_355_968_000_000_000L - 864_000_000_000L); //Midnight, December 31st, 1969 _assertPred!"=="(unixTimeToStdTime(0), (Date(1970, 1, 1) - Date(1, 1, 1)).total!"hnsecs"); _assertPred!"=="(unixTimeToStdTime(0), (DateTime(1970, 1, 1) - DateTime(1, 1, 1)).total!"hnsecs"); } } /++ Converts std time (which uses midnight, January 1st, 1 A.D. UTC as its epoch and hnsecs as its units) to $(D time_t) (which uses midnight, January 1st, 1970 UTC as its epoch and seconds as its units). If $(D time_t) is 32 bits, rather than 64, and the result can't fit in a 32-bit value, then the closest value that can be held in 32 bits will be used (so $(D time_t.max) if it goes over and $(D time_t.min) if it goes under). Note: While Windows systems require that $(D time_t) be non-negative (in spite of $(D time_t) being signed), this function still returns negative numbers on Windows, since it's more flexible to allow negative time_t for those who need it. If on Windows and using the standard C functions or Win32 API functions which take a $(D time_t), check whether the return value of $(D stdTimeToUnixTime) is non-negative. Params: stdTime = The std time to convert. +/ time_t stdTimeToUnixTime(long stdTime) pure nothrow { immutable unixTime = convert!("hnsecs", "seconds")(stdTime - 621_355_968_000_000_000L); static if(time_t.sizeof >= long.sizeof) return cast(time_t)unixTime; else { if(unixTime > 0) { if(unixTime > time_t.max) return time_t.max; return cast(time_t)unixTime; } if(unixTime < time_t.min) return time_t.min; return cast(time_t)unixTime; } } unittest { version(testStdDateTime) { _assertPred!"=="(stdTimeToUnixTime(621_355_968_000_000_000L), 0); //Midnight, January 1st, 1970 _assertPred!"=="(stdTimeToUnixTime(621_355_968_000_000_000L + 864_000_000_000L), 86_400); //Midnight, January 2nd, 1970 _assertPred!"=="(stdTimeToUnixTime(621_355_968_000_000_000L - 864_000_000_000L), -86_400); //Midnight, December 31st, 1969 _assertPred!"=="(stdTimeToUnixTime((Date(1970, 1, 1) - Date(1, 1, 1)).total!"hnsecs"), 0); _assertPred!"=="(stdTimeToUnixTime((DateTime(1970, 1, 1) - DateTime(1, 1, 1)).total!"hnsecs"), 0); } } version(StdDdoc) { version(Windows) {} else { alias void* SYSTEMTIME; alias void* FILETIME; } /++ $(BLUE This function is Windows-Only.) Converts a $(D SYSTEMTIME) struct to a $(D SysTime). Params: st = The $(D SYSTEMTIME) struct to convert. tz = The time zone that the time in the $(D SYSTEMTIME) struct is assumed to be (if the $(D SYSTEMTIME) was supplied by a Windows system call, the $(D SYSTEMTIME) will either be in local time or UTC, depending on the call). Throws: $(D DateTimeException) if the given $(D SYSTEMTIME) will not fit in a $(D SysTime), which is highly unlikely to happen given that $(D SysTime.max) is in 29,228 A.D. and the maximum $(D SYSTEMTIME) is in 30,827 A.D. +/ SysTime SYSTEMTIMEToSysTime(const SYSTEMTIME* st, immutable TimeZone tz = LocalTime()); /++ $(BLUE This function is Windows-Only.) Converts a $(D SysTime) to a $(D SYSTEMTIME) struct. The $(D SYSTEMTIME) which is returned will be set using the given $(D SysTime)'s time zone, so to get the $(D SYSTEMTIME) in UTC, set the $(D SysTime)'s time zone to UTC. Params: sysTime = The $(D SysTime) to convert. Throws: $(D DateTimeException) if the given $(D SysTime) will not fit in a $(D SYSTEMTIME). This will only happen if the $(D SysTime)'s date is prior to 1601 A.D. +/ SYSTEMTIME SysTimeToSYSTEMTIME(in SysTime sysTime); /++ $(BLUE This function is Windows-Only.) Converts a $(D FILETIME) struct to the number of hnsecs since midnight, January 1st, 1 A.D. Params: ft = The $(D FILETIME) struct to convert. Throws: $(D DateTimeException) if the given $(D FILETIME) cannot be represented as the return value. +/ long FILETIMEToStdTime(const FILETIME* ft); /++ $(BLUE This function is Windows-Only.) Converts a $(D FILETIME) struct to a $(D SysTime). Params: ft = The $(D FILETIME) struct to convert. tz = The time zone that the $(D SysTime) will be in ($(D FILETIME)s are in UTC). Throws: $(D DateTimeException) if the given $(D FILETIME) will not fit in a $(D SysTime). +/ SysTime FILETIMEToSysTime(const FILETIME* ft, immutable TimeZone tz = LocalTime()); /++ $(BLUE This function is Windows-Only.) Converts a number of hnsecs since midnight, January 1st, 1 A.D. to a $(D FILETIME) struct. Params: sysTime = The $(D SysTime) to convert. Throws: $(D DateTimeException) if the given value will not fit in a $(D FILETIME). +/ FILETIME stdTimeToFILETIME(long stdTime); /++ $(BLUE This function is Windows-Only.) Converts a $(D SysTime) to a $(D FILETIME) struct. $(D FILETIME)s are always in UTC. Params: sysTime = The $(D SysTime) to convert. Throws: $(D DateTimeException) if the given $(D SysTime) will not fit in a $(D FILETIME). +/ FILETIME SysTimeToFILETIME(SysTime sysTime); } else version(Windows) { SysTime SYSTEMTIMEToSysTime(const SYSTEMTIME* st, immutable TimeZone tz = LocalTime()) { const max = SysTime.max; static void throwLaterThanMax() { throw new DateTimeException("The given SYSTEMTIME is for a date greater than SysTime.max."); } if(st.wYear > max.year) throwLaterThanMax(); else if(st.wYear == max.year) { if(st.wMonth > max.month) throwLaterThanMax(); else if(st.wMonth == max.month) { if(st.wDay > max.day) throwLaterThanMax(); else if(st.wDay == max.day) { if(st.wHour > max.hour) throwLaterThanMax(); else if(st.wHour == max.hour) { if(st.wMinute > max.minute) throwLaterThanMax(); else if(st.wMinute == max.minute) { if(st.wSecond > max.second) throwLaterThanMax(); else if(st.wSecond == max.second) { if(st.wMilliseconds > max.fracSec.msecs) throwLaterThanMax(); } } } } } } auto dt = DateTime(st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); return SysTime(dt, FracSec.from!"msecs"(st.wMilliseconds), tz); } unittest { version(testStdDateTime) { auto sysTime = Clock.currTime(UTC()); SYSTEMTIME st = void; GetSystemTime(&st); auto converted = SYSTEMTIMEToSysTime(&st, UTC()); _assertPred!"<="(abs((converted - sysTime)), dur!"seconds"(2)); } } SYSTEMTIME SysTimeToSYSTEMTIME(in SysTime sysTime) { immutable dt = cast(DateTime)sysTime; if(dt.year < 1601) throw new DateTimeException("SYSTEMTIME cannot hold dates prior to the year 1601."); SYSTEMTIME st; st.wYear = dt.year; st.wMonth = dt.month; st.wDayOfWeek = dt.dayOfWeek; st.wDay = dt.day; st.wHour = dt.hour; st.wMinute = dt.minute; st.wSecond = dt.second; st.wMilliseconds = cast(ushort)sysTime.fracSec.msecs; return st; } unittest { version(testStdDateTime) { SYSTEMTIME st = void; GetSystemTime(&st); auto sysTime = SYSTEMTIMEToSysTime(&st, UTC()); SYSTEMTIME result = SysTimeToSYSTEMTIME(sysTime); _assertPred!"=="(st.wYear, result.wYear); _assertPred!"=="(st.wMonth, result.wMonth); _assertPred!"=="(st.wDayOfWeek, result.wDayOfWeek); _assertPred!"=="(st.wDay, result.wDay); _assertPred!"=="(st.wHour, result.wHour); _assertPred!"=="(st.wMinute, result.wMinute); _assertPred!"=="(st.wSecond, result.wSecond); _assertPred!"=="(st.wMilliseconds, result.wMilliseconds); } } private enum hnsecsFrom1601 = 504_911_232_000_000_000L; long FILETIMEToStdTime(const FILETIME* ft) { ULARGE_INTEGER ul; ul.HighPart = ft.dwHighDateTime; ul.LowPart = ft.dwLowDateTime; ulong tempHNSecs = ul.QuadPart; if(tempHNSecs > long.max - hnsecsFrom1601) throw new DateTimeException("The given FILETIME cannot be represented as a stdTime value."); return cast(long)tempHNSecs + hnsecsFrom1601; } SysTime FILETIMEToSysTime(const FILETIME* ft, immutable TimeZone tz = LocalTime()) { auto sysTime = SysTime(FILETIMEToStdTime(ft), UTC()); sysTime.timezone = tz; return sysTime; } unittest { version(testStdDateTime) { auto sysTime = Clock.currTime(UTC()); SYSTEMTIME st = void; GetSystemTime(&st); FILETIME ft = void; SystemTimeToFileTime(&st, &ft); auto converted = FILETIMEToSysTime(&ft); _assertPred!"<="(abs((converted - sysTime)), dur!"seconds"(2)); } } FILETIME stdTimeToFILETIME(long stdTime) { if(stdTime < hnsecsFrom1601) throw new DateTimeException("The given stdTime value cannot be represented as a FILETIME."); ULARGE_INTEGER ul; ul.QuadPart = cast(ulong)stdTime - hnsecsFrom1601; FILETIME ft; ft.dwHighDateTime = ul.HighPart; ft.dwLowDateTime = ul.LowPart; return ft; } FILETIME SysTimeToFILETIME(SysTime sysTime) { return stdTimeToFILETIME(sysTime.stdTime); } unittest { version(testStdDateTime) { SYSTEMTIME st = void; GetSystemTime(&st); FILETIME ft = void; SystemTimeToFileTime(&st, &ft); auto sysTime = FILETIMEToSysTime(&ft, UTC()); FILETIME result = SysTimeToFILETIME(sysTime); _assertPred!"=="(ft.dwLowDateTime, result.dwLowDateTime); _assertPred!"=="(ft.dwHighDateTime, result.dwHighDateTime); } } } /++ Type representing the DOS file date/time format. +/ alias uint DosFileTime; /++ Converts from DOS file date/time to $(D SysTime). Params: dft = The DOS file time to convert. tz = The time zone which the DOS file time is assumed to be in. Throws: $(D DateTimeException) if the $(D DosFileTime) is invalid. +/ SysTime DosFileTimeToSysTime(DosFileTime dft, immutable TimeZone tz = LocalTime()) { uint dt = cast(uint)dft; if(dt == 0) throw new DateTimeException("Invalid DosFileTime."); int year = ((dt >> 25) & 0x7F) + 1980; int month = ((dt >> 21) & 0x0F); // 1..12 int dayOfMonth = ((dt >> 16) & 0x1F); // 1..31 int hour = (dt >> 11) & 0x1F; // 0..23 int minute = (dt >> 5) & 0x3F; // 0..59 int second = (dt << 1) & 0x3E; // 0..58 (in 2 second increments) SysTime sysTime = void; try return SysTime(DateTime(year, month, dayOfMonth, hour, minute, second), tz); catch(DateTimeException dte) throw new DateTimeException("Invalid DosFileTime", __FILE__, __LINE__, dte); } unittest { version(testStdDateTime) { _assertPred!"=="(DosFileTimeToSysTime(0b00000000001000010000000000000000), SysTime(DateTime(1980, 1, 1, 0, 0, 0))); _assertPred!"=="(DosFileTimeToSysTime(0b11111111100111111011111101111101), SysTime(DateTime(2107, 12, 31, 23, 59, 58))); _assertPred!"=="(DosFileTimeToSysTime(0x3E3F8456), SysTime(DateTime(2011, 1, 31, 16, 34, 44))); } } /++ Converts from $(D SysTime) to DOS file date/time. Params: sysTime = The $(D SysTime) to convert. Throws: $(D DateTimeException) if the given $(D SysTime) cannot be converted to a $(D DosFileTime). +/ DosFileTime SysTimeToDosFileTime(SysTime sysTime) { auto dateTime = cast(DateTime)sysTime; if(dateTime.year < 1980) throw new DateTimeException("DOS File Times cannot hold dates prior to 1980."); if(dateTime.year > 2107) throw new DateTimeException("DOS File Times cannot hold dates passed 2107."); uint retval = 0; retval = (dateTime.year - 1980) << 25; retval |= (dateTime.month & 0x0F) << 21; retval |= (dateTime.day & 0x1F) << 16; retval |= (dateTime.hour & 0x1F) << 11; retval |= (dateTime.minute & 0x3F) << 5; retval |= (dateTime.second >> 1) & 0x1F; return cast(DosFileTime)retval; } unittest { version(testStdDateTime) { _assertPred!"=="(SysTimeToDosFileTime(SysTime(DateTime(1980, 1, 1, 0, 0, 0))), 0b00000000001000010000000000000000); _assertPred!"=="(SysTimeToDosFileTime(SysTime(DateTime(2107, 12, 31, 23, 59, 58))), 0b11111111100111111011111101111101); _assertPred!"=="(SysTimeToDosFileTime(SysTime(DateTime(2011, 1, 31, 16, 34, 44))), 0x3E3F8456); } } /++ Whether all of the given strings are valid units of time. $(D "nsecs") is not considered a valid unit of time. Nothing in std.datetime can handle precision greater than hnsecs, and the few functions in core.time which deal with "nsecs" deal with it explicitly. +/ bool validTimeUnits(string[] units...) { foreach(str; units) { if(!canFind(timeStrings.dup, str)) return false; } return true; } /++ Compares two time unit strings. $(D "years") are the largest units and $(D "hnsecs") are the smallest. Returns: $(BOOKTABLE, $(TR $(TD this &lt; rhs) $(TD &lt; 0)) $(TR $(TD this == rhs) $(TD 0)) $(TR $(TD this &gt; rhs) $(TD &gt; 0)) ) Throws: $(D DateTimeException) if either of the given strings is not a valid time unit string. +/ int cmpTimeUnits(string lhs, string rhs) { auto tstrings = timeStrings.dup; immutable indexOfLHS = countUntil(tstrings, lhs); immutable indexOfRHS = countUntil(tstrings, rhs); enforce(indexOfLHS != -1, format("%s is not a valid TimeString", lhs)); enforce(indexOfRHS != -1, format("%s is not a valid TimeString", rhs)); if(indexOfLHS < indexOfRHS) return -1; if(indexOfLHS > indexOfRHS) return 1; return 0; } unittest { version(testStdDateTime) { foreach(i, outerUnits; timeStrings) { _assertPred!"=="(cmpTimeUnits(outerUnits, outerUnits), 0); //For some reason, $ won't compile. foreach(innerUnits; timeStrings[i+1 .. timeStrings.length]) _assertPred!"=="(cmpTimeUnits(outerUnits, innerUnits), -1); } foreach(i, outerUnits; timeStrings) { foreach(innerUnits; timeStrings[0 .. i]) _assertPred!"=="(cmpTimeUnits(outerUnits, innerUnits), 1); } } } /++ Compares two time unit strings at compile time. $(D "years") are the largest units and $(D "hnsecs") are the smallest. This template is used instead of $(D cmpTimeUnits) because exceptions can't be thrown at compile time and $(D cmpTimeUnits) must enforce that the strings it's given are valid time unit strings. This template uses a template constraint instead. Returns: $(BOOKTABLE, $(TR $(TD this &lt; rhs) $(TD &lt; 0)) $(TR $(TD this == rhs) $(TD 0)) $(TR $(TD this &gt; rhs) $(TD &gt; 0)) ) +/ template CmpTimeUnits(string lhs, string rhs) if(validTimeUnits(lhs, rhs)) { enum CmpTimeUnits = cmpTimeUnitsCTFE(lhs, rhs); } /+ Helper function for $(D CmpTimeUnits). +/ private int cmpTimeUnitsCTFE(string lhs, string rhs) { auto tstrings = timeStrings.dup; immutable indexOfLHS = countUntil(tstrings, lhs); immutable indexOfRHS = countUntil(tstrings, rhs); if(indexOfLHS < indexOfRHS) return -1; if(indexOfLHS > indexOfRHS) return 1; return 0; } unittest { version(testStdDateTime) { static string genTest(size_t index) { auto currUnits = timeStrings[index]; auto test = `_assertPred!"=="(CmpTimeUnits!("` ~ currUnits ~ `", "` ~ currUnits ~ `"), 0); `; //For some reason, $ won't compile. foreach(units; timeStrings[index + 1 .. timeStrings.length]) test ~= `_assertPred!"=="(CmpTimeUnits!("` ~ currUnits ~ `", "` ~ units ~ `"), -1); `; foreach(units; timeStrings[0 .. index]) test ~= `_assertPred!"=="(CmpTimeUnits!("` ~ currUnits ~ `", "` ~ units ~ `"), 1); `; return test; } mixin(genTest(0)); mixin(genTest(1)); mixin(genTest(2)); mixin(genTest(3)); mixin(genTest(4)); mixin(genTest(5)); mixin(genTest(6)); mixin(genTest(7)); mixin(genTest(8)); mixin(genTest(9)); } } /++ Returns whether the given value is valid for the given unit type when in a time point. Naturally, a duration is not held to a particular range, but the values in a time point are (e.g. a month must be in the range of 1 - 12 inclusive). Params: units = The units of time to validate. value = The number to validate. Examples: -------------------- assert(valid!"hours"(12)); assert(!valid!"hours"(32)); assert(valid!"months"(12)); assert(!valid!"months"(13)); -------------------- +/ bool valid(string units)(int value) pure nothrow if(units == "months" || units == "hours" || units == "minutes" || units == "seconds") { static if(units == "months") return value >= Month.jan && value <= Month.dec; else static if(units == "hours") return value >= 0 && value <= TimeOfDay.maxHour; else static if(units == "minutes") return value >= 0 && value <= TimeOfDay.maxMinute; else static if(units == "seconds") return value >= 0 && value <= TimeOfDay.maxSecond; } unittest { version(testStdDateTime) { //Verify Examples. assert(valid!"hours"(12)); assert(!valid!"hours"(32)); assert(valid!"months"(12)); assert(!valid!"months"(13)); } } /++ Returns whether the given day is valid for the given year and month. Params: units = The units of time to validate. year = The year of the day to validate. month = The month of the day to validate. day = The day to validate. +/ bool valid(string units)(int year, int month, int day) pure nothrow if(units == "days") { return day > 0 && day <= maxDay(year, month); } /++ Params: units = The units of time to validate. value = The number to validate. file = The file that the $(D DateTimeException) will list if thrown. line = The line number that the $(D DateTimeException) will list if thrown. Throws: $(D DateTimeException) if $(D valid!units(value)) is false. +/ void enforceValid(string units)(int value, string file = __FILE__, size_t line = __LINE__) pure if(units == "months" || units == "hours" || units == "minutes" || units == "seconds") { static if(units == "months") { if(!valid!units(value)) throw new DateTimeException(numToString(value) ~ " is not a valid month of the year.", file, line); } else static if(units == "hours") { if(!valid!units(value)) throw new DateTimeException(numToString(value) ~ " is not a valid hour of the day.", file, line); } else static if(units == "minutes") { if(!valid!units(value)) throw new DateTimeException(numToString(value) ~ " is not a valid minute of an hour.", file, line); } else static if(units == "seconds") { if(!valid!units(value)) throw new DateTimeException(numToString(value) ~ " is not a valid second of a minute.", file, line); } } /++ Params: units = The units of time to validate. year = The year of the day to validate. month = The month of the day to validate. day = The day to validate. file = The file that the $(D DateTimeException) will list if thrown. line = The line number that the $(D DateTimeException) will list if thrown. Throws: $(D DateTimeException) if $(D valid!"days"(year, month, day)) is false. +/ void enforceValid(string units)(int year, Month month, int day, string file = __FILE__, size_t line = __LINE__) pure if(units == "days") { if(!valid!"days"(year, month, day)) { throw new DateTimeException(numToString(day) ~ " is not a valid day in " ~ monthToString(month) ~ " in " ~ numToString(year), file, line); } } /++ Returns the number of months from the current months of the year to the given month of the year. If they are the same, then the result is 0. Params: currMonth = The current month of the year. month = The month of the year to get the number of months to. +/ static int monthsToMonth(int currMonth, int month) pure { enforceValid!"months"(currMonth); enforceValid!"months"(month); if(currMonth == month) return 0; if(currMonth < month) return month - currMonth; return (Month.dec - currMonth) + month; } unittest { version(testStdDateTime) { _assertPred!"=="(monthsToMonth(Month.jan, Month.jan), 0); _assertPred!"=="(monthsToMonth(Month.jan, Month.feb), 1); _assertPred!"=="(monthsToMonth(Month.jan, Month.mar), 2); _assertPred!"=="(monthsToMonth(Month.jan, Month.apr), 3); _assertPred!"=="(monthsToMonth(Month.jan, Month.may), 4); _assertPred!"=="(monthsToMonth(Month.jan, Month.jun), 5); _assertPred!"=="(monthsToMonth(Month.jan, Month.jul), 6); _assertPred!"=="(monthsToMonth(Month.jan, Month.aug), 7); _assertPred!"=="(monthsToMonth(Month.jan, Month.sep), 8); _assertPred!"=="(monthsToMonth(Month.jan, Month.oct), 9); _assertPred!"=="(monthsToMonth(Month.jan, Month.nov), 10); _assertPred!"=="(monthsToMonth(Month.jan, Month.dec), 11); _assertPred!"=="(monthsToMonth(Month.may, Month.jan), 8); _assertPred!"=="(monthsToMonth(Month.may, Month.feb), 9); _assertPred!"=="(monthsToMonth(Month.may, Month.mar), 10); _assertPred!"=="(monthsToMonth(Month.may, Month.apr), 11); _assertPred!"=="(monthsToMonth(Month.may, Month.may), 0); _assertPred!"=="(monthsToMonth(Month.may, Month.jun), 1); _assertPred!"=="(monthsToMonth(Month.may, Month.jul), 2); _assertPred!"=="(monthsToMonth(Month.may, Month.aug), 3); _assertPred!"=="(monthsToMonth(Month.may, Month.sep), 4); _assertPred!"=="(monthsToMonth(Month.may, Month.oct), 5); _assertPred!"=="(monthsToMonth(Month.may, Month.nov), 6); _assertPred!"=="(monthsToMonth(Month.may, Month.dec), 7); _assertPred!"=="(monthsToMonth(Month.oct, Month.jan), 3); _assertPred!"=="(monthsToMonth(Month.oct, Month.feb), 4); _assertPred!"=="(monthsToMonth(Month.oct, Month.mar), 5); _assertPred!"=="(monthsToMonth(Month.oct, Month.apr), 6); _assertPred!"=="(monthsToMonth(Month.oct, Month.may), 7); _assertPred!"=="(monthsToMonth(Month.oct, Month.jun), 8); _assertPred!"=="(monthsToMonth(Month.oct, Month.jul), 9); _assertPred!"=="(monthsToMonth(Month.oct, Month.aug), 10); _assertPred!"=="(monthsToMonth(Month.oct, Month.sep), 11); _assertPred!"=="(monthsToMonth(Month.oct, Month.oct), 0); _assertPred!"=="(monthsToMonth(Month.oct, Month.nov), 1); _assertPred!"=="(monthsToMonth(Month.oct, Month.dec), 2); _assertPred!"=="(monthsToMonth(Month.dec, Month.jan), 1); _assertPred!"=="(monthsToMonth(Month.dec, Month.feb), 2); _assertPred!"=="(monthsToMonth(Month.dec, Month.mar), 3); _assertPred!"=="(monthsToMonth(Month.dec, Month.apr), 4); _assertPred!"=="(monthsToMonth(Month.dec, Month.may), 5); _assertPred!"=="(monthsToMonth(Month.dec, Month.jun), 6); _assertPred!"=="(monthsToMonth(Month.dec, Month.jul), 7); _assertPred!"=="(monthsToMonth(Month.dec, Month.aug), 8); _assertPred!"=="(monthsToMonth(Month.dec, Month.sep), 9); _assertPred!"=="(monthsToMonth(Month.dec, Month.oct), 10); _assertPred!"=="(monthsToMonth(Month.dec, Month.nov), 11); _assertPred!"=="(monthsToMonth(Month.dec, Month.dec), 0); } } /++ Returns the number of days from the current day of the week to the given day of the week. If they are the same, then the result is 0. Params: currDoW = The current day of the week. dow = The day of the week to get the number of days to. +/ static int daysToDayOfWeek(DayOfWeek currDoW, DayOfWeek dow) pure nothrow { if(currDoW == dow) return 0; if(currDoW < dow) return dow - currDoW; return (DayOfWeek.sat - currDoW) + dow + 1; } unittest { version(testStdDateTime) { _assertPred!"=="(daysToDayOfWeek(DayOfWeek.sun, DayOfWeek.sun), 0); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.sun, DayOfWeek.mon), 1); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.sun, DayOfWeek.tue), 2); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.sun, DayOfWeek.wed), 3); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.sun, DayOfWeek.thu), 4); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.sun, DayOfWeek.fri), 5); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.sun, DayOfWeek.sat), 6); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.mon, DayOfWeek.sun), 6); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.mon, DayOfWeek.mon), 0); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.mon, DayOfWeek.tue), 1); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.mon, DayOfWeek.wed), 2); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.mon, DayOfWeek.thu), 3); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.mon, DayOfWeek.fri), 4); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.mon, DayOfWeek.sat), 5); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.tue, DayOfWeek.sun), 5); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.tue, DayOfWeek.mon), 6); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.tue, DayOfWeek.tue), 0); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.tue, DayOfWeek.wed), 1); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.tue, DayOfWeek.thu), 2); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.tue, DayOfWeek.fri), 3); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.tue, DayOfWeek.sat), 4); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.wed, DayOfWeek.sun), 4); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.wed, DayOfWeek.mon), 5); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.wed, DayOfWeek.tue), 6); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.wed, DayOfWeek.wed), 0); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.wed, DayOfWeek.thu), 1); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.wed, DayOfWeek.fri), 2); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.wed, DayOfWeek.sat), 3); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.thu, DayOfWeek.sun), 3); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.thu, DayOfWeek.mon), 4); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.thu, DayOfWeek.tue), 5); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.thu, DayOfWeek.wed), 6); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.thu, DayOfWeek.thu), 0); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.thu, DayOfWeek.fri), 1); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.thu, DayOfWeek.sat), 2); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.fri, DayOfWeek.sun), 2); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.fri, DayOfWeek.mon), 3); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.fri, DayOfWeek.tue), 4); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.fri, DayOfWeek.wed), 5); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.fri, DayOfWeek.thu), 6); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.fri, DayOfWeek.fri), 0); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.fri, DayOfWeek.sat), 1); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.sat, DayOfWeek.sun), 1); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.sat, DayOfWeek.mon), 2); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.sat, DayOfWeek.tue), 3); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.sat, DayOfWeek.wed), 4); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.sat, DayOfWeek.thu), 5); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.sat, DayOfWeek.fri), 6); _assertPred!"=="(daysToDayOfWeek(DayOfWeek.sat, DayOfWeek.sat), 0); } } version(StdDdoc) { /++ Function for starting to a stop watch time when the function is called and stopping it when its return value goes out of scope and is destroyed. When the value that is returned by this function is destroyed, $(D func) will run. $(D func) is a unary function that takes a $(CXREF time, TickDuration). Examples: -------------------- writeln("benchmark start!"); { auto mt = measureTime!((a){assert(a.seconds);}); doSomething(); } writeln("benchmark end!"); -------------------- +/ auto measureTime(alias func)(); } else { @safe auto measureTime(alias func)() if(isSafe!((){StopWatch sw; unaryFun!func(sw.peek());})) { struct Result { private StopWatch _sw = void; this(AutoStart as) { _sw = StopWatch(as); } ~this() { unaryFun!(func)(_sw.peek()); } } return Result(AutoStart.yes); } auto measureTime(alias func)() if(!isSafe!((){StopWatch sw; unaryFun!func(sw.peek());})) { struct Result { private StopWatch _sw = void; this(AutoStart as) { _sw = StopWatch(as); } ~this() { unaryFun!(func)(_sw.peek()); } } return Result(AutoStart.yes); } } version(testStdDateTime) @safe unittest { @safe static void func(TickDuration td) { assert(td.to!("seconds", real)() <>= 0); } auto mt = measureTime!(func)(); /+ with (measureTime!((a){assert(a.seconds);})) { // doSomething(); // @@@BUG@@@ doesn't work yet. } +/ } version(testStdDateTime) unittest { static void func(TickDuration td) { assert(td.to!("seconds", real)() <>= 0); } auto mt = measureTime!(func)(); /+ with (measureTime!((a){assert(a.seconds);})) { // doSomething(); // @@@BUG@@@ doesn't work yet. } +/ } //Bug# 8450 version(testStdDateTime) unittest { @safe void safeFunc() {} @trusted void trustFunc() {} @system void sysFunc() {} auto safeResult = measureTime!((a){safeFunc();})(); auto trustResult = measureTime!((a){trustFunc();})(); auto sysResult = measureTime!((a){sysFunc();})(); } //============================================================================== // Private Section. //============================================================================== private: //============================================================================== // Section with private enums and constants. //============================================================================== enum daysInYear = 365; /// The number of days in a non-leap year. enum daysInLeapYear = 366; /// The numbef or days in a leap year. enum daysIn4Years = daysInYear * 3 + daysInLeapYear; /// Number of days in 4 years. enum daysIn100Years = daysIn4Years * 25 - 1; /// The number of days in 100 years. enum daysIn400Years = daysIn100Years * 4 + 1; /// The number of days in 400 years. //============================================================================== // Section with private helper functions and templates. //============================================================================== /+ Template to help with converting between time units. +/ template hnsecsPer(string units) if(CmpTimeUnits!(units, "months") < 0) { static if(units == "hnsecs") enum hnsecsPer = 1L; else static if(units == "usecs") enum hnsecsPer = 10L; else static if(units == "msecs") enum hnsecsPer = 1000 * hnsecsPer!"usecs"; else static if(units == "seconds") enum hnsecsPer = 1000 * hnsecsPer!"msecs"; else static if(units == "minutes") enum hnsecsPer = 60 * hnsecsPer!"seconds"; else static if(units == "hours") enum hnsecsPer = 60 * hnsecsPer!"minutes"; else static if(units == "days") enum hnsecsPer = 24 * hnsecsPer!"hours"; else static if(units == "weeks") enum hnsecsPer = 7 * hnsecsPer!"days"; } /+ Splits out a particular unit from hnsecs and gives the value for that unit and the remaining hnsecs. It really shouldn't be used unless unless all units larger than the given units have already been split out. Params: units = The units to split out. hnsecs = The current total hnsecs. Upon returning, it is the hnsecs left after splitting out the given units. Returns: The number of the given units from converting hnsecs to those units. Examples: -------------------- auto hnsecs = 2595000000007L; immutable days = splitUnitsFromHNSecs!"days"(hnsecs); assert(days == 3); assert(hnsecs == 3000000007); immutable minutes = splitUnitsFromHNSecs!"minutes"(hnsecs); assert(minutes == 5); assert(hnsecs == 7); -------------------- +/ long splitUnitsFromHNSecs(string units)(ref long hnsecs) pure nothrow if(validTimeUnits(units) && CmpTimeUnits!(units, "months") < 0) { immutable value = convert!("hnsecs", units)(hnsecs); hnsecs -= convert!(units, "hnsecs")(value); return value; } unittest { version(testStdDateTime) { //Verify Example. auto hnsecs = 2595000000007L; immutable days = splitUnitsFromHNSecs!"days"(hnsecs); assert(days == 3); assert(hnsecs == 3000000007); immutable minutes = splitUnitsFromHNSecs!"minutes"(hnsecs); assert(minutes == 5); assert(hnsecs == 7); } } /+ This function is used to split out the units without getting the remaining hnsecs. See_Also: $(LREF splitUnitsFromHNSecs) Params: units = The units to split out. hnsecs = The current total hnsecs. Returns: The split out value. Examples: -------------------- auto hnsecs = 2595000000007L; immutable days = getUnitsFromHNSecs!"days"(hnsecs); assert(days == 3); assert(hnsecs == 2595000000007L); -------------------- +/ long getUnitsFromHNSecs(string units)(long hnsecs) pure nothrow if(validTimeUnits(units) && CmpTimeUnits!(units, "months") < 0) { return convert!("hnsecs", units)(hnsecs); } unittest { version(testStdDateTime) { //Verify Example. auto hnsecs = 2595000000007L; immutable days = getUnitsFromHNSecs!"days"(hnsecs); assert(days == 3); assert(hnsecs == 2595000000007L); } } /+ This function is used to split out the units without getting the units but just the remaining hnsecs. See_Also: $(LREF splitUnitsFromHNSecs) Params: units = The units to split out. hnsecs = The current total hnsecs. Returns: The remaining hnsecs. Examples: -------------------- auto hnsecs = 2595000000007L; auto returned = removeUnitsFromHNSecs!"days"(hnsecs); assert(returned == 3000000007); assert(hnsecs == 2595000000007L); -------------------- +/ long removeUnitsFromHNSecs(string units)(long hnsecs) pure nothrow if(validTimeUnits(units) && CmpTimeUnits!(units, "months") < 0) { immutable value = convert!("hnsecs", units)(hnsecs); return hnsecs - convert!(units, "hnsecs")(value); } unittest { version(testStdDateTime) { //Verify Example. auto hnsecs = 2595000000007L; auto returned = removeUnitsFromHNSecs!"days"(hnsecs); assert(returned == 3000000007); assert(hnsecs == 2595000000007L); } } /+ The maximum valid Day in the given month in the given year. Params: year = The year to get the day for. month = The month of the Gregorian Calendar to get the day for. +/ static ubyte maxDay(int year, int month) pure nothrow in { assert(valid!"months"(month)); } body { switch(month) { case Month.jan, Month.mar, Month.may, Month.jul, Month.aug, Month.oct, Month.dec: return 31; case Month.feb: return yearIsLeapYear(year) ? 29 : 28; case Month.apr, Month.jun, Month.sep, Month.nov: return 30; default: assert(0, "Invalid month."); } } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(maxDay(1999, 1), 31); _assertPred!"=="(maxDay(1999, 2), 28); _assertPred!"=="(maxDay(1999, 3), 31); _assertPred!"=="(maxDay(1999, 4), 30); _assertPred!"=="(maxDay(1999, 5), 31); _assertPred!"=="(maxDay(1999, 6), 30); _assertPred!"=="(maxDay(1999, 7), 31); _assertPred!"=="(maxDay(1999, 8), 31); _assertPred!"=="(maxDay(1999, 9), 30); _assertPred!"=="(maxDay(1999, 10), 31); _assertPred!"=="(maxDay(1999, 11), 30); _assertPred!"=="(maxDay(1999, 12), 31); _assertPred!"=="(maxDay(2000, 1), 31); _assertPred!"=="(maxDay(2000, 2), 29); _assertPred!"=="(maxDay(2000, 3), 31); _assertPred!"=="(maxDay(2000, 4), 30); _assertPred!"=="(maxDay(2000, 5), 31); _assertPred!"=="(maxDay(2000, 6), 30); _assertPred!"=="(maxDay(2000, 7), 31); _assertPred!"=="(maxDay(2000, 8), 31); _assertPred!"=="(maxDay(2000, 9), 30); _assertPred!"=="(maxDay(2000, 10), 31); _assertPred!"=="(maxDay(2000, 11), 30); _assertPred!"=="(maxDay(2000, 12), 31); //Test B.C. _assertPred!"=="(maxDay(-1999, 1), 31); _assertPred!"=="(maxDay(-1999, 2), 28); _assertPred!"=="(maxDay(-1999, 3), 31); _assertPred!"=="(maxDay(-1999, 4), 30); _assertPred!"=="(maxDay(-1999, 5), 31); _assertPred!"=="(maxDay(-1999, 6), 30); _assertPred!"=="(maxDay(-1999, 7), 31); _assertPred!"=="(maxDay(-1999, 8), 31); _assertPred!"=="(maxDay(-1999, 9), 30); _assertPred!"=="(maxDay(-1999, 10), 31); _assertPred!"=="(maxDay(-1999, 11), 30); _assertPred!"=="(maxDay(-1999, 12), 31); _assertPred!"=="(maxDay(-2000, 1), 31); _assertPred!"=="(maxDay(-2000, 2), 29); _assertPred!"=="(maxDay(-2000, 3), 31); _assertPred!"=="(maxDay(-2000, 4), 30); _assertPred!"=="(maxDay(-2000, 5), 31); _assertPred!"=="(maxDay(-2000, 6), 30); _assertPred!"=="(maxDay(-2000, 7), 31); _assertPred!"=="(maxDay(-2000, 8), 31); _assertPred!"=="(maxDay(-2000, 9), 30); _assertPred!"=="(maxDay(-2000, 10), 31); _assertPred!"=="(maxDay(-2000, 11), 30); _assertPred!"=="(maxDay(-2000, 12), 31); } } /+ Returns the day of the week for the given day of the Gregorian Calendar. Params: day = The day of the Gregorian Calendar for which to get the day of the week. +/ DayOfWeek getDayOfWeek(int day) pure nothrow { //January 1st, 1 A.D. was a Monday if(day >= 0) return cast(DayOfWeek)(day % 7); else { immutable dow = cast(DayOfWeek)((day % 7) + 7); if(dow == 7) return DayOfWeek.sun; else return dow; } } unittest { version(testStdDateTime) { //Test A.D. _assertPred!"=="(getDayOfWeek(SysTime(Date(1, 1, 1)).dayOfGregorianCal), DayOfWeek.mon); _assertPred!"=="(getDayOfWeek(SysTime(Date(1, 1, 2)).dayOfGregorianCal), DayOfWeek.tue); _assertPred!"=="(getDayOfWeek(SysTime(Date(1, 1, 3)).dayOfGregorianCal), DayOfWeek.wed); _assertPred!"=="(getDayOfWeek(SysTime(Date(1, 1, 4)).dayOfGregorianCal), DayOfWeek.thu); _assertPred!"=="(getDayOfWeek(SysTime(Date(1, 1, 5)).dayOfGregorianCal), DayOfWeek.fri); _assertPred!"=="(getDayOfWeek(SysTime(Date(1, 1, 6)).dayOfGregorianCal), DayOfWeek.sat); _assertPred!"=="(getDayOfWeek(SysTime(Date(1, 1, 7)).dayOfGregorianCal), DayOfWeek.sun); _assertPred!"=="(getDayOfWeek(SysTime(Date(1, 1, 8)).dayOfGregorianCal), DayOfWeek.mon); _assertPred!"=="(getDayOfWeek(SysTime(Date(1, 1, 9)).dayOfGregorianCal), DayOfWeek.tue); _assertPred!"=="(getDayOfWeek(SysTime(Date(2, 1, 1)).dayOfGregorianCal), DayOfWeek.tue); _assertPred!"=="(getDayOfWeek(SysTime(Date(3, 1, 1)).dayOfGregorianCal), DayOfWeek.wed); _assertPred!"=="(getDayOfWeek(SysTime(Date(4, 1, 1)).dayOfGregorianCal), DayOfWeek.thu); _assertPred!"=="(getDayOfWeek(SysTime(Date(5, 1, 1)).dayOfGregorianCal), DayOfWeek.sat); _assertPred!"=="(getDayOfWeek(SysTime(Date(2000, 1, 1)).dayOfGregorianCal), DayOfWeek.sat); _assertPred!"=="(getDayOfWeek(SysTime(Date(2010, 8, 22)).dayOfGregorianCal), DayOfWeek.sun); _assertPred!"=="(getDayOfWeek(SysTime(Date(2010, 8, 23)).dayOfGregorianCal), DayOfWeek.mon); _assertPred!"=="(getDayOfWeek(SysTime(Date(2010, 8, 24)).dayOfGregorianCal), DayOfWeek.tue); _assertPred!"=="(getDayOfWeek(SysTime(Date(2010, 8, 25)).dayOfGregorianCal), DayOfWeek.wed); _assertPred!"=="(getDayOfWeek(SysTime(Date(2010, 8, 26)).dayOfGregorianCal), DayOfWeek.thu); _assertPred!"=="(getDayOfWeek(SysTime(Date(2010, 8, 27)).dayOfGregorianCal), DayOfWeek.fri); _assertPred!"=="(getDayOfWeek(SysTime(Date(2010, 8, 28)).dayOfGregorianCal), DayOfWeek.sat); _assertPred!"=="(getDayOfWeek(SysTime(Date(2010, 8, 29)).dayOfGregorianCal), DayOfWeek.sun); //Test B.C. _assertPred!"=="(getDayOfWeek(SysTime(Date(0, 12, 31)).dayOfGregorianCal), DayOfWeek.sun); _assertPred!"=="(getDayOfWeek(SysTime(Date(0, 12, 30)).dayOfGregorianCal), DayOfWeek.sat); _assertPred!"=="(getDayOfWeek(SysTime(Date(0, 12, 29)).dayOfGregorianCal), DayOfWeek.fri); _assertPred!"=="(getDayOfWeek(SysTime(Date(0, 12, 28)).dayOfGregorianCal), DayOfWeek.thu); _assertPred!"=="(getDayOfWeek(SysTime(Date(0, 12, 27)).dayOfGregorianCal), DayOfWeek.wed); _assertPred!"=="(getDayOfWeek(SysTime(Date(0, 12, 26)).dayOfGregorianCal), DayOfWeek.tue); _assertPred!"=="(getDayOfWeek(SysTime(Date(0, 12, 25)).dayOfGregorianCal), DayOfWeek.mon); _assertPred!"=="(getDayOfWeek(SysTime(Date(0, 12, 24)).dayOfGregorianCal), DayOfWeek.sun); _assertPred!"=="(getDayOfWeek(SysTime(Date(0, 12, 23)).dayOfGregorianCal), DayOfWeek.sat); } } /+ Returns the string representation of the given month. Params: useLongName = Whether the long or short version of the month name should be used. plural = Whether the string should be plural or not. Throws: $(D DateTimeException) if the given month is not a valid month. +/ string monthToString(Month month, bool useLongName = true) pure { if (month < Month.jan || month > Month.dec) { throw new DateTimeException("Invalid month: " ~ numToString(month)); } if(useLongName == true) { return longMonthNames[month - Month.jan]; } else { return shortMonthNames[month - Month.jan]; } } unittest { version(testStdDateTime) { static void testMTSInvalid(Month month, bool useLongName) { monthToString(month, useLongName); } assertThrown!DateTimeException(testMTSInvalid(cast(Month)0, true)); assertThrown!DateTimeException(testMTSInvalid(cast(Month)0, false)); assertThrown!DateTimeException(testMTSInvalid(cast(Month)13, true)); assertThrown!DateTimeException(testMTSInvalid(cast(Month)13, false)); _assertPred!"=="(monthToString(Month.jan), "January"); _assertPred!"=="(monthToString(Month.feb), "February"); _assertPred!"=="(monthToString(Month.mar), "March"); _assertPred!"=="(monthToString(Month.apr), "April"); _assertPred!"=="(monthToString(Month.may), "May"); _assertPred!"=="(monthToString(Month.jun), "June"); _assertPred!"=="(monthToString(Month.jul), "July"); _assertPred!"=="(monthToString(Month.aug), "August"); _assertPred!"=="(monthToString(Month.sep), "September"); _assertPred!"=="(monthToString(Month.oct), "October"); _assertPred!"=="(monthToString(Month.nov), "November"); _assertPred!"=="(monthToString(Month.dec), "December"); _assertPred!"=="(monthToString(Month.jan, false), "Jan"); _assertPred!"=="(monthToString(Month.feb, false), "Feb"); _assertPred!"=="(monthToString(Month.mar, false), "Mar"); _assertPred!"=="(monthToString(Month.apr, false), "Apr"); _assertPred!"=="(monthToString(Month.may, false), "May"); _assertPred!"=="(monthToString(Month.jun, false), "Jun"); _assertPred!"=="(monthToString(Month.jul, false), "Jul"); _assertPred!"=="(monthToString(Month.aug, false), "Aug"); _assertPred!"=="(monthToString(Month.sep, false), "Sep"); _assertPred!"=="(monthToString(Month.oct, false), "Oct"); _assertPred!"=="(monthToString(Month.nov, false), "Nov"); _assertPred!"=="(monthToString(Month.dec, false), "Dec"); } } /+ Returns the Month corresponding to the given string. Casing is ignored. Params: monthStr = The string representation of the month to get the Month for. Throws: $(D DateTimeException) if the given month is not a valid month string. +/ Month monthFromString(string monthStr) { switch(toLower(monthStr)) { case "january": case "jan": return Month.jan; case "february": case "feb": return Month.feb; case "march": case "mar": return Month.mar; case "april": case "apr": return Month.apr; case "may": return Month.may; case "june": case "jun": return Month.jun; case "july": case "jul": return Month.jul; case "august": case "aug": return Month.aug; case "september": case "sep": return Month.sep; case "october": case "oct": return Month.oct; case "november": case "nov": return Month.nov; case "december": case "dec": return Month.dec; default: throw new DateTimeException(format("Invalid month %s", monthStr)); } } unittest { version(testStdDateTime) { static void testMFSInvalid(string monthStr) { monthFromString(monthStr); } assertThrown!DateTimeException(testMFSInvalid("Ja")); assertThrown!DateTimeException(testMFSInvalid("Janu")); assertThrown!DateTimeException(testMFSInvalid("Januar")); assertThrown!DateTimeException(testMFSInvalid("Januarys")); assertThrown!DateTimeException(testMFSInvalid("JJanuary")); _assertPred!"=="(monthFromString(monthToString(Month.jan)), Month.jan); _assertPred!"=="(monthFromString(monthToString(Month.feb)), Month.feb); _assertPred!"=="(monthFromString(monthToString(Month.mar)), Month.mar); _assertPred!"=="(monthFromString(monthToString(Month.apr)), Month.apr); _assertPred!"=="(monthFromString(monthToString(Month.may)), Month.may); _assertPred!"=="(monthFromString(monthToString(Month.jun)), Month.jun); _assertPred!"=="(monthFromString(monthToString(Month.jul)), Month.jul); _assertPred!"=="(monthFromString(monthToString(Month.aug)), Month.aug); _assertPred!"=="(monthFromString(monthToString(Month.sep)), Month.sep); _assertPred!"=="(monthFromString(monthToString(Month.oct)), Month.oct); _assertPred!"=="(monthFromString(monthToString(Month.nov)), Month.nov); _assertPred!"=="(monthFromString(monthToString(Month.dec)), Month.dec); _assertPred!"=="(monthFromString(monthToString(Month.jan, false)), Month.jan); _assertPred!"=="(monthFromString(monthToString(Month.feb, false)), Month.feb); _assertPred!"=="(monthFromString(monthToString(Month.mar, false)), Month.mar); _assertPred!"=="(monthFromString(monthToString(Month.apr, false)), Month.apr); _assertPred!"=="(monthFromString(monthToString(Month.may, false)), Month.may); _assertPred!"=="(monthFromString(monthToString(Month.jun, false)), Month.jun); _assertPred!"=="(monthFromString(monthToString(Month.jul, false)), Month.jul); _assertPred!"=="(monthFromString(monthToString(Month.aug, false)), Month.aug); _assertPred!"=="(monthFromString(monthToString(Month.sep, false)), Month.sep); _assertPred!"=="(monthFromString(monthToString(Month.oct, false)), Month.oct); _assertPred!"=="(monthFromString(monthToString(Month.nov, false)), Month.nov); _assertPred!"=="(monthFromString(monthToString(Month.dec, false)), Month.dec); _assertPred!"=="(monthFromString("JANUARY"), Month.jan); _assertPred!"=="(monthFromString("JAN"), Month.jan); _assertPred!"=="(monthFromString("january"), Month.jan); _assertPred!"=="(monthFromString("jan"), Month.jan); _assertPred!"=="(monthFromString("jaNuary"), Month.jan); _assertPred!"=="(monthFromString("jaN"), Month.jan); _assertPred!"=="(monthFromString("jaNuaRy"), Month.jan); _assertPred!"=="(monthFromString("jAn"), Month.jan); } } /+ The time units which are one step smaller than the given units. Examples: -------------------- assert(nextSmallerTimeUnits!"years" == "months"); assert(nextSmallerTimeUnits!"usecs" == "hnsecs"); -------------------- +/ template nextSmallerTimeUnits(string units) if(validTimeUnits(units) && timeStrings.front != units) { enum nextSmallerTimeUnits = timeStrings[countUntil(timeStrings.dup, units) - 1]; } unittest { version(testStdDateTime) { _assertPred!"=="(nextSmallerTimeUnits!"months", "weeks"); _assertPred!"=="(nextSmallerTimeUnits!"weeks", "days"); _assertPred!"=="(nextSmallerTimeUnits!"days", "hours"); _assertPred!"=="(nextSmallerTimeUnits!"hours", "minutes"); _assertPred!"=="(nextSmallerTimeUnits!"minutes", "seconds"); _assertPred!"=="(nextSmallerTimeUnits!"seconds", "msecs"); _assertPred!"=="(nextSmallerTimeUnits!"msecs", "usecs"); static assert(!__traits(compiles, nextSmallerTimeUnits!"hnsecs")); //Verify Examples. assert(nextSmallerTimeUnits!"years" == "months"); assert(nextSmallerTimeUnits!"usecs" == "hnsecs"); } } /+ The time units which are one step larger than the given units. Examples: -------------------- assert(nextLargerTimeUnits!"months" == "years"); assert(nextLargerTimeUnits!"hnsecs" == "usecs"); -------------------- +/ template nextLargerTimeUnits(string units) if(validTimeUnits(units) && timeStrings.back != units) { enum nextLargerTimeUnits = timeStrings[countUntil(timeStrings.dup, units) + 1]; } unittest { version(testStdDateTime) { _assertPred!"=="(nextLargerTimeUnits!"usecs", "msecs"); _assertPred!"=="(nextLargerTimeUnits!"msecs", "seconds"); _assertPred!"=="(nextLargerTimeUnits!"seconds", "minutes"); _assertPred!"=="(nextLargerTimeUnits!"minutes", "hours"); _assertPred!"=="(nextLargerTimeUnits!"hours", "days"); _assertPred!"=="(nextLargerTimeUnits!"days", "weeks"); _assertPred!"=="(nextLargerTimeUnits!"weeks", "months"); static assert(!__traits(compiles, nextLargerTimeUnits!"years")); //Verify Examples. assert(nextLargerTimeUnits!"months" == "years"); assert(nextLargerTimeUnits!"hnsecs" == "usecs"); } } /+ Returns the given hnsecs as an ISO string of fractional seconds. +/ static string fracSecToISOString(int hnsecs) nothrow in { assert(hnsecs >= 0); } body { try { string isoString = format(".%07d", hnsecs); while(isoString.endsWith("0")) isoString.popBack(); if(isoString.length == 1) return ""; return isoString; } catch(Exception e) assert(0, "format() threw."); } unittest { version(testStdDateTime) { _assertPred!"=="(fracSecToISOString(0), ""); _assertPred!"=="(fracSecToISOString(1), ".0000001"); _assertPred!"=="(fracSecToISOString(10), ".000001"); _assertPred!"=="(fracSecToISOString(100), ".00001"); _assertPred!"=="(fracSecToISOString(1000), ".0001"); _assertPred!"=="(fracSecToISOString(10_000), ".001"); _assertPred!"=="(fracSecToISOString(100_000), ".01"); _assertPred!"=="(fracSecToISOString(1_000_000), ".1"); _assertPred!"=="(fracSecToISOString(1_000_001), ".1000001"); _assertPred!"=="(fracSecToISOString(1_001_001), ".1001001"); _assertPred!"=="(fracSecToISOString(1_071_601), ".1071601"); _assertPred!"=="(fracSecToISOString(1_271_641), ".1271641"); _assertPred!"=="(fracSecToISOString(9_999_999), ".9999999"); _assertPred!"=="(fracSecToISOString(9_999_990), ".999999"); _assertPred!"=="(fracSecToISOString(9_999_900), ".99999"); _assertPred!"=="(fracSecToISOString(9_999_000), ".9999"); _assertPred!"=="(fracSecToISOString(9_990_000), ".999"); _assertPred!"=="(fracSecToISOString(9_900_000), ".99"); _assertPred!"=="(fracSecToISOString(9_000_000), ".9"); _assertPred!"=="(fracSecToISOString(999), ".0000999"); _assertPred!"=="(fracSecToISOString(9990), ".000999"); _assertPred!"=="(fracSecToISOString(99_900), ".00999"); _assertPred!"=="(fracSecToISOString(999_000), ".0999"); } } /+ Returns a FracSec corresponding to to the given ISO string of fractional seconds. +/ static FracSec fracSecFromISOString(S)(in S isoString) if(isSomeString!S) { if(isoString.empty) return FracSec.from!"hnsecs"(0); auto dstr = to!dstring(isoString); enforce(dstr.startsWith("."), new DateTimeException("Invalid ISO String")); dstr.popFront(); enforce(!dstr.empty && dstr.length <= 7, new DateTimeException("Invalid ISO String")); enforce(!canFind!(not!isDigit)(dstr), new DateTimeException("Invalid ISO String")); dchar[7] fullISOString; foreach(i, ref dchar c; fullISOString) { if(i < dstr.length) c = dstr[i]; else c = '0'; } return FracSec.from!"hnsecs"(to!int(fullISOString[])); } unittest { version(testStdDateTime) { static void testFSInvalid(string isoString) { fracSecFromISOString(isoString); } assertThrown!DateTimeException(testFSInvalid(".")); assertThrown!DateTimeException(testFSInvalid("0.")); assertThrown!DateTimeException(testFSInvalid("0")); assertThrown!DateTimeException(testFSInvalid("0000000")); assertThrown!DateTimeException(testFSInvalid(".00000000")); assertThrown!DateTimeException(testFSInvalid(".00000001")); assertThrown!DateTimeException(testFSInvalid("T")); assertThrown!DateTimeException(testFSInvalid("T.")); assertThrown!DateTimeException(testFSInvalid(".T")); _assertPred!"=="(fracSecFromISOString(""), FracSec.from!"hnsecs"(0)); _assertPred!"=="(fracSecFromISOString(".0000001"), FracSec.from!"hnsecs"(1)); _assertPred!"=="(fracSecFromISOString(".000001"), FracSec.from!"hnsecs"(10)); _assertPred!"=="(fracSecFromISOString(".00001"), FracSec.from!"hnsecs"(100)); _assertPred!"=="(fracSecFromISOString(".0001"), FracSec.from!"hnsecs"(1000)); _assertPred!"=="(fracSecFromISOString(".001"), FracSec.from!"hnsecs"(10_000)); _assertPred!"=="(fracSecFromISOString(".01"), FracSec.from!"hnsecs"(100_000)); _assertPred!"=="(fracSecFromISOString(".1"), FracSec.from!"hnsecs"(1_000_000)); _assertPred!"=="(fracSecFromISOString(".1000001"), FracSec.from!"hnsecs"(1_000_001)); _assertPred!"=="(fracSecFromISOString(".1001001"), FracSec.from!"hnsecs"(1_001_001)); _assertPred!"=="(fracSecFromISOString(".1071601"), FracSec.from!"hnsecs"(1_071_601)); _assertPred!"=="(fracSecFromISOString(".1271641"), FracSec.from!"hnsecs"(1_271_641)); _assertPred!"=="(fracSecFromISOString(".9999999"), FracSec.from!"hnsecs"(9_999_999)); _assertPred!"=="(fracSecFromISOString(".9999990"), FracSec.from!"hnsecs"(9_999_990)); _assertPred!"=="(fracSecFromISOString(".999999"), FracSec.from!"hnsecs"(9_999_990)); _assertPred!"=="(fracSecFromISOString(".9999900"), FracSec.from!"hnsecs"(9_999_900)); _assertPred!"=="(fracSecFromISOString(".99999"), FracSec.from!"hnsecs"(9_999_900)); _assertPred!"=="(fracSecFromISOString(".9999000"), FracSec.from!"hnsecs"(9_999_000)); _assertPred!"=="(fracSecFromISOString(".9999"), FracSec.from!"hnsecs"(9_999_000)); _assertPred!"=="(fracSecFromISOString(".9990000"), FracSec.from!"hnsecs"(9_990_000)); _assertPred!"=="(fracSecFromISOString(".999"), FracSec.from!"hnsecs"(9_990_000)); _assertPred!"=="(fracSecFromISOString(".9900000"), FracSec.from!"hnsecs"(9_900_000)); _assertPred!"=="(fracSecFromISOString(".9900"), FracSec.from!"hnsecs"(9_900_000)); _assertPred!"=="(fracSecFromISOString(".99"), FracSec.from!"hnsecs"(9_900_000)); _assertPred!"=="(fracSecFromISOString(".9000000"), FracSec.from!"hnsecs"(9_000_000)); _assertPred!"=="(fracSecFromISOString(".9"), FracSec.from!"hnsecs"(9_000_000)); _assertPred!"=="(fracSecFromISOString(".0000999"), FracSec.from!"hnsecs"(999)); _assertPred!"=="(fracSecFromISOString(".0009990"), FracSec.from!"hnsecs"(9990)); _assertPred!"=="(fracSecFromISOString(".000999"), FracSec.from!"hnsecs"(9990)); _assertPred!"=="(fracSecFromISOString(".0099900"), FracSec.from!"hnsecs"(99_900)); _assertPred!"=="(fracSecFromISOString(".00999"), FracSec.from!"hnsecs"(99_900)); _assertPred!"=="(fracSecFromISOString(".0999000"), FracSec.from!"hnsecs"(999_000)); _assertPred!"=="(fracSecFromISOString(".0999"), FracSec.from!"hnsecs"(999_000)); } } /+ Whether the given type defines the static property min which returns the minimum value for the type. +/ template hasMin(T) { enum hasMin = __traits(hasMember, T, "min") && __traits(isStaticFunction, T.min) && is(ReturnType!(T.min) == Unqual!T) && (functionAttributes!(T.min) & FunctionAttribute.property) && (functionAttributes!(T.min) & FunctionAttribute.nothrow_); //(functionAttributes!(T.min) & FunctionAttribute.pure_); //Ideally this would be the case, but SysTime's min() can't currently be pure. } unittest { version(testStdDateTime) { static assert(hasMin!(Date)); static assert(hasMin!(TimeOfDay)); static assert(hasMin!(DateTime)); static assert(hasMin!(SysTime)); static assert(hasMin!(const Date)); static assert(hasMin!(const TimeOfDay)); static assert(hasMin!(const DateTime)); static assert(hasMin!(const SysTime)); static assert(hasMin!(immutable Date)); static assert(hasMin!(immutable TimeOfDay)); static assert(hasMin!(immutable SysTime)); } } /+ Whether the given type defines the static property max which returns the maximum value for the type. +/ template hasMax(T) { enum hasMax = __traits(hasMember, T, "max") && __traits(isStaticFunction, T.max) && is(ReturnType!(T.max) == Unqual!T) && (functionAttributes!(T.max) & FunctionAttribute.property) && (functionAttributes!(T.max) & FunctionAttribute.nothrow_); //(functionAttributes!(T.max) & FunctionAttribute.pure_); //Ideally this would be the case, but SysTime's max() can't currently be pure. } unittest { version(testStdDateTime) { static assert(hasMax!(Date)); static assert(hasMax!(TimeOfDay)); static assert(hasMax!(DateTime)); static assert(hasMax!(SysTime)); static assert(hasMax!(const Date)); static assert(hasMax!(const TimeOfDay)); static assert(hasMax!(const DateTime)); static assert(hasMax!(const SysTime)); static assert(hasMax!(immutable Date)); static assert(hasMax!(immutable TimeOfDay)); static assert(hasMax!(immutable DateTime)); static assert(hasMax!(immutable SysTime)); } } /+ Whether the given type defines the overloaded opBinary operators that a time point is supposed to define which work with time durations. Namely: $(BOOKTABLE, $(TR $(TD TimePoint opBinary"+"(duration))) $(TR $(TD TimePoint opBinary"-"(duration))) ) +/ template hasOverloadedOpBinaryWithDuration(T) { enum hasOverloadedOpBinaryWithDuration = __traits(compiles, T.init + dur!"days"(5)) && is(typeof(T.init + dur!"days"(5)) == Unqual!T) && __traits(compiles, T.init - dur!"days"(5)) && is(typeof(T.init - dur!"days"(5)) == Unqual!T) && __traits(compiles, T.init + TickDuration.from!"hnsecs"(5)) && is(typeof(T.init + TickDuration.from!"hnsecs"(5)) == Unqual!T) && __traits(compiles, T.init - TickDuration.from!"hnsecs"(5)) && is(typeof(T.init - TickDuration.from!"hnsecs"(5)) == Unqual!T); } unittest { version(testStdDateTime) { static assert(hasOverloadedOpBinaryWithDuration!(Date)); static assert(hasOverloadedOpBinaryWithDuration!(TimeOfDay)); static assert(hasOverloadedOpBinaryWithDuration!(DateTime)); static assert(hasOverloadedOpBinaryWithDuration!(SysTime)); static assert(hasOverloadedOpBinaryWithDuration!(const Date)); static assert(hasOverloadedOpBinaryWithDuration!(const TimeOfDay)); static assert(hasOverloadedOpBinaryWithDuration!(const DateTime)); static assert(hasOverloadedOpBinaryWithDuration!(const SysTime)); static assert(hasOverloadedOpBinaryWithDuration!(immutable Date)); static assert(hasOverloadedOpBinaryWithDuration!(immutable TimeOfDay)); static assert(hasOverloadedOpBinaryWithDuration!(immutable DateTime)); static assert(hasOverloadedOpBinaryWithDuration!(immutable SysTime)); } } /+ Whether the given type defines the overloaded opOpAssign operators that a time point is supposed to define. Namely: $(BOOKTABLE, $(TR $(TD TimePoint opOpAssign"+"(duration))) $(TR $(TD TimePoint opOpAssign"-"(duration))) ) +/ template hasOverloadedOpAssignWithDuration(T) { enum hasOverloadedOpAssignWithDuration = is(typeof( { auto d = dur!"days"(5); auto td = TickDuration.from!"hnsecs"(5); alias U = Unqual!T; static assert(is(typeof(U.init += d) == U)); static assert(is(typeof(U.init -= d) == U)); static assert(is(typeof(U.init += td) == U)); static assert(is(typeof(U.init -= td) == U)); })); } unittest { version(testStdDateTime) { static assert(hasOverloadedOpAssignWithDuration!(Date)); static assert(hasOverloadedOpAssignWithDuration!(TimeOfDay)); static assert(hasOverloadedOpAssignWithDuration!(DateTime)); static assert(hasOverloadedOpAssignWithDuration!(SysTime)); static assert(hasOverloadedOpAssignWithDuration!(const Date)); static assert(hasOverloadedOpAssignWithDuration!(const TimeOfDay)); static assert(hasOverloadedOpAssignWithDuration!(const DateTime)); static assert(hasOverloadedOpAssignWithDuration!(const SysTime)); static assert(hasOverloadedOpAssignWithDuration!(immutable Date)); static assert(hasOverloadedOpAssignWithDuration!(immutable TimeOfDay)); static assert(hasOverloadedOpAssignWithDuration!(immutable DateTime)); static assert(hasOverloadedOpAssignWithDuration!(immutable SysTime)); } } /+ Whether the given type defines the overloaded opBinary operator that a time point is supposed to define which works with itself. Namely: $(BOOKTABLE, $(TR $(TD duration opBinary"-"(Date))) ) +/ template hasOverloadedOpBinaryWithSelf(T) { enum hasOverloadedOpBinaryWithSelf = __traits(compiles, T.init - T.init) && is(Unqual!(typeof(T.init - T.init)) == Duration); } unittest { version(testStdDateTime) { static assert(hasOverloadedOpBinaryWithSelf!(Date)); static assert(hasOverloadedOpBinaryWithSelf!(TimeOfDay)); static assert(hasOverloadedOpBinaryWithSelf!(DateTime)); static assert(hasOverloadedOpBinaryWithSelf!(SysTime)); static assert(hasOverloadedOpBinaryWithSelf!(const Date)); static assert(hasOverloadedOpBinaryWithSelf!(const TimeOfDay)); static assert(hasOverloadedOpBinaryWithSelf!(const DateTime)); static assert(hasOverloadedOpBinaryWithSelf!(const SysTime)); static assert(hasOverloadedOpBinaryWithSelf!(immutable Date)); static assert(hasOverloadedOpBinaryWithSelf!(immutable TimeOfDay)); static assert(hasOverloadedOpBinaryWithSelf!(immutable DateTime)); static assert(hasOverloadedOpBinaryWithSelf!(immutable SysTime)); } } /+ Unfortunately, to!string() is not pure, so here's a way to convert a number to a string which is. Once to!string() is properly pure (like it hopefully will be at some point), this function should be removed in favor of using to!string(). +/ string numToString(long value) pure nothrow { try { immutable negative = value < 0; char[25] str; size_t i = str.length; if(negative) value = -value; while(1) { char digit = cast(char)('0' + value % 10); value /= 10; str[--i] = digit; assert(i > 0); if(value == 0) break; } if(negative) return "-" ~ str[i .. $].idup; else return str[i .. $].idup; } catch(Exception e) assert(0, "Something threw when nothing can throw."); } version(unittest) { //Variables to help in testing. Duration currLocalDiffFromUTC; immutable (TimeZone)[] testTZs; //All of these helper arrays are sorted in ascending order. auto testYearsBC = [-1999, -1200, -600, -4, -1, 0]; auto testYearsAD = [1, 4, 1000, 1999, 2000, 2012]; //I'd use a Tuple, but I get forward reference errors if I try. struct MonthDay { Month month; short day; this(int m, short d) { month = cast(Month)m; day = d; } } MonthDay[] testMonthDays = [MonthDay(1, 1), MonthDay(1, 2), MonthDay(3, 17), MonthDay(7, 4), MonthDay(10, 27), MonthDay(12, 30), MonthDay(12, 31)]; auto testDays = [1, 2, 9, 10, 16, 20, 25, 28, 29, 30, 31]; auto testTODs = [TimeOfDay(0, 0, 0), TimeOfDay(0, 0, 1), TimeOfDay(0, 1, 0), TimeOfDay(1, 0, 0), TimeOfDay(13, 13, 13), TimeOfDay(23, 59, 59)]; auto testHours = [0, 1, 12, 22, 23]; auto testMinSecs = [0, 1, 30, 58, 59]; //Throwing exceptions is incredibly expensive, so we want to use a smaller //set of values for tests using assertThrown. auto testTODsThrown = [TimeOfDay(0, 0, 0), TimeOfDay(13, 13, 13), TimeOfDay(23, 59, 59)]; Date[] testDatesBC; Date[] testDatesAD; DateTime[] testDateTimesBC; DateTime[] testDateTimesAD; FracSec[] testFracSecs; SysTime[] testSysTimesBC; SysTime[] testSysTimesAD; //I'd use a Tuple, but I get forward reference errors if I try. struct GregDay { int day; Date date; } auto testGregDaysBC = [GregDay(-1_373_427, Date(-3760, 9, 7)), //Start of the Hebrew Calendar GregDay(-735_233, Date(-2012, 1, 1)), GregDay(-735_202, Date(-2012, 2, 1)), GregDay(-735_175, Date(-2012, 2, 28)), GregDay(-735_174, Date(-2012, 2, 29)), GregDay(-735_173, Date(-2012, 3, 1)), GregDay(-734_502, Date(-2010, 1, 1)), GregDay(-734_472, Date(-2010, 1, 31)), GregDay(-734_471, Date(-2010, 2, 1)), GregDay(-734_444, Date(-2010, 2, 28)), GregDay(-734_443, Date(-2010, 3, 1)), GregDay(-734_413, Date(-2010, 3, 31)), GregDay(-734_412, Date(-2010, 4, 1)), GregDay(-734_383, Date(-2010, 4, 30)), GregDay(-734_382, Date(-2010, 5, 1)), GregDay(-734_352, Date(-2010, 5, 31)), GregDay(-734_351, Date(-2010, 6, 1)), GregDay(-734_322, Date(-2010, 6, 30)), GregDay(-734_321, Date(-2010, 7, 1)), GregDay(-734_291, Date(-2010, 7, 31)), GregDay(-734_290, Date(-2010, 8, 1)), GregDay(-734_260, Date(-2010, 8, 31)), GregDay(-734_259, Date(-2010, 9, 1)), GregDay(-734_230, Date(-2010, 9, 30)), GregDay(-734_229, Date(-2010, 10, 1)), GregDay(-734_199, Date(-2010, 10, 31)), GregDay(-734_198, Date(-2010, 11, 1)), GregDay(-734_169, Date(-2010, 11, 30)), GregDay(-734_168, Date(-2010, 12, 1)), GregDay(-734_139, Date(-2010, 12, 30)), GregDay(-734_138, Date(-2010, 12, 31)), GregDay(-731_215, Date(-2001, 1, 1)), GregDay(-730_850, Date(-2000, 1, 1)), GregDay(-730_849, Date(-2000, 1, 2)), GregDay(-730_486, Date(-2000, 12, 30)), GregDay(-730_485, Date(-2000, 12, 31)), GregDay(-730_484, Date(-1999, 1, 1)), GregDay(-694_690, Date(-1901, 1, 1)), GregDay(-694_325, Date(-1900, 1, 1)), GregDay(-585_118, Date(-1601, 1, 1)), GregDay(-584_753, Date(-1600, 1, 1)), GregDay(-584_388, Date(-1600, 12, 31)), GregDay(-584_387, Date(-1599, 1, 1)), GregDay(-365_972, Date(-1001, 1, 1)), GregDay(-365_607, Date(-1000, 1, 1)), GregDay(-183_351, Date(-501, 1, 1)), GregDay(-182_986, Date(-500, 1, 1)), GregDay(-182_621, Date(-499, 1, 1)), GregDay(-146_827, Date(-401, 1, 1)), GregDay(-146_462, Date(-400, 1, 1)), GregDay(-146_097, Date(-400, 12, 31)), GregDay(-110_302, Date(-301, 1, 1)), GregDay(-109_937, Date(-300, 1, 1)), GregDay(-73_778, Date(-201, 1, 1)), GregDay(-73_413, Date(-200, 1, 1)), GregDay(-38_715, Date(-105, 1, 1)), GregDay(-37_254, Date(-101, 1, 1)), GregDay(-36_889, Date(-100, 1, 1)), GregDay(-36_524, Date(-99, 1, 1)), GregDay(-36_160, Date(-99, 12, 31)), GregDay(-35_794, Date(-97, 1, 1)), GregDay(-18_627, Date(-50, 1, 1)), GregDay(-18_262, Date(-49, 1, 1)), GregDay(-3652, Date(-9, 1, 1)), GregDay(-2191, Date(-5, 1, 1)), GregDay(-1827, Date(-5, 12, 31)), GregDay(-1826, Date(-4, 1, 1)), GregDay(-1825, Date(-4, 1, 2)), GregDay(-1462, Date(-4, 12, 30)), GregDay(-1461, Date(-4, 12, 31)), GregDay(-1460, Date(-3, 1, 1)), GregDay(-1096, Date(-3, 12, 31)), GregDay(-1095, Date(-2, 1, 1)), GregDay(-731, Date(-2, 12, 31)), GregDay(-730, Date(-1, 1, 1)), GregDay(-367, Date(-1, 12, 30)), GregDay(-366, Date(-1, 12, 31)), GregDay(-365, Date(0, 1, 1)), GregDay(-31, Date(0, 11, 30)), GregDay(-30, Date(0, 12, 1)), GregDay(-1, Date(0, 12, 30)), GregDay(0, Date(0, 12, 31))]; auto testGregDaysAD = [GregDay(1, Date(1, 1, 1)), GregDay(2, Date(1, 1, 2)), GregDay(32, Date(1, 2, 1)), GregDay(365, Date(1, 12, 31)), GregDay(366, Date(2, 1, 1)), GregDay(731, Date(3, 1, 1)), GregDay(1096, Date(4, 1, 1)), GregDay(1097, Date(4, 1, 2)), GregDay(1460, Date(4, 12, 30)), GregDay(1461, Date(4, 12, 31)), GregDay(1462, Date(5, 1, 1)), GregDay(17_898, Date(50, 1, 1)), GregDay(35_065, Date(97, 1, 1)), GregDay(36_160, Date(100, 1, 1)), GregDay(36_525, Date(101, 1, 1)), GregDay(37_986, Date(105, 1, 1)), GregDay(72_684, Date(200, 1, 1)), GregDay(73_049, Date(201, 1, 1)), GregDay(109_208, Date(300, 1, 1)), GregDay(109_573, Date(301, 1, 1)), GregDay(145_732, Date(400, 1, 1)), GregDay(146_098, Date(401, 1, 1)), GregDay(182_257, Date(500, 1, 1)), GregDay(182_622, Date(501, 1, 1)), GregDay(364_878, Date(1000, 1, 1)), GregDay(365_243, Date(1001, 1, 1)), GregDay(584_023, Date(1600, 1, 1)), GregDay(584_389, Date(1601, 1, 1)), GregDay(693_596, Date(1900, 1, 1)), GregDay(693_961, Date(1901, 1, 1)), GregDay(729_755, Date(1999, 1, 1)), GregDay(730_120, Date(2000, 1, 1)), GregDay(730_121, Date(2000, 1, 2)), GregDay(730_484, Date(2000, 12, 30)), GregDay(730_485, Date(2000, 12, 31)), GregDay(730_486, Date(2001, 1, 1)), GregDay(733_773, Date(2010, 1, 1)), GregDay(733_774, Date(2010, 1, 2)), GregDay(733_803, Date(2010, 1, 31)), GregDay(733_804, Date(2010, 2, 1)), GregDay(733_831, Date(2010, 2, 28)), GregDay(733_832, Date(2010, 3, 1)), GregDay(733_862, Date(2010, 3, 31)), GregDay(733_863, Date(2010, 4, 1)), GregDay(733_892, Date(2010, 4, 30)), GregDay(733_893, Date(2010, 5, 1)), GregDay(733_923, Date(2010, 5, 31)), GregDay(733_924, Date(2010, 6, 1)), GregDay(733_953, Date(2010, 6, 30)), GregDay(733_954, Date(2010, 7, 1)), GregDay(733_984, Date(2010, 7, 31)), GregDay(733_985, Date(2010, 8, 1)), GregDay(734_015, Date(2010, 8, 31)), GregDay(734_016, Date(2010, 9, 1)), GregDay(734_045, Date(2010, 9, 30)), GregDay(734_046, Date(2010, 10, 1)), GregDay(734_076, Date(2010, 10, 31)), GregDay(734_077, Date(2010, 11, 1)), GregDay(734_106, Date(2010, 11, 30)), GregDay(734_107, Date(2010, 12, 1)), GregDay(734_136, Date(2010, 12, 30)), GregDay(734_137, Date(2010, 12, 31)), GregDay(734_503, Date(2012, 1, 1)), GregDay(734_534, Date(2012, 2, 1)), GregDay(734_561, Date(2012, 2, 28)), GregDay(734_562, Date(2012, 2, 29)), GregDay(734_563, Date(2012, 3, 1)), GregDay(734_858, Date(2012, 12, 21))]; //I'd use a Tuple, but I get forward reference errors if I try. struct DayOfYear { int day; MonthDay md; } auto testDaysOfYear = [DayOfYear(1, MonthDay(1, 1)), DayOfYear(2, MonthDay(1, 2)), DayOfYear(3, MonthDay(1, 3)), DayOfYear(31, MonthDay(1, 31)), DayOfYear(32, MonthDay(2, 1)), DayOfYear(59, MonthDay(2, 28)), DayOfYear(60, MonthDay(3, 1)), DayOfYear(90, MonthDay(3, 31)), DayOfYear(91, MonthDay(4, 1)), DayOfYear(120, MonthDay(4, 30)), DayOfYear(121, MonthDay(5, 1)), DayOfYear(151, MonthDay(5, 31)), DayOfYear(152, MonthDay(6, 1)), DayOfYear(181, MonthDay(6, 30)), DayOfYear(182, MonthDay(7, 1)), DayOfYear(212, MonthDay(7, 31)), DayOfYear(213, MonthDay(8, 1)), DayOfYear(243, MonthDay(8, 31)), DayOfYear(244, MonthDay(9, 1)), DayOfYear(273, MonthDay(9, 30)), DayOfYear(274, MonthDay(10, 1)), DayOfYear(304, MonthDay(10, 31)), DayOfYear(305, MonthDay(11, 1)), DayOfYear(334, MonthDay(11, 30)), DayOfYear(335, MonthDay(12, 1)), DayOfYear(363, MonthDay(12, 29)), DayOfYear(364, MonthDay(12, 30)), DayOfYear(365, MonthDay(12, 31))]; auto testDaysOfLeapYear = [DayOfYear(1, MonthDay(1, 1)), DayOfYear(2, MonthDay(1, 2)), DayOfYear(3, MonthDay(1, 3)), DayOfYear(31, MonthDay(1, 31)), DayOfYear(32, MonthDay(2, 1)), DayOfYear(59, MonthDay(2, 28)), DayOfYear(60, MonthDay(2, 29)), DayOfYear(61, MonthDay(3, 1)), DayOfYear(91, MonthDay(3, 31)), DayOfYear(92, MonthDay(4, 1)), DayOfYear(121, MonthDay(4, 30)), DayOfYear(122, MonthDay(5, 1)), DayOfYear(152, MonthDay(5, 31)), DayOfYear(153, MonthDay(6, 1)), DayOfYear(182, MonthDay(6, 30)), DayOfYear(183, MonthDay(7, 1)), DayOfYear(213, MonthDay(7, 31)), DayOfYear(214, MonthDay(8, 1)), DayOfYear(244, MonthDay(8, 31)), DayOfYear(245, MonthDay(9, 1)), DayOfYear(274, MonthDay(9, 30)), DayOfYear(275, MonthDay(10, 1)), DayOfYear(305, MonthDay(10, 31)), DayOfYear(306, MonthDay(11, 1)), DayOfYear(335, MonthDay(11, 30)), DayOfYear(336, MonthDay(12, 1)), DayOfYear(364, MonthDay(12, 29)), DayOfYear(365, MonthDay(12, 30)), DayOfYear(366, MonthDay(12, 31))]; void initializeTests() { immutable lt = LocalTime().utcToTZ(0); currLocalDiffFromUTC = dur!"hnsecs"(lt); immutable otherTZ = lt < 0 ? TimeZone.getTimeZone("Australia/Sydney") : TimeZone.getTimeZone("America/Denver"); immutable ot = otherTZ.utcToTZ(0); auto diffs = [0, lt, ot]; auto diffAA = [0 : Rebindable!(immutable TimeZone)(UTC()), lt : Rebindable!(immutable TimeZone)(LocalTime()), ot : Rebindable!(immutable TimeZone)(otherTZ)]; sort(diffs); testTZs = [diffAA[diffs[0]], diffAA[diffs[1]], diffAA[diffs[2]]]; testFracSecs = [FracSec.from!"hnsecs"(0), FracSec.from!"hnsecs"(1), FracSec.from!"hnsecs"(5007), FracSec.from!"hnsecs"(9999999)]; foreach(year; testYearsBC) { foreach(md; testMonthDays) testDatesBC ~= Date(year, md.month, md.day); } foreach(year; testYearsAD) { foreach(md; testMonthDays) testDatesAD ~= Date(year, md.month, md.day); } foreach(dt; testDatesBC) { foreach(tod; testTODs) testDateTimesBC ~= DateTime(dt, tod); } foreach(dt; testDatesAD) { foreach(tod; testTODs) testDateTimesAD ~= DateTime(dt, tod); } foreach(dt; testDateTimesBC) { foreach(tz; testTZs) { foreach(fs; testFracSecs) testSysTimesBC ~= SysTime(dt, fs, tz); } } foreach(dt; testDateTimesAD) { foreach(tz; testTZs) { foreach(fs; testFracSecs) testSysTimesAD ~= SysTime(dt, fs, tz); } } } } //============================================================================== // Unit testing functions. //============================================================================== void _assertPred(string op, L, R) (L lhs, R rhs, lazy string msg = null, string file = __FILE__, size_t line = __LINE__) if((op == "<" || op == "<=" || op == "==" || op == "!=" || op == ">=" || op == ">") && __traits(compiles, mixin("lhs " ~ op ~ " rhs")) && _isPrintable!L && _isPrintable!R) { immutable result = mixin("lhs " ~ op ~ " rhs"); if(!result) { if(msg.empty) throw new AssertError(format(`_assertPred!"%s" failed: [%s] is not %s [%s].`, op, lhs, op, rhs), file, line); else throw new AssertError(format(`_assertPred!"%s" failed: [%s] is not %s [%s]: %s`, op, lhs, op, rhs, msg), file, line); } } unittest { version(testStdDateTime) { struct IntWrapper { int value; this(int value) { this.value = value; } string toString() { return to!string(value); } } //Test ==. assertNotThrown!AssertError(_assertPred!"=="(6, 6)); assertNotThrown!AssertError(_assertPred!"=="(6, 6.0)); assertNotThrown!AssertError(_assertPred!"=="(IntWrapper(6), IntWrapper(6))); assertThrown!AssertError(_assertPred!"=="(6, 7)); assertThrown!AssertError(_assertPred!"=="(6, 6.1)); assertThrown!AssertError(_assertPred!"=="(IntWrapper(6), IntWrapper(7))); assertThrown!AssertError(_assertPred!"=="(IntWrapper(7), IntWrapper(6))); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"=="(6, 7)), `_assertPred!"==" failed: [6] is not == [7].`); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"=="(6, 7, "It failed!")), `_assertPred!"==" failed: [6] is not == [7]: It failed!`); //Test !=. assertNotThrown!AssertError(_assertPred!"!="(6, 7)); assertNotThrown!AssertError(_assertPred!"!="(6, 6.1)); assertNotThrown!AssertError(_assertPred!"!="(IntWrapper(6), IntWrapper(7))); assertNotThrown!AssertError(_assertPred!"!="(IntWrapper(7), IntWrapper(6))); assertThrown!AssertError(_assertPred!"!="(6, 6)); assertThrown!AssertError(_assertPred!"!="(6, 6.0)); assertThrown!AssertError(_assertPred!"!="(IntWrapper(6), IntWrapper(6))); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"!="(6, 6)), `_assertPred!"!=" failed: [6] is not != [6].`); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"!="(6, 6, "It failed!")), `_assertPred!"!=" failed: [6] is not != [6]: It failed!`); //Test <, <=, >=, >. assertNotThrown!AssertError(_assertPred!"<"(5, 7)); assertNotThrown!AssertError(_assertPred!"<="(5, 7)); assertNotThrown!AssertError(_assertPred!"<="(5, 5)); assertNotThrown!AssertError(_assertPred!">="(7, 7)); assertNotThrown!AssertError(_assertPred!">="(7, 5)); assertNotThrown!AssertError(_assertPred!">"(7, 5)); assertThrown!AssertError(_assertPred!"<"(7, 5)); assertThrown!AssertError(_assertPred!"<="(7, 5)); assertThrown!AssertError(_assertPred!">="(5, 7)); assertThrown!AssertError(_assertPred!">"(5, 7)); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"<"(7, 5)), `_assertPred!"<" failed: [7] is not < [5].`); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"<"(7, 5, "It failed!")), `_assertPred!"<" failed: [7] is not < [5]: It failed!`); //Verify Examples. //Equivalent to assert(5 / 2 + 4 < 27); _assertPred!"<"(5 / 2 + 4, 27); //Equivalent to assert(4 <= 5); _assertPred!"<="(4, 5); //Equivalent to assert(1 * 2.1 == 2.1); _assertPred!"=="(1 * 2.1, 2.1); //Equivalent to assert("hello " ~ "world" != "goodbye world"); _assertPred!"!="("hello " ~ "world", "goodbye world"); //Equivalent to assert(14.2 >= 14); _assertPred!">="(14.2, 14); //Equivalent to assert(15 > 2 + 1); _assertPred!">"(15, 2 + 1); assert(collectExceptionMsg!AssertError(_assertPred!"=="("hello", "goodbye")) == `_assertPred!"==" failed: [hello] is not == [goodbye].`); assert(collectExceptionMsg!AssertError(_assertPred!"<"(5, 2, "My test failed!")) == `_assertPred!"<" failed: [5] is not < [2]: My test failed!`); } } void _assertPred(string func, string expected, L, R) (L lhs, R rhs, lazy string msg = null, string file = __FILE__, size_t line = __LINE__) if(func == "opCmp" && (expected == "<" || expected == "==" || expected == ">") && __traits(compiles, lhs.opCmp(rhs)) && _isPrintable!L && _isPrintable!R) { immutable result = lhs.opCmp(rhs); static if(expected == "<") { if(result < 0) return; if(result == 0) { if(msg.empty) throw new AssertError(format(`_assertPred!("opCmp", "<") failed: [%s] == [%s].`, lhs, rhs), file, line); else throw new AssertError(format(`_assertPred!("opCmp", "<") failed: [%s] == [%s]: %s`, lhs, rhs, msg), file, line); } else { if(msg.empty) throw new AssertError(format(`_assertPred!("opCmp", "<") failed: [%s] > [%s].`, lhs, rhs), file, line); else throw new AssertError(format(`_assertPred!("opCmp", "<") failed: [%s] > [%s]: %s`, lhs, rhs, msg), file, line); } } else static if(expected == "==") { if(result == 0) return; if(result < 0) { if(msg.empty) throw new AssertError(format(`_assertPred!("opCmp", "==") failed: [%s] < [%s].`, lhs, rhs), file, line); else throw new AssertError(format(`_assertPred!("opCmp", "==") failed: [%s] < [%s]: %s`, lhs, rhs, msg), file, line); } else { if(msg.empty) throw new AssertError(format(`_assertPred!("opCmp", "==") failed: [%s] > [%s].`, lhs, rhs), file, line); else throw new AssertError(format(`_assertPred!("opCmp", "==") failed: [%s] > [%s]: %s`, lhs, rhs, msg), file, line); } } else static if(expected == ">") { if(result > 0) return; if(result < 0) { if(msg.empty) throw new AssertError(format(`_assertPred!("opCmp", ">") failed: [%s] < [%s].`, lhs, rhs), file, line); else throw new AssertError(format(`_assertPred!("opCmp", ">") failed: [%s] < [%s]: %s`, lhs, rhs, msg), file, line); } else { if(msg.empty) throw new AssertError(format(`_assertPred!("opCmp", ">") failed: [%s] == [%s].`, lhs, rhs), file, line); else throw new AssertError(format(`_assertPred!("opCmp", ">") failed: [%s] == [%s]: %s`, lhs, rhs, msg), file, line); } } else static assert(0); } void _assertPred(string op, L, R, E) (L lhs, R rhs, E expected, lazy string msg = null, string file = __FILE__, size_t line = __LINE__) if((op == "+=" || op == "-=" || op == "*=" || op == "/=" || op == "%=" || op == "^^=" || op == "&=" || op == "|=" || op == "^=" || op == "<<=" || op == ">>=" || op == ">>>=" || op == "~=") && __traits(compiles, mixin("lhs " ~ op ~ " rhs")) && __traits(compiles, mixin("(lhs " ~ op ~ " rhs) == expected")) && _isPrintable!L && _isPrintable!R) { immutable origLHSStr = to!string(lhs); const result = mixin("lhs " ~ op ~ " rhs"); if(lhs != expected) { if(msg.empty) { throw new AssertError(format(`_assertPred!"%s" failed: After [%s] %s [%s], lhs was assigned to [%s] instead of [%s].`, op, origLHSStr, op, rhs, lhs, expected), file, line); } else { throw new AssertError(format(`_assertPred!"%s" failed: After [%s] %s [%s], lhs was assigned to [%s] instead of [%s]: %s`, op, origLHSStr, op, rhs, lhs, expected, msg), file, line); } } if(result != expected) { if(msg.empty) { throw new AssertError(format(`_assertPred!"%s" failed: Return value of [%s] %s [%s] was [%s] instead of [%s].`, op, origLHSStr, op, rhs, result, expected), file, line); } else { throw new AssertError(format(`_assertPred!"%s" failed: Return value of [%s] %s [%s] was [%s] instead of [%s]: %s`, op, origLHSStr, op, rhs, result, expected, msg), file, line); } } } unittest { version(testStdDateTime) { assertNotThrown!AssertError(_assertPred!"+="(7, 5, 12)); assertNotThrown!AssertError(_assertPred!"-="(7, 5, 2)); assertNotThrown!AssertError(_assertPred!"*="(7, 5, 35)); assertNotThrown!AssertError(_assertPred!"/="(7, 5, 1)); assertNotThrown!AssertError(_assertPred!"%="(7, 5, 2)); assertNotThrown!AssertError(_assertPred!"^^="(7, 5, 16_807)); assertNotThrown!AssertError(_assertPred!"&="(7, 5, 5)); assertNotThrown!AssertError(_assertPred!"|="(7, 5, 7)); assertNotThrown!AssertError(_assertPred!"^="(7, 5, 2)); assertNotThrown!AssertError(_assertPred!"<<="(7, 1, 14)); assertNotThrown!AssertError(_assertPred!">>="(7, 1, 3)); assertNotThrown!AssertError(_assertPred!">>>="(-7, 1, 2_147_483_644)); assertNotThrown!AssertError(_assertPred!"~="("hello ", "world", "hello world")); assertThrown!AssertError(_assertPred!"+="(7, 5, 0)); assertThrown!AssertError(_assertPred!"-="(7, 5, 0)); assertThrown!AssertError(_assertPred!"*="(7, 5, 0)); assertThrown!AssertError(_assertPred!"/="(7, 5, 0)); assertThrown!AssertError(_assertPred!"%="(7, 5, 0)); assertThrown!AssertError(_assertPred!"^^="(7, 5, 0)); assertThrown!AssertError(_assertPred!"&="(7, 5, 0)); assertThrown!AssertError(_assertPred!"|="(7, 5, 0)); assertThrown!AssertError(_assertPred!"^="(7, 5, 0)); assertThrown!AssertError(_assertPred!"<<="(7, 1, 0)); assertThrown!AssertError(_assertPred!">>="(7, 1, 0)); assertThrown!AssertError(_assertPred!">>>="(-7, 1, 0)); assertThrown!AssertError(_assertPred!"~="("hello ", "world", "goodbye world")); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"+="(7, 5, 11)), `_assertPred!"+=" failed: After [7] += [5], lhs was assigned to [12] instead of [11].`); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"+="(7, 5, 11, "It failed!")), `_assertPred!"+=" failed: After [7] += [5], lhs was assigned to [12] instead of [11]: It failed!`); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"^^="(7, 5, 42)), `_assertPred!"^^=" failed: After [7] ^^= [5], lhs was assigned to [16807] instead of [42].`); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"^^="(7, 5, 42, "It failed!")), `_assertPred!"^^=" failed: After [7] ^^= [5], lhs was assigned to [16807] instead of [42]: It failed!`); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"~="("hello ", "world", "goodbye world")), `_assertPred!"~=" failed: After [hello ] ~= [world], lhs was assigned to [hello world] instead of [goodbye world].`); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"~="("hello ", "world", "goodbye world", "It failed!")), `_assertPred!"~=" failed: After [hello ] ~= [world], lhs was assigned to [hello world] instead of [goodbye world]: It failed!`); struct IntWrapper { int value; this(int value) { this.value = value; } IntWrapper opOpAssign(string op)(IntWrapper rhs) { mixin("this.value " ~ op ~ "= rhs.value;"); return this; } string toString() { return to!string(value); } } struct IntWrapper_BadAssign { int value; this(int value) { this.value = value; } IntWrapper_BadAssign opOpAssign(string op)(IntWrapper_BadAssign rhs) { auto old = this.value; mixin("this.value " ~ op ~ "= -rhs.value;"); return IntWrapper_BadAssign(mixin("old " ~ op ~ " rhs.value")); } string toString() { return to!string(value); } } struct IntWrapper_BadReturn { int value; this(int value) { this.value = value; } IntWrapper_BadReturn opOpAssign(string op)(IntWrapper_BadReturn rhs) { mixin("this.value " ~ op ~ "= rhs.value;"); return IntWrapper_BadReturn(rhs.value); } string toString() { return to!string(value); } } assertNotThrown!AssertError(_assertPred!"+="(IntWrapper(5), IntWrapper(2), IntWrapper(7))); assertNotThrown!AssertError(_assertPred!"*="(IntWrapper(5), IntWrapper(2), IntWrapper(10))); assertThrown!AssertError(_assertPred!"+="(IntWrapper_BadAssign(5), IntWrapper_BadAssign(2), IntWrapper_BadAssign(7))); assertThrown!AssertError(_assertPred!"+="(IntWrapper_BadReturn(5), IntWrapper_BadReturn(2), IntWrapper_BadReturn(7))); assertThrown!AssertError(_assertPred!"*="(IntWrapper_BadAssign(5), IntWrapper_BadAssign(2), IntWrapper_BadAssign(10))); assertThrown!AssertError(_assertPred!"*="(IntWrapper_BadReturn(5), IntWrapper_BadReturn(2), IntWrapper_BadReturn(10))); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"+="(IntWrapper_BadAssign(5), IntWrapper_BadAssign(2), IntWrapper_BadAssign(7))), `_assertPred!"+=" failed: After [5] += [2], lhs was assigned to [3] instead of [7].`); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"+="(IntWrapper_BadAssign(5), IntWrapper_BadAssign(2), IntWrapper_BadAssign(7), "It failed!")), `_assertPred!"+=" failed: After [5] += [2], lhs was assigned to [3] instead of [7]: It failed!`); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"+="(IntWrapper_BadReturn(5), IntWrapper_BadReturn(2), IntWrapper_BadReturn(7))), `_assertPred!"+=" failed: Return value of [5] += [2] was [2] instead of [7].`); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"+="(IntWrapper_BadReturn(5), IntWrapper_BadReturn(2), IntWrapper_BadReturn(7), "It failed!")), `_assertPred!"+=" failed: Return value of [5] += [2] was [2] instead of [7]: It failed!`); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"*="(IntWrapper_BadAssign(5), IntWrapper_BadAssign(2), IntWrapper_BadAssign(10))), `_assertPred!"*=" failed: After [5] *= [2], lhs was assigned to [-10] instead of [10].`); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"*="(IntWrapper_BadAssign(5), IntWrapper_BadAssign(2), IntWrapper_BadAssign(10), "It failed!")), `_assertPred!"*=" failed: After [5] *= [2], lhs was assigned to [-10] instead of [10]: It failed!`); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"*="(IntWrapper_BadReturn(5), IntWrapper_BadReturn(2), IntWrapper_BadReturn(10))), `_assertPred!"*=" failed: Return value of [5] *= [2] was [2] instead of [10].`); _assertPred!"=="(collectExceptionMsg!AssertError(_assertPred!"*="(IntWrapper_BadReturn(5), IntWrapper_BadReturn(2), IntWrapper_BadReturn(10), "It failed!")), `_assertPred!"*=" failed: Return value of [5] *= [2] was [2] instead of [10]: It failed!`); } } unittest { /* Issue 6642 */ static assert(!hasUnsharedAliasing!Date); static assert(!hasUnsharedAliasing!TimeOfDay); static assert(!hasUnsharedAliasing!DateTime); static assert(!hasUnsharedAliasing!SysTime); } template _isPrintable(T...) { static if(T.length == 0) enum _isPrintable = true; else static if(T.length == 1) { enum _isPrintable = (!isArray!(T[0]) && __traits(compiles, to!string(T[0].init))) || (isArray!(T[0]) && __traits(compiles, to!string(T[0].init[0]))); } else { enum _isPrintable = _isPrintable!(T[0]) && _isPrintable!(T[1 .. $]); } }
D
/Users/justinlew/Documents/iOS_dev/mealify.io/DerivedData/mealify/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/IScatterChartDataSet.o : /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Filters/DataApproximator+N.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/Legend.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/MarkerImage.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/Range.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/AxisBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/ComponentBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/Fill.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/Platform.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/Description.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/IMarker.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/Transformer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Renderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Animation/Animator.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Filters/DataApproximator.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/XAxis.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/YAxis.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/ChartUtils.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/Highlight.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/MarkerView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/PieChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/LineChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/BarChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/RadarChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/LegendEntry.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Target\ Support\ Files/Charts/Charts-umbrella.h /Users/justinlew/Documents/iOS_dev/mealify.io/DerivedData/mealify/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/justinlew/Documents/iOS_dev/mealify.io/DerivedData/mealify/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/IScatterChartDataSet~partial.swiftmodule : /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Filters/DataApproximator+N.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/Legend.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/MarkerImage.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/Range.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/AxisBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/ComponentBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/Fill.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/Platform.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/Description.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/IMarker.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/Transformer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Renderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Animation/Animator.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Filters/DataApproximator.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/XAxis.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/YAxis.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/ChartUtils.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/Highlight.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/MarkerView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/PieChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/LineChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/BarChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/RadarChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/LegendEntry.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Target\ Support\ Files/Charts/Charts-umbrella.h /Users/justinlew/Documents/iOS_dev/mealify.io/DerivedData/mealify/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/justinlew/Documents/iOS_dev/mealify.io/DerivedData/mealify/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Charts.build/Objects-normal/x86_64/IScatterChartDataSet~partial.swiftdoc : /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Filters/DataApproximator+N.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/ViewPortJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/MoveViewJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/ZoomViewJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/Legend.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/MarkerImage.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/Range.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/ChartLimitLine.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/AxisRendererBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/AxisBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/ComponentBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/ChartViewBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/BarLineChartViewBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Animation/ChartAnimationEasing.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/Fill.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/Platform.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/Description.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/ChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/IMarker.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/ViewPortHandler.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/Transformer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Renderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/LegendRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/LineRadarRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/XAxisRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/YAxisRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/PieChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/LineChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/BarChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/RadarChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/IHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/CombinedHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/PieHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/BarHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/RadarHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/ChartHighlighter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/IValueFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/IFillFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Animation/Animator.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Filters/DataApproximator.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/ChartColorTemplates.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/XAxis.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/YAxis.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/ChartUtils.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Highlight/Highlight.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/MarkerView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/CombinedChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/PieChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/BubbleChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/LineChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/CandleStickChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/BarChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/HorizontalBarChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/RadarChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Charts/ScatterChartView.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Charts/Source/Charts/Components/LegendEntry.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/justinlew/Documents/iOS_dev/mealify.io/Pods/Target\ Support\ Files/Charts/Charts-umbrella.h /Users/justinlew/Documents/iOS_dev/mealify.io/DerivedData/mealify/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Charts.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
D
/***********************************************************************\ * shlguid.d * * * * Windows API header module * * * * Translated from MinGW Windows headers * * * * Placed into public domain * \***********************************************************************/ module win32.shlguid; private import win32.basetyps, win32.w32api; // FIXME: clean up Windows version support // I think this is just a helper macro for other win32. headers? //MACRO #define DEFINE_SHLGUID(n,l,w1,w2) DEFINE_GUID(n,l,w1,w2,0xC0,0,0,0,0,0,0,0x46)
D
// URL: https://yukicoder.me/problems/no/737 import std.algorithm, std.array, std.container, std.math, std.range, std.typecons, std.string; version(unittest) {} else void main() { long N; io.getV(N); auto m = N.bsr+1; auto dp1 = new mint[][][](m+1, 2, m+1), dp2 = new long[][][](m+1, 2, m+1); dp2[0][1][0] = 1; foreach (i; 0..m) foreach (j; 0..2) foreach (k; 0..i+1) { auto md = j == 1 && !N.bitTest(m-i-1) ? 0 : 1; foreach (d; 0..md+1) { dp2[i+1][j == 1 && d == md ? 1 : 0][k+d] += dp2[i][j][k]; dp1[i+1][j == 1 && d == md ? 1 : 0][k+d] += dp1[i][j][k]*2 + mint(dp2[i][j][k])*d; } } auto ans = mint(0); foreach (j; 0..2) foreach (k; 0..m+1) ans += dp1[$-1][j][k] * k; io.put(ans); } import lib.bitop; const mod = 10^^9+7; alias mint = ModInt!mod; import lib.math.mod_int; auto io = IO!()(); import lib.io;
D
instance BAU_913_Thekla(Npc_Default) { name[0] = "Текла"; guild = GIL_BAU; id = 913; voice = 17; flags = 0; npcType = NPCTYPE_MAIN; B_SetAttributesToChapter(self,1); fight_tactic = FAI_HUMAN_COWARD; EquipItem(self,ItMw_1h_Bau_Mace); B_CreateAmbientInv(self); B_CreateItemToSteal(self,53,ItMi_Gold,60); // B_SetNpcVisual(self,FEMALE,"Hum_Head_Babe",FaceBabe_N_Brown,BodyTexBabe_N,ITAR_BauBabe_M); B_SetNpcVisual(self,FEMALE,"Hum_Head_Babe4",FaceBabe_N_Brown,BodyTexBabe_N,ITAR_BauBabe_M); Mdl_SetModelFatness(self,0); Mdl_ApplyOverlayMds(self,"Humans_Babe.mds"); B_GiveNpcTalents(self); B_SetFightSkills(self,10); daily_routine = Rtn_Start_913; }; func void Rtn_Start_913() { TA_Stand_Guarding(8,0,8,30,"NW_BIGFARM_KITCHEN_BARKEEPER"); TA_Cook_Stove(8,30,9,0,"NW_BIGFARM_KITCHEN_COOK"); TA_Stand_Guarding(9,0,9,30,"NW_BIGFARM_KITCHEN_BARKEEPER"); TA_Cook_Stove(9,30,10,0,"NW_BIGFARM_KITCHEN_COOK"); TA_Stand_Guarding(10,0,10,30,"NW_BIGFARM_KITCHEN_BARKEEPER"); TA_Cook_Stove(10,30,11,0,"NW_BIGFARM_KITCHEN_COOK"); TA_Stand_Guarding(11,0,11,30,"NW_BIGFARM_KITCHEN_BARKEEPER"); TA_Cook_Stove(11,30,12,0,"NW_BIGFARM_KITCHEN_COOK"); TA_Stand_Guarding(12,0,12,30,"NW_BIGFARM_KITCHEN_BARKEEPER"); TA_Cook_Stove(12,30,13,0,"NW_BIGFARM_KITCHEN_COOK"); TA_Stand_Guarding(13,0,13,30,"NW_BIGFARM_KITCHEN_BARKEEPER"); TA_Cook_Stove(13,30,14,0,"NW_BIGFARM_KITCHEN_COOK"); TA_Stand_Guarding(14,0,14,30,"NW_BIGFARM_KITCHEN_BARKEEPER"); TA_Cook_Stove(14,30,15,0,"NW_BIGFARM_KITCHEN_COOK"); TA_Stand_Guarding(15,0,15,30,"NW_BIGFARM_KITCHEN_BARKEEPER"); TA_Cook_Stove(15,30,16,0,"NW_BIGFARM_KITCHEN_COOK"); TA_Stand_Guarding(16,0,16,30,"NW_BIGFARM_KITCHEN_BARKEEPER"); TA_Cook_Stove(16,30,17,0,"NW_BIGFARM_KITCHEN_COOK"); TA_Stand_Guarding(17,0,17,30,"NW_BIGFARM_KITCHEN_BARKEEPER"); TA_Cook_Stove(17,30,18,0,"NW_BIGFARM_KITCHEN_COOK"); TA_Stand_Guarding(18,0,18,30,"NW_BIGFARM_KITCHEN_BARKEEPER"); TA_Cook_Stove(18,30,19,0,"NW_BIGFARM_KITCHEN_COOK"); TA_Stand_Guarding(19,0,19,30,"NW_BIGFARM_KITCHEN_BARKEEPER"); TA_Cook_Stove(19,30,20,0,"NW_BIGFARM_KITCHEN_COOK"); TA_Stand_Guarding(20,0,20,30,"NW_BIGFARM_KITCHEN_BARKEEPER"); TA_Cook_Stove(20,30,21,0,"NW_BIGFARM_KITCHEN_COOK"); TA_Stand_Guarding(21,0,21,30,"NW_BIGFARM_KITCHEN_BARKEEPER"); TA_Cook_Stove(21,30,22,0,"NW_BIGFARM_KITCHEN_COOK"); TA_Stand_Guarding(22,0,8,0,"NW_BIGFARM_KITCHEN_BARKEEPER"); };
D
/****************************************************************************** Table of request handlers by command. Copyright: Copyright (c) 2016-2017 sociomantic labs GmbH. All rights reserved. License: Boost Software License Version 1.0. See LICENSE.txt for details. *******************************************************************************/ module fakedls.neo.RequestHandlers; import swarm.neo.node.ConnectionHandler; import dlsproto.common.RequestCodes; import Put = fakedls.neo.request.Put; import GetRange = fakedls.neo.request.GetRange; /****************************************************************************** This table of request handlers by command is used by the connection handler. When creating a new request, the function corresponding to the request command is called in a fiber. ******************************************************************************/ public ConnectionHandler.CmdHandlers request_handlers; static this ( ) { request_handlers[RequestCode.Put] = &Put.handle; request_handlers[RequestCode.GetRange] = &GetRange.handle; }
D
//***************************************************************************** // Scrolls //***************************************************************************** // Paladin Scrolls const string Name_PaladinScroll = "Paladin Zauber"; const int Value_Sc_PalLight = 50; const int Value_Sc_PalLightHeal = 100; const int Value_Sc_PalHolyBolt = 200; const int Value_Sc_PalMediumHeal = 400; const int Value_Sc_PalRepelEvil = 600; const int Value_Sc_PalFullHeal = 800; const int Value_Sc_PalDestroyEvil = 1000; // Magier Scrolls const int Value_Sc_Light = 10; const int Value_Sc_Firebolt = 25; const int Value_Sc_Charm = 100; const int Value_Sc_Icebolt = 25; const int Value_Sc_LightHeal = 25; const int Value_Sc_SumGobSkel = 75; const int VALUE_SC_SUMICEWOLF = 100; const int VALUE_SC_SUMICEGOL = 200; const int Value_Sc_InstantFireball = 50; const int Value_Sc_Zap = 60; const int Value_Sc_SumWolf = 75; const int Value_Sc_Windfist = 60; const int Value_Sc_Sleep = 100; const int Value_Sc_MediumHeal = 60; const int Value_Sc_LightningFlash = 125; const int Value_Sc_ChargeFireball = 60; const int Value_Sc_SumSkel = 75; const int Value_Sc_Fear = 75; const int Value_Sc_IceCube = 100; const int Value_Sc_ThunderBall = 75; const int Value_Sc_SumGol = 150; const int Value_Sc_HarmUndead = 75; const int Value_Sc_Pyrokinesis = 150; const int Value_Sc_Firestorm = 100; const int Value_Sc_IceWave = 200; const int Value_Sc_SumDemon = 200; const int Value_Sc_FullHeal = 200; const int Value_Sc_Firerain = 250; const int Value_Sc_BreathOfDeath = 250; const int Value_Sc_MassDeath = 250; const int Value_Sc_ArmyOfDarkness = 250; const int Value_Sc_Shrink = 250; const int Value_Sc_TrfSheep = 25; const int Value_Sc_TrfScavenger = 50; const int Value_Sc_TrfGiantRat = 50; const int Value_Sc_TrfGiantBug = 60; const int Value_Sc_TrfWolf = 75; const int Value_Sc_TrfWaran = 80; const int Value_Sc_TrfSnapper = 125; const int Value_Sc_TrfWarg = 125; const int Value_Sc_TrfFireWaran = 200; const int Value_Sc_TrfLurker = 80; const int Value_Sc_TrfShadowbeast = 200; const int Value_Sc_TrfDragonSnapper = 200; /*******************************************************************************************/ // Paladin Scrolls /*******************************************************************************************/ INSTANCE ItSc_PalLight (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_PalLight; visual = "ItSc_PalLight.3DS"; material = MAT_LEATHER; spell = SPL_PalLight; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_PalLight; TEXT [0] = Name_PaladinScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Duration; COUNT [2] = SPL_Duration_PalLIGHT; TEXT [5] = NAME_Value; COUNT [5] = value; }; instance ITSC_SUMICEWOLF(C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = VALUE_SC_SUMICEWOLF; visual = "ItSc_SumWolf.3DS"; material = MAT_LEATHER; spell = SPL_SUMMONICEWOLF; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_SUMMONICEWOLF; text[0] = NAME_MageScroll; text[1] = NAME_Mana_needed; count[1] = SPL_Cost_Scroll; text[5] = NAME_Value; count[5] = value; }; instance ITSC_SUMICEGOL(C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = VALUE_SC_SUMICEGOL; visual = "ItSc_SumGol.3DS"; material = MAT_LEATHER; spell = SPL_SUMMONICEGOLEM; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_SUMMONICEGOLEM; text[0] = NAME_MageScroll; text[1] = NAME_Mana_needed; count[1] = SPL_Cost_Scroll; text[5] = NAME_Value; count[5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_PalLightHeal (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_PalLightHeal; visual = "ItSc_PalLightHeal.3DS"; material = MAT_LEATHER; spell = SPL_PalLightHeal; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_PalLightHeal; TEXT [0] = Name_PaladinScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_HealingPerCast; COUNT [2] = SPL_Heal_PalLightHeal; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_PalHolyBolt (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_PalHolyBolt; visual = "ItSc_PalHolyBolt.3DS"; material = MAT_LEATHER; spell = SPL_PalHolyBolt; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_PalHolyBolt; TEXT [0] = Name_PaladinScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Dam_Magic; COUNT [2] = SPL_Damage_PalHolyBolt; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_PalMediumHeal (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_PalMediumHeal; visual = "ItSc_PalMediumHeal.3DS"; material = MAT_LEATHER; spell = SPL_PalMediumHeal; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_PalMediumHeal; TEXT [0] = Name_PaladinScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_HealingPerCast; COUNT [2] = SPL_Heal_PalMediumHeal; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_PalRepelEvil (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_PalRepelEvil; visual = "ItSc_PalRepelEvil.3DS"; material = MAT_LEATHER; spell = SPL_PalRepelEvil; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_PalRepelEvil; TEXT [0] = Name_PaladinScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Dam_Magic; COUNT [2] = SPL_Damage_PalRepelEvil; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_PalFullHeal (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_PalFullHeal; visual = "ItSc_PalFullHeal.3DS"; material = MAT_LEATHER; spell = SPL_PalFullHeal; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_PalFullHeal; TEXT [0] = Name_PaladinScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_HealingPerCast; COUNT [2] = SPL_Heal_PalFullHeal; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_PalDestroyEvil (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_PalDestroyEvil; visual = "ItSc_PalDestroyEvil.3DS"; material = MAT_LEATHER; spell = SPL_PalDestroyEvil; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_PalDestroyEvil; TEXT [0] = Name_PaladinScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Dam_Magic; COUNT [2] = SPL_Damage_PalDestroyEvil; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ // Magier Scrolls /*******************************************************************************************/ instance ItSc_Light (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_Light; visual = "ItSc_Light.3DS"; material = MAT_LEATHER; spell = SPL_LIGHT; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_LIGHT; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Duration; COUNT [2] = SPL_Duration_LIGHT; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ // Magier Scrolls /*******************************************************************************************/ instance ItSc_TeleportOT (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_Light; visual = "ItSc_Light.3DS"; material = MAT_LEATHER; spell = SPL_TeleportOT; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = "Teleport"; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ // Magier Scrolls /*******************************************************************************************/ instance ItSc_TeleportOT_Fake (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_NONE; flags = ITEM_MULTI; value = Value_Sc_Light; visual = "ItSc_Light.3DS"; material = MAT_LEATHER; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = "Teleport"; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_Firebolt (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_Firebolt; visual = "ItSc_Firebolt.3DS"; material = MAT_LEATHER; spell = SPL_FIREBOLT; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_Firebolt; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Dam_Magic; COUNT [2] = SPL_DAMAGE_FIREBOLT; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_Icebolt (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_Icebolt; visual = "ItSc_Icebolt.3DS"; material = MAT_LEATHER; spell = SPL_Icebolt; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_BLUE"; description = NAME_SPL_Icebolt; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Dam_Magic; COUNT [2] = SPL_DAMAGE_Icebolt; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_LightHeal (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_LightHeal; visual = "ItSc_LightHeal.3DS"; material = MAT_LEATHER; spell = SPL_LightHeal; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_LightHeal; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_HealingPerCast; COUNT [2] = SPL_Heal_LightHeal; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_SumGobSkel (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_SumGobSkel; visual = "ItSc_SumGobSkel.3DS"; material = MAT_LEATHER; spell = SPL_SummonGoblinSkeleton; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_SummonGoblinSkeleton; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_InstantFireball (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_InstantFireball; visual = "ItSc_InstantFireball.3DS"; material = MAT_LEATHER; spell = SPL_InstantFireball; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_YELLOW"; description = NAME_SPL_InstantFireball; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Dam_Magic; COUNT [2] = SPL_DAMAGE_InstantFireball; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_Zap (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_Zap; visual = "ItSc_Zap.3DS"; material = MAT_LEATHER; spell = SPL_Zap; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_Zap; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Dam_Magic; COUNT [2] = SPL_DAMAGE_ZAP; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_SumWolf (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_SumWolf; visual = "ItSc_SumWolf.3DS"; material = MAT_LEATHER; spell = SPL_SummonWolf; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_SummonWolf; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_Windfist (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_Windfist; visual = "ItSc_Windfist.3DS"; material = MAT_LEATHER; spell = SPL_WINDFIST; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = STEP_WINDFIST; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_WINDFIST; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_MinManakosten; COUNT [1] = STEP_WindFist; TEXT [2] = NAME_ManakostenMax; COUNT [2] = SPL_COST_WINDFIST; TEXT [3] = NAME_Addon_Damage_Min; count [3] = SPL_Damage_Windfist; TEXT [4] = NAME_Damage_Max; COUNT [4] = (SPL_Damage_Windfist*4); TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_Sleep (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_Sleep; visual = "ItSc_Sleep.3DS"; material = MAT_LEATHER; spell = SPL_SLEEP; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_Sleep; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Sec_Duration; COUNT [2] = SPL_TIME_Sleep; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_Charm(C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI|ITEM_MISSION; value = Value_Sc_Charm; visual = "ItSc_Sleep.3DS"; material = MAT_LEATHER; spell = SPL_CHARM; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_Charm; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_MediumHeal (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_MediumHeal; visual = "ItSc_MediumHeal.3DS"; material = MAT_LEATHER; spell = SPL_MediumHeal; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_MediumHeal; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_HealingPerCast; COUNT [2] = SPL_Heal_MediumHeal; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_LightningFlash (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_LightningFlash; visual = "ItSc_LightningFlash.3DS"; material = MAT_LEATHER; spell = SPL_LightningFlash; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_LightningFlash; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Dam_Magic; COUNT [2] = SPL_Damage_LightningFlash; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_ChargeFireball (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_ChargeFireball; visual = "ItSc_ChargeFireball.3DS"; material = MAT_LEATHER; spell = SPL_ChargeFireball; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = STEP_CHARGEFIREBALL; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_YELLOW"; description = NAME_SPL_ChargeFireball; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_MinManakosten; COUNT [1] = STEP_ChargeFireball; TEXT [2] = NAME_ManakostenMax; COUNT [2] = SPL_COST_ChargeFireball; TEXT [3] = NAME_Addon_Damage_Min; count [3] = SPL_Damage_ChargeFireball; TEXT [4] = NAME_Damage_Max; COUNT [4] = (SPL_Damage_ChargeFireball*4); TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_SumSkel (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_SumSkel; visual = "ItSc_SumSkel.3DS"; material = MAT_LEATHER; spell = SPL_SUMMONSKELETON; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_SummonSkeleton; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_Fear (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_Fear; visual = "ItSc_Fear.3DS"; material = MAT_LEATHER; spell = SPL_FEAR; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_Fear; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Sec_Duration; COUNT [2] = SPL_TIME_Fear; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_IceCube (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_IceCube; visual = "ItSc_IceCube.3DS"; material = MAT_LEATHER; spell = SPL_ICECUBE; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_BLUE"; description = NAME_SPL_IceCube; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Damage; COUNT [2] = 60; TEXT [3] = NAME_Sec_Duration; COUNT [3] = SPL_TIME_FREEZE; TEXT [4] = NAME_DamagePerSec; COUNT [4] = SPL_FREEZE_DAMAGE; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_ThunderBall (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_ThunderBall; visual = "ItSc_ThunderBall.3DS"; material = MAT_LEATHER; spell = SPL_ChargeZap; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = STEP_CHARGEZAP; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_ChargeZap; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_MinManakosten; COUNT [1] = STEP_ChargeZap; TEXT [2] = NAME_ManakostenMax; COUNT [2] = SPL_COST_ChargeZap; TEXT [3] = NAME_Addon_Damage_Min; count [3] = SPL_Damage_ChargeZap; TEXT [4] = NAME_Damage_Max; COUNT [4] = (SPL_Damage_ChargeZap*4); TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_SumGol (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_SC_SumGol; visual = "ItSc_SumGol.3DS"; material = MAT_LEATHER; spell = SPL_SUMMONGOLEM; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_SummonGolem; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_HarmUndead (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_HarmUndead; visual = "ItSc_HarmUndead.3DS"; material = MAT_LEATHER; spell = SPL_DESTROYUNDEAD; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_DestroyUndead; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Dam_Magic; COUNT [2] = SPL_DAMAGE_DESTROYUNDEAD; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_Pyrokinesis (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_Pyrokinesis; visual = "ItSc_Pyrokinesis.3DS"; material = MAT_LEATHER; spell = SPL_PYROKINESIS; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = STEP_Firestorm; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_YELLOW"; description = NAME_SPL_Pyrokinesis; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_MinManakosten; COUNT [1] = STEP_Firestorm; TEXT [2] = NAME_ManakostenMax; COUNT [2] = SPL_COST_Firestorm; TEXT [3] = NAME_Addon_Damage_Min; count [3] = SPL_Damage_Firestorm; TEXT [4] = NAME_Damage_Max; COUNT [4] = (SPL_Damage_Firestorm*4); TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_Firestorm (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_Firestorm; visual = "ItSc_Firestorm.3DS"; material = MAT_LEATHER; spell = SPL_FIRESTORM; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_YELLOW"; description = NAME_SPL_Firestorm; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Dam_Magic; COUNT [2] = SPL_DAMAGE_INSTANTFIRESTORM; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_IceWave (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_SC_IceWave; visual = "ItSc_IceWave.3DS"; material = MAT_LEATHER; spell = SPL_ICEWAVE; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_BLUE"; description = NAME_SPL_IceWave; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Damage; COUNT [2] = 60; TEXT [3] = NAME_Sec_Duration; COUNT [3] = SPL_TIME_FREEZE; TEXT [4] = NAME_DamagePerSec; COUNT [4] = SPL_FREEZE_DAMAGE; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_SumDemon (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_SumDemon; visual = "ItSc_SumDemon.3DS"; material = MAT_LEATHER; spell = SPL_SUMMONDEMON; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_SummonDemon; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_FullHeal (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_FullHeal; visual = "ItSc_FullHeal.3DS"; material = MAT_LEATHER; spell = SPL_FullHeal; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_FullHeal; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_HealingPerCast; COUNT [2] = SPL_Heal_FullHeal; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_Firerain (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_Firerain; visual = "ItSc_Firerain.3DS"; material = MAT_LEATHER; spell = SPL_FIRERAIN; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_YELLOW"; description = NAME_SPL_Firerain; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Dam_Fire; COUNT [2] = SPL_DAMAGE_FIRERAIN; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_BreathOfDeath (C_Item)//Joly:Auf Dracheninsel in Truhe der Schwarzmagiernovizen { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_BreathofDeath; visual = "ItSc_BreathOfDeath.3ds"; material = MAT_LEATHER; spell = SPL_BREATHOFDEATH; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_RED"; description = NAME_SPL_BreathOfDeath; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Dam_Magic; COUNT [2] = SPL_DAMAGE_BREATHOFDEATH; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_MassDeath (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_Massdeath; visual = "ItSc_MassDeath.3ds"; material = MAT_LEATHER; spell = SPL_MASSDEATH; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_RED"; description = NAME_SPL_MassDeath; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [2] = NAME_Dam_Magic; COUNT [2] = SPL_DAMAGE_MASSDEATH; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_ArmyOfDarkness (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_ArmyofDarkness; visual = "ItSc_ArmyOfDarkness.3DS"; material = MAT_LEATHER; spell = SPL_ARMYOFDARKNESS; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER_RED"; description = NAME_SPL_ArmyOfDarkness; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_Shrink (C_Item)//Joly:Auf Dracheninsel in Truhe der Schwarzmagiernovizen { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_Shrink; visual = "ItSc_Shrink.3DS"; material = MAT_LEATHER; spell = SPL_SHRINK; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_Shrink; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_TrfSheep (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_TrfSheep; visual = "ItSc_TrfSheep.3DS"; material = MAT_LEATHER; spell = SPL_TrfSheep; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_TrfSheep; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_TrfScavenger (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_TrfScavenger; visual = "ItSc_TrfScavenger.3DS"; material = MAT_LEATHER; spell = SPL_TrfScavenger; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_TrfScavenger; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_TrfGiantRat (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_TrfGiantrat; visual = "ItSc_TrfGiantRat.3DS"; material = MAT_LEATHER; spell = SPL_TrfGiantRat; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_TrfGiantRat; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_TrfGiantBug (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_TrfGiantBug; visual = "ItSc_TrfGiantBug.3DS"; material = MAT_LEATHER; spell = SPL_TrfGiantBug; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_TrfGiantBug; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_TrfWolf (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_TrfWolf; visual = "ItSc_TrfWolf.3DS"; material = MAT_LEATHER; spell = SPL_TrfWolf; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_TrfWolf; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_TrfWaran (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_TrfWaran; visual = "ItSc_TrfWaran.3DS"; material = MAT_LEATHER; spell = SPL_TrfWaran; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_TrfWaran; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_TrfSnapper (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_TrfSnapper; visual = "ItSc_TrfSnapper.3DS"; material = MAT_LEATHER; spell = SPL_TrfSnapper; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_TrfSnapper; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_TrfWarg (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_TrfWarg; visual = "ItSc_TrfWarg.3DS"; material = MAT_LEATHER; spell = SPL_TrfWarg; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_TrfWarg; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_TrfFireWaran (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_TrfFireWaran; visual = "ItSc_TrfFireWaran.3DS"; material = MAT_LEATHER; spell = SPL_TrfFireWaran; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_TrfFireWaran; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_TrfLurker (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_TrfLurker; visual = "ItSc_TrfLurker.3DS"; material = MAT_LEATHER; spell = SPL_TrfLurker; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_TrfLurker; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_TrfShadowbeast (C_Item) { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_TrfShadowbeast; visual = "ItSc_TrfShadowbeast.3DS"; material = MAT_LEATHER; spell = SPL_TrfShadowbeast; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_TrfShadowbeast; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/ INSTANCE ItSc_TrfDragonSnapper (C_Item)//Joly:Auf Dracheninsel in Truhe der Schwarzmagiernovizen { name = NAME_Spruchrolle; mainflag = ITEM_KAT_RUNE; flags = ITEM_MULTI; value = Value_Sc_TrfDragonSnapper; visual = "ItSc_TrfDragonSnapper.3DS"; material = MAT_LEATHER; spell = SPL_TrfDragonSnapper; cond_atr[2] = ATR_MANA_MAX; cond_value[2] = SPL_Cost_Scroll; wear = WEAR_EFFECT; effect = "SPELLFX_WEAKGLIMMER"; description = NAME_SPL_TrfDragonSnapper; TEXT [0] = Name_MageScroll ; TEXT [1] = NAME_Mana_needed; COUNT [1] = SPL_Cost_Scroll; TEXT [5] = NAME_Value; COUNT [5] = value; }; /*******************************************************************************************/
D
/******************************************************************************* Exists request implementation. copyright: Copyright (c) 2018 sociomantic labs GmbH. All rights reserved License: Boost Software License Version 1.0. See LICENSE.txt for details. *******************************************************************************/ module dhtnode.request.neo.Exists; import dhtproto.node.neo.request.Exists; import dhtnode.connection.neo.SharedResources; import swarm.neo.node.RequestOnConn; import swarm.neo.request.Command; import ocean.transition; import ocean.core.TypeConvert : castFrom, downcast; import ocean.core.Verify; import dhtnode.node.DhtHashRange; /******************************************************************************* DHT node implementation of the v0 Exists request protocol. *******************************************************************************/ public scope class ExistsImpl_v0 : ExistsProtocol_v0 { import swarm.util.Hash : isWithinNodeResponsibility; /*************************************************************************** Checks whether the node is responsible for the specified key. Params: key = key of record to write Returns: true if the node is responsible for the key ***************************************************************************/ override protected bool responsibleForKey ( hash_t key ) { auto resources_ = downcast!(SharedResources.RequestResources)(this.resources); verify(resources_ !is null); auto node_info = resources_.node_info; return isWithinNodeResponsibility(key, node_info.min_hash, node_info.max_hash); } /*************************************************************************** Checks whether a single record exists in the storage engine. Params: channel = channel to check in key = key of record to check found = out value, set to true if the record exists Returns: true if the operation succeeded; false if an error occurred ***************************************************************************/ override protected bool exists ( cstring channel, hash_t key, out bool found ) { auto resources_ = downcast!(SharedResources.RequestResources)(this.resources); verify(resources_ !is null); auto storage_channel = resources_.storage_channels.getCreate(channel); if (storage_channel is null) return false; found = storage_channel.exists(key); return true; } }
D
func void b_preach_parvez(var int satz) { if(satz == 0) { AI_Output(self,self,"DIA_Parvez_PREACH_05_00"); //Před dávnou dobou objevil se Spáč a člověk měl jeho vizi. }; if(satz == 1) { AI_Output(self,self,"DIA_Parvez_PREACH_05_01"); //Ale lidé zaslepení chamtivostí nemohli vidět pravdu. }; if(satz == 2) { AI_Output(self,self,"DIA_Parvez_PREACH_05_02"); //Pouze jeden Y'Berion a jeho věrní dokázali porozumět pravdě a založili Bratrstvo. }; if(satz == 3) { AI_Output(self,self,"DIA_Parvez_PREACH_05_03"); //Spáč je dovedl na správné místo, kde založili chrám. }; if(satz == 4) { AI_Output(self,self,"DIA_Parvez_PREACH_05_04"); //Pracovali jako jeden. Den po dni, týden po týdnu, měsíc po měsíci. Tábor rostl a stále více mužů přicházelo uctívat Spáče. }; if(satz == 5) { AI_Output(self,self,"DIA_Parvez_PREACH_05_05"); //Společně se snažili komunikovat se Spáčem. }; if(satz == 6) { AI_Output(self,self,"DIA_Parvez_PREACH_05_06"); //Vize se vyjasnili. Ale Bratrstvo nebylo stále schopno komunikace se Spáčem. }; if(satz == 7) { AI_Output(self,self,"DIA_Parvez_PREACH_05_07"); //Mocný alchymista proto připravil elixír z čelistí důlních červů. Díky tomu byla schopnost Bratrstva dostačující pro volání. }; if(satz == 8) { AI_Output(self,self,"DIA_Parvez_PREACH_05_08"); //V té době byli do jiných táborů vysíláni nováčci šířit pravou víru. }; if(satz == 9) { AI_Output(self,self,"DIA_Parvez_PREACH_05_09"); //Víra stále rostla a šířila se. }; if(satz == 10) { AI_Output(self,self,"DIA_Parvez_PREACH_05_10"); //Od té doby mnoho vod proteklo a mnohé se změnilo. }; }; func void b_preach_haniar(var int satz) { if(satz == 0) { AI_Output(self,self,"DIA_Haniar_PREACH_05_00"); //Když bojujete, bojujte kvůli vítěztví. Bojujte pro zabíjení! }; if(satz == 1) { AI_Output(self,self,"DIA_Haniar_PREACH_05_01"); //To není jen slepé plnění příkazů - děláte Beliarovu vůli! }; if(satz == 2) { AI_Output(self,self,"DIA_Haniar_PREACH_05_02"); //A pokaždé, když zabijete Baliarova nepřítele, jeho síla roste. }; if(satz == 3) { AI_Output(self,self,"DIA_Haniar_PREACH_05_03"); //Vykonáváte jeho trest! Přinášíte smrt jeho nepřátelům! }; if(satz == 4) { AI_Output(self,self,"DIA_Haniar_PREACH_05_04"); //Mohu vám prozradit, jak porazit nepřítele. Ale sílu na to vám dá jedině Beliar. }; if(satz == 5) { AI_Output(self,self,"DIA_Haniar_PREACH_05_05"); //Musíte udeřit své nepřátele stejně jako Beliar - svým hněvem! }; if(satz == 6) { AI_Output(self,self,"DIA_Haniar_PREACH_05_06"); //Já vás můžu naučit bránit se, ale Beliar vás naučí vyhrát! }; if(satz == 7) { AI_Output(self,self,"DIA_Haniar_PREACH_05_07"); //Jen Beliar může ve vás probudit bouři, kterou nikdo a nic nedokáže zastavit. }; if(satz == 8) { AI_Output(self,self,"DIA_Haniar_PREACH_05_08"); //Za každou vítěznou bitvu v jeho jménu vás Beliar odmění silou. }; if(satz == 9) { AI_Output(self,self,"DIA_Haniar_PREACH_05_09"); //Protože jste jeho vyvoleným nástrojem. Zvítězíte vy - zvítězí i on! }; }; func void b_preach_orc(var int satz) { if(PlayerKnowsOrcLanguage == TRUE) { if(satz == 0) { AI_Output(self,self,"DIA_ORC_PREACH_01_01"); // }; if(satz == 1) { AI_Output(self,self,"DIA_ORC_PREACH_01_03"); // }; if(satz == 2) { AI_Output(self,self,"DIA_ORC_PREACH_01_05"); // }; if(satz == 3) { AI_Output(self,self,"DIA_ORC_PREACH_01_07"); // }; if(satz == 4) { AI_Output(self,self,"DIA_ORC_PREACH_01_09"); // }; if(satz == 5) { AI_Output(self,self,"DIA_ORC_PREACH_01_11"); // }; if(satz == 6) { AI_Output(self,self,"DIA_ORC_PREACH_01_13"); // }; if(satz == 7) { AI_Output(self,self,"DIA_ORC_PREACH_01_15"); // }; if(satz == 8) { AI_Output(self,self,"DIA_ORC_PREACH_01_17"); // }; if(satz == 9) { AI_Output(self,self,"DIA_ORC_PREACH_01_19"); // }; if(satz == 10) { AI_Output(self,self,"DIA_ORC_PREACH_01_21"); // }; if(satz == 11) { AI_Output(self,self,"DIA_ORC_PREACH_01_23"); // }; if(satz == 12) { AI_Output(self,self,"DIA_ORC_PREACH_01_25"); // }; if(satz == 13) { AI_Output(self,self,"DIA_ORC_PREACH_01_27"); // }; if(satz == 14) { AI_Output(self,self,"DIA_ORC_PREACH_01_29"); // }; if(satz == 15) { AI_Output(self,self,"DIA_ORC_PREACH_01_31"); // }; if(satz == 16) { AI_Output(self,self,"DIA_ORC_PREACH_01_33"); // }; if(satz == 17) { AI_Output(self,self,"DIA_ORC_PREACH_01_35"); // }; if(satz == 18) { AI_Output(self,self,"DIA_ORC_PREACH_01_37"); // }; if(satz == 19) { AI_Output(self,self,"DIA_ORC_PREACH_01_39"); // }; } else { if(satz == 0) { AI_Output(self,self,"DIA_ORC_PREACH_01_02"); // }; if(satz == 1) { AI_Output(self,self,"DIA_ORC_PREACH_01_04"); // }; if(satz == 2) { AI_Output(self,self,"DIA_ORC_PREACH_01_06"); // }; if(satz == 3) { AI_Output(self,self,"DIA_ORC_PREACH_01_08"); // }; if(satz == 4) { AI_Output(self,self,"DIA_ORC_PREACH_01_10"); // }; if(satz == 5) { AI_Output(self,self,"DIA_ORC_PREACH_01_12"); // }; if(satz == 6) { AI_Output(self,self,"DIA_ORC_PREACH_01_14"); // }; if(satz == 7) { AI_Output(self,self,"DIA_ORC_PREACH_01_16"); // }; if(satz == 8) { AI_Output(self,self,"DIA_ORC_PREACH_01_18"); // }; if(satz == 9) { AI_Output(self,self,"DIA_ORC_PREACH_01_20"); // }; if(satz == 10) { AI_Output(self,self,"DIA_ORC_PREACH_01_22"); // }; if(satz == 11) { AI_Output(self,self,"DIA_ORC_PREACH_01_24"); // }; if(satz == 12) { AI_Output(self,self,"DIA_ORC_PREACH_01_26"); // }; if(satz == 13) { AI_Output(self,self,"DIA_ORC_PREACH_01_28"); // }; if(satz == 14) { AI_Output(self,self,"DIA_ORC_PREACH_01_30"); // }; if(satz == 15) { AI_Output(self,self,"DIA_ORC_PREACH_01_32"); // }; if(satz == 16) { AI_Output(self,self,"DIA_ORC_PREACH_01_34"); // }; if(satz == 17) { AI_Output(self,self,"DIA_ORC_PREACH_01_36"); // }; if(satz == 18) { AI_Output(self,self,"DIA_ORC_PREACH_01_38"); // }; if(satz == 19) { AI_Output(self,self,"DIA_ORC_PREACH_01_40"); // }; }; };
D
/** * Declarations for back end * * Compiler implementation of the * $(LINK2 https://www.dlang.org, D programming language). * * Copyright: Copyright (C) 1984-1998 by Symantec * Copyright (C) 2000-2023 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/backend/global.d, backend/global.d) */ module dmd.backend.global; // Online documentation: https://dlang.org/phobos/dmd_backend_global.html @nogc: nothrow: import core.stdc.stdio; import core.stdc.stdint; import dmd.backend.cdef; import dmd.backend.cc; import dmd.backend.cc : Symbol, block, Classsym, Blockx; import dmd.backend.code_x86 : code; import dmd.backend.code; import dmd.backend.dlist; import dmd.backend.el; import dmd.backend.el : elem; import dmd.backend.mem; import dmd.backend.symtab; import dmd.backend.type; //import dmd.backend.obj; import dmd.backend.barray; nothrow: @safe: // FIXME: backend can't import front end modules because missing -J flag extern (C++) void error(const(char)* filename, uint linnum, uint charnum, const(char)* format, ...); package extern (C++) void fatal(); public import dmd.backend.eh : except_gentables; import dmd.backend.var : _tysize; import dmd.backend.ty : TYnptr, TYvoid, tybasic, tysize; /*********************************** * Returns: aligned `offset` if it is of size `size`. */ targ_size_t _align(targ_size_t size, targ_size_t offset) @trusted { switch (size) { case 1: break; case 2: case 4: case 8: case 16: case 32: case 64: offset = (offset + size - 1) & ~(size - 1); break; default: if (size >= 16) offset = (offset + 15) & ~15; else offset = (offset + _tysize[TYnptr] - 1) & ~(_tysize[TYnptr] - 1); break; } return offset; } /******************************* * Get size of ty */ targ_size_t size(tym_t ty) @trusted { int sz = (tybasic(ty) == TYvoid) ? 1 : tysize(ty); debug { if (sz == -1) printf("ty: %s\n", tym_str(ty)); } assert(sz!= -1); return sz; } /**************************** * Generate symbol of type ty at DATA:offset */ Symbol *symboldata(targ_size_t offset, tym_t ty) { Symbol *s = symbol_generate(SC.locstat, type_fake(ty)); s.Sfl = FLdata; s.Soffset = offset; s.Stype.Tmangle = mTYman_sys; // writes symbol unmodified in Obj::mangle symbol_keep(s); // keep around return s; } /// Size of a register in bytes int REGSIZE() @trusted { return _tysize[TYnptr]; } public import dmd.backend.var : debuga, debugb, debugc, debugd, debuge, debugf, debugr, debugs, debugt, debugu, debugw, debugx, debugy; extern (D) uint mask(uint m) { return 1 << m; } public import dmd.backend.var : OPTIMIZER, PARSER, globsym, controlc_saw, pointertype, sytab; public import dmd.backend.cg : fregsaved, localgot, tls_get_addr_sym; public import dmd.backend.blockopt : startblock, dfo, curblock, block_last; __gshared Configv configv; // non-ph part of configuration public import dmd.backend.ee : eecontext_convs; public import dmd.backend.elem : exp2_copytotemp; public import dmd.backend.util2 : err_exit, ispow2; void* util_malloc(uint n,uint size) { return mem_malloc(n * size); } void* util_calloc(uint n,uint size) { return mem_calloc(n * size); } void util_free(void *p) { mem_free(p); } void *util_realloc(void *oldp,size_t n,size_t size) { return mem_realloc(oldp, n * size); } public import dmd.backend.cgcs : comsubs, cgcs_term; public import dmd.backend.evalu8; void err_nomem() @nogc nothrow @trusted { printf("Error: out of memory\n"); err_exit(); } void symbol_keep(Symbol *s) { } public import dmd.backend.symbol : symbol_print, symbol_term, symbol_ident, symbol_calloc, symbol_name, symbol_generate, symbol_genauto, symbol_genauto, symbol_genauto, symbol_func, symbol_funcalias, meminit_free, baseclass_find, baseclass_find_nest, baseclass_nitems, symbol_free, symbol_add, symbol_add, symbol_insert, freesymtab, symbol_copy, symbol_reset, symbol_pointerType; public import dmd.backend.cg87 : loadconst, cg87_reset; public import dmd.backend.cod3 : cod3_thunk; public import dmd.backend.dout : outthunk, out_readonly, out_readonly_comdat, out_regcand, writefunc, alignOffset, out_reset, out_readonly_sym, out_string_literal, outdata; public import dmd.backend.blockopt : bc_goal, block_calloc, block_init, block_term, block_next, block_next, block_goto, block_goto, block_goto, block_goto, block_ptr, block_pred, block_clearvisit, block_visit, block_compbcount, blocklist_free, block_optimizer_free, block_free, block_appendexp, block_endfunc, brcombine, blockopt, compdfo; public import dmd.backend.var : regstring; public import dmd.backend.debugprint; public import dmd.backend.cgelem : doptelem, postoptelem, elemisone; public import dmd.backend.gloop : dom; public import dmd.backend.util2 : binary; public import dmd.backend.go : go_flag, optfunc; public import dmd.backend.drtlsym : rtlsym_init, rtlsym_reset, rtlsym_term; public import dmd.backend.compress : id_compress; public import dmd.backend.dwarfdbginf : dwarf_CFA_set_loc, dwarf_CFA_set_reg_offset, dwarf_CFA_offset, dwarf_CFA_args_size;
D
module deimos.uv.errno_darwin; enum { UV__EOF = -4095 , UV__UNKNOWN = -4094 , UV__EAI_ADDRFAMILY = -3000 , UV__EAI_AGAIN = -3001 , UV__EAI_BADFLAGS = -3002 , UV__EAI_CANCELED = -3003 , UV__EAI_FAIL = -3004 , UV__EAI_FAMILY = -3005 , UV__EAI_MEMORY = -3006 , UV__EAI_NODATA = -3007 , UV__EAI_NONAME = -3008 , UV__EAI_OVERFLOW = -3009 , UV__EAI_SERVICE = -3010 , UV__EAI_SOCKTYPE = -3011 , UV__EAI_BADHINTS = -3013 , UV__EAI_PROTOCOL = -3014 , UV__E2BIG = -7 , UV__EACCES = -13 , UV__EADDRINUSE = -48 , UV__EADDRNOTAVAIL = -49 , UV__EAFNOSUPPORT = -47 , UV__EAGAIN = -35 , UV__EALREADY = -37 , UV__EBADF = -9 , UV__EBUSY = -16 , UV__ECANCELED = -89 , UV__ECHARSET = -4080 , UV__ECONNABORTED = -53 , UV__ECONNREFUSED = -61 , UV__ECONNRESET = -54 , UV__EDESTADDRREQ = -39 , UV__EEXIST = -17 , UV__EFAULT = -14 , UV__EHOSTUNREACH = -65 , UV__EINTR = -4 , UV__EINVAL = -22 , UV__EIO = -5 , UV__EISCONN = -56 , UV__EISDIR = -21 , UV__ELOOP = -62 , UV__EMFILE = -24 , UV__EMSGSIZE = -40 , UV__ENAMETOOLONG = -63 , UV__ENETDOWN = -50 , UV__ENETUNREACH = -51 , UV__ENFILE = -23 , UV__ENOBUFS = -55 , UV__ENODEV = -19 , UV__ENOENT = -2 , UV__ENOMEM = -12 , UV__ENONET = -4056 , UV__ENOSPC = -28 , UV__ENOSYS = -78 , UV__ENOTCONN = -57 , UV__ENOTDIR = -20 , UV__ENOTEMPTY = -66 , UV__ENOTSOCK = -38 , UV__ENOTSUP = -45 , UV__EPERM = -1 , UV__EPIPE = -32 , UV__EPROTO = -100 , UV__EPROTONOSUPPORT = -43 , UV__EPROTOTYPE = -41 , UV__EROFS = -30 , UV__ESHUTDOWN = -58 , UV__ESPIPE = -29 , UV__ESRCH = -3 , UV__ETIMEDOUT = -60 , UV__ETXTBSY = -26 , UV__EXDEV = -18 , UV__EFBIG = -27 , UV__ENOPROTOOPT = -42 , UV__ERANGE = -34 , UV__ENXIO = -6 , UV__EMLINK = -31 , UV__EHOSTDOWN = -64 , UV__EREMOTEIO = -4030 , UV__ENOTTY = -25 , UV__EFTYPE = -79 , UV__EILSEQ = -92 , UV__TFO = 261 , UV__POLLIN = 1 , UV__POLLOUT = 4 , UV__POLLRDHUP = 8192 , UV__POLLPRI = 2 , UV__UNKNOWN_REQ = 0 , UV__REQ = 1 , UV__CONNECT = 2 , UV__WRITE = 3 , UV__SHUTDOWN = 4 , UV__UDP_SEND = 5 , UV__FS = 6 , UV__WORK = 7 , UV__GETADDRINFO = 8 , UV__GETNAMEINFO = 9 , UV__REQ_TYPE_MAX = 11 , }
D
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric; void main() { writeln(`..#...... ......#.. ...#..... #......#. ....#.... .#......# .....#... ..#...... ......#..`); } /* ..#...... ......#.. ...#..... #......#. ....#.... .#......# .....#... ..#...... ......#.. */
D
/* * hunt-proton: AMQP Protocol library for D programming language. * * Copyright (C) 2018-2019 HuntLabs * * Website: https://www.huntlabs.net/ * * Licensed under the Apache-2.0 License. * */ module hunt.proton.codec.impl.UnsignedLongElement; import hunt.io.ByteBuffer; import std.conv; import hunt.proton.codec.impl.AtomicElement; import hunt.proton.codec.impl.Element; import hunt.proton.codec.impl.ArrayElement; import hunt.proton.codec.impl.AbstractElement; import hunt.proton.amqp.UnsignedLong; import hunt.proton.codec.Data; class UnsignedLongElement : AtomicElement!UnsignedLong { private UnsignedLong _value; this(IElement parent, IElement prev, UnsignedLong ul) { super(parent, prev); _value = ul; } public int size() { if(isElementOfArray()) { ArrayElement parent = cast(ArrayElement) parent(); if(parent.constructorType() == ArrayElement.TINY) { if(_value.longValue() == 0) { return 0; } else { parent.setConstructorType(ArrayElement.SMALL); } } if(parent.constructorType() == ArrayElement.SMALL) { if(0 <= _value.longValue() && _value.longValue() <= 255) { return 1; } else { parent.setConstructorType(ArrayElement.LARGE); } } return 8; } else { return 0 == _value.longValue() ? 1 : (1 <= _value.longValue() && _value.longValue() <= 255) ? 2 : 9; } } public Object getValue() { return _value; } public Data.DataType getDataType() { return Data.DataType.ULONG; } public int encode(ByteBuffer b) { int size = size(); if(size > b.remaining()) { return 0; } switch(size) { case 1: if(isElementOfArray()) { b.put(cast(byte)_value.longValue()); } else { b.put(cast(byte)0x44); } break; case 2: b.put(cast(byte)0x53); b.put(cast(byte)_value.longValue()); break; case 9: b.put(cast(byte)0x80); goto case; case 8: b.putLong(_value.longValue()); break; default: break; } return size; } }
D
not representative of a group, class, or type deviating from normal expectations
D
void main() { import std.stdio, std.string, std.conv, std.algorithm; int n, m; rd(n, m); writeln((2 ^^ m) * ((1900 * m) + (100 * (n - m)))); } void rd(T...)(ref T x) { import std.stdio : readln; import std.string : split; import std.conv : to; auto l = readln.split; assert(l.length == x.length); foreach (i, ref e; x) e = l[i].to!(typeof(e)); }
D
import std.stdio; int countDivisors(int n) { if (n < 2) { return 1; } int count = 2; // 1 and n for (int i = 2; i <= n/2; ++i) { if (n % i == 0) { ++count; } } return count; } void main() { int maxDiv, count; writeln("The first 20 anti-primes are:"); for (int n = 1; count < 20; ++n) { int d = countDivisors(n); if (d > maxDiv) { write(n, ' '); maxDiv = d; count++; } } writeln; }
D
/home/pjackim/downloads/eww/target/release/build/tokio-317a9437b5ac1e52/build_script_build-317a9437b5ac1e52: /home/pjackim/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.4.0/build.rs /home/pjackim/downloads/eww/target/release/build/tokio-317a9437b5ac1e52/build_script_build-317a9437b5ac1e52.d: /home/pjackim/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.4.0/build.rs /home/pjackim/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.4.0/build.rs:
D
module io.vfs.VirtualFolder; private import io.model; private import io.vfs.model; class ВиртуальнаяПапка : ХостВфс { private ткст name_; private ФайлВфс[ткст] файлы; private ПапкаВфс[ткст] грузы; private ЗаписьПапкиВфс[ткст] папки; private ВиртуальнаяПапка предок; this (ткст имя); final ткст имя(); final ткст вТкст(); ХостВфс прикрепи (ПапкаВфс папка, ткст имя = пусто); ХостВфс прикрепи (ПапкиВфс группа); ХостВфс открепи (ПапкаВфс папка); final ХостВфс карта (ФайлВфс файл, ткст имя); final ХостВфс карта (ЗаписьПапкиВфс папка, ткст имя); final цел opApply (цел delegate(ref ПапкаВфс) дг); final ЗаписьПапкиВфс папка (ткст путь); ФайлВфс файл (ткст путь); final ПапкаВфс очисть (); final бул записываемый (); final ПапкиВфс сам (); final ПапкиВфс дерево (); final проц проверь (ПапкаВфс папка, бул mounting); ПапкаВфс закрой (бул подай = да); package final ткст ошибка (ткст сооб); private final проц оцени (ткст имя); } private class ВиртуальныеПапки : ПапкиВфс { private ПапкиВфс[] члены; // папки in группа private this (); private this (ВиртуальнаяПапка корень, бул рекурсия); final цел opApply (цел delegate(ref ПапкаВфс) дг); final бцел файлы (); final бдол байты (); final бцел папки (); final бцел записи (); final ПапкиВфс поднабор (ткст образец); final ФайлыВфс каталог (ткст образец); final ФайлыВфс каталог (ФильтрВфс фильтр = пусто); } private class ВиртуальныеФайлы : ФайлыВфс { private ФайлыВфс[] члены; private this (ВиртуальныеПапки хост, ФильтрВфс фильтр); final цел opApply (цел delegate(ref ФайлВфс) дг); final бцел файлы (); final бдол байты (); }
D
/Users/petercernak/vapor/TILApp/Build/Intermediates.noindex/TILApp.build/Debug/Service.build/Objects-normal/x86_64/ContainerAlias.o : /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/ServiceID.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Utilities/Deprecated.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/Service.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/ServiceCache.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Utilities/Extendable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/ServiceType.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Config/Config.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Provider/Provider.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Container/Container.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Container/SubContainer.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Container/BasicSubContainer.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Container/BasicContainer.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Utilities/ServiceError.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Container/ContainerAlias.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/Services.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Utilities/Exports.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Environment/Environment.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/ServiceFactory.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/BasicServiceFactory.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/TypeServiceFactory.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIO.framework/Modules/NIO.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Async.framework/Modules/Async.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/COperatingSystem.framework/Modules/COperatingSystem.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOConcurrencyHelpers.framework/Modules/NIOConcurrencyHelpers.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOFoundationCompat.framework/Modules/NIOFoundationCompat.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/cpp_magic.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIODarwin/include/c_nio_darwin.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/c-atomics.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOLinux/include/c_nio_linux.h /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio-zlib-support.git--6538424668019974428/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOLinux/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/petercernak/vapor/TILApp/Build/Intermediates.noindex/TILApp.build/Debug/Service.build/Objects-normal/x86_64/ContainerAlias~partial.swiftmodule : /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/ServiceID.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Utilities/Deprecated.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/Service.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/ServiceCache.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Utilities/Extendable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/ServiceType.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Config/Config.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Provider/Provider.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Container/Container.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Container/SubContainer.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Container/BasicSubContainer.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Container/BasicContainer.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Utilities/ServiceError.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Container/ContainerAlias.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/Services.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Utilities/Exports.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Environment/Environment.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/ServiceFactory.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/BasicServiceFactory.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/TypeServiceFactory.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIO.framework/Modules/NIO.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Async.framework/Modules/Async.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/COperatingSystem.framework/Modules/COperatingSystem.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOConcurrencyHelpers.framework/Modules/NIOConcurrencyHelpers.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOFoundationCompat.framework/Modules/NIOFoundationCompat.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/cpp_magic.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIODarwin/include/c_nio_darwin.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/c-atomics.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOLinux/include/c_nio_linux.h /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio-zlib-support.git--6538424668019974428/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOLinux/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/petercernak/vapor/TILApp/Build/Intermediates.noindex/TILApp.build/Debug/Service.build/Objects-normal/x86_64/ContainerAlias~partial.swiftdoc : /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/ServiceID.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Utilities/Deprecated.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/Service.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/ServiceCache.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Utilities/Extendable.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/ServiceType.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Config/Config.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Provider/Provider.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Container/Container.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Container/SubContainer.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Container/BasicSubContainer.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Container/BasicContainer.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Utilities/ServiceError.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Container/ContainerAlias.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/Services.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Utilities/Exports.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Environment/Environment.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/ServiceFactory.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/BasicServiceFactory.swift /Users/petercernak/vapor/TILApp/.build/checkouts/service.git-4489542127361579605/Sources/Service/Services/TypeServiceFactory.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIO.framework/Modules/NIO.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Async.framework/Modules/Async.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/COperatingSystem.framework/Modules/COperatingSystem.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOConcurrencyHelpers.framework/Modules/NIOConcurrencyHelpers.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOFoundationCompat.framework/Modules/NIOFoundationCompat.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/cpp_magic.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIODarwin/include/c_nio_darwin.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/c-atomics.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOLinux/include/c_nio_linux.h /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio-zlib-support.git--6538424668019974428/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOLinux/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
instance DIA_OCPAL_9_EXIT(C_INFO) { nr = 999; condition = dia_ocpal_9_exit_condition; information = dia_ocpal_9_exit_info; permanent = TRUE; description = DIALOG_ENDE; }; func int dia_ocpal_9_exit_condition() { return TRUE; }; func void dia_ocpal_9_exit_info() { AI_StopProcessInfos(self); }; instance DIA_OCPAL_9_PEOPLE(C_INFO) { nr = 3; condition = dia_ocpal_9_people_condition; information = dia_ocpal_9_people_info; permanent = TRUE; description = "Кто командует здесь?"; }; func int dia_ocpal_9_people_condition() { return TRUE; }; func void dia_ocpal_9_people_info() { AI_Output(other,self,"DIA_OCPAL_9_PEOPLE_15_00"); //Кто командует здесь? AI_Output(self,other,"DIA_OCPAL_9_PEOPLE_09_01"); //Гаронд. Но его работе не позавидуешь. }; instance DIA_OCPAL_9_LOCATION(C_INFO) { nr = 2; condition = dia_ocpal_9_location_condition; information = dia_ocpal_9_location_info; permanent = TRUE; description = "Что ты знаешь об этой долине?"; }; func int dia_ocpal_9_location_condition() { return TRUE; }; func void dia_ocpal_9_location_info() { AI_Output(other,self,"DIA_OCPAL_9_LOCATION_15_00"); //Что ты знаешь об этой долине? AI_Output(self,other,"DIA_OCPAL_9_LOCATION_09_01"); //Ну, то что орки построили большую защитную стену. За этой стеной есть место, где они могут швартовать свои корабли. AI_Output(self,other,"DIA_OCPAL_9_LOCATION_09_02"); //Надеюсь, что орки не подтянут основные силы слишком быстро. По мне, так и тех, что уже есть, хватает с избытком. }; instance DIA_OCPAL_9_STANDARD(C_INFO) { nr = 1; condition = dia_ocpal_9_standard_condition; information = dia_ocpal_9_standard_info; permanent = TRUE; description = "Как дела?"; }; func int dia_ocpal_9_standard_condition() { return TRUE; }; func void dia_ocpal_9_standard_info() { AI_Output(other,self,"DIA_OCPAL_4_STANDARD_15_00"); //Как дела? if(KAPITEL <= 3) { AI_Output(self,other,"DIA_OCPAL_4_STANDARD_09_01"); //Драконы опять напали на нас! Но Иннос защитил нас в этом бою. Создания Белиара дорого заплатят за это! }; if(KAPITEL == 4) { if(MIS_KILLEDDRAGONS < 4) { AI_Output(self,other,"DIA_OCPAL_4_STANDARD_09_02"); //Охотники на драконов! Нужно было послать нас, паладинов! } else { AI_Output(self,other,"DIA_OCPAL_4_STANDARD_09_03"); //Теперь, когда мы избавились от этих драконов, мы можем разобраться с орками! }; }; if(KAPITEL >= 5) { if(MIS_OCGATEOPEN == FALSE) { AI_Output(self,other,"DIA_OCPAL_4_STANDARD_09_04"); //Нам нужно доставить руду на корабль и убираться с этой проклятой земли. } else { AI_Output(self,other,"DIA_OCPAL_4_STANDARD_09_05"); //Предательство! Ворота нельзя было открывать! Смерть предателям! }; }; }; func void b_assignambientinfos_ocpal_9(var C_NPC slf) { dia_ocpal_9_exit.npc = Hlp_GetInstanceID(slf); dia_ocpal_9_people.npc = Hlp_GetInstanceID(slf); dia_ocpal_9_location.npc = Hlp_GetInstanceID(slf); dia_ocpal_9_standard.npc = Hlp_GetInstanceID(slf); };
D
/Users/darshilagrawal/Desktop/CODING/rustPractice/ion_encoder/target/debug/deps/cfg_if-a87dda5fbe4aa893.rmeta: /Users/darshilagrawal/.cargo/registry/src/github.com-1ecc6299db9ec823/cfg-if-1.0.0/src/lib.rs /Users/darshilagrawal/Desktop/CODING/rustPractice/ion_encoder/target/debug/deps/libcfg_if-a87dda5fbe4aa893.rlib: /Users/darshilagrawal/.cargo/registry/src/github.com-1ecc6299db9ec823/cfg-if-1.0.0/src/lib.rs /Users/darshilagrawal/Desktop/CODING/rustPractice/ion_encoder/target/debug/deps/cfg_if-a87dda5fbe4aa893.d: /Users/darshilagrawal/.cargo/registry/src/github.com-1ecc6299db9ec823/cfg-if-1.0.0/src/lib.rs /Users/darshilagrawal/.cargo/registry/src/github.com-1ecc6299db9ec823/cfg-if-1.0.0/src/lib.rs:
D
/Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Console.build/Terminal/Terminal.swift.o : /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Terminal/ANSI.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Deprecated.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Console.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/ConsoleStyle.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Input/Console+Choose.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/ActivityIndicatorState.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Input/Console+Ask.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Terminal/Terminal.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Clear/Console+Ephemeral.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Input/Console+Confirm.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/LoadingBar.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/ProgressBar.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/ActivityBar.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Clear/Console+Clear.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Clear/ConsoleClear.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Utilities/ConsoleLogger.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/ActivityIndicatorRenderer.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/Console+Center.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/ConsoleColor.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Utilities/ConsoleError.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/ActivityIndicator.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Utilities/Exports.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/Console+Wait.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/ConsoleTextFragment.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Input/Console+Input.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/Console+Output.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/ConsoleText.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Service.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Logging.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/swift-nio.git-6105345694714423636/Sources/CNIOAtomics/include/cpp_magic.h /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/swift-nio.git-6105345694714423636/Sources/CNIODarwin/include/c_nio_darwin.h /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/swift-nio.git-6105345694714423636/Sources/CNIOAtomics/include/c-atomics.h /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/swift-nio.git-6105345694714423636/Sources/CNIOLinux/include/c_nio_linux.h /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/swift-nio-zlib-support.git--8656613645092558840/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Console.build/Terminal~partial.swiftmodule : /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Terminal/ANSI.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Deprecated.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Console.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/ConsoleStyle.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Input/Console+Choose.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/ActivityIndicatorState.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Input/Console+Ask.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Terminal/Terminal.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Clear/Console+Ephemeral.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Input/Console+Confirm.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/LoadingBar.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/ProgressBar.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/ActivityBar.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Clear/Console+Clear.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Clear/ConsoleClear.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Utilities/ConsoleLogger.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/ActivityIndicatorRenderer.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/Console+Center.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/ConsoleColor.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Utilities/ConsoleError.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/ActivityIndicator.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Utilities/Exports.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/Console+Wait.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/ConsoleTextFragment.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Input/Console+Input.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/Console+Output.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/ConsoleText.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Service.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Logging.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/swift-nio.git-6105345694714423636/Sources/CNIOAtomics/include/cpp_magic.h /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/swift-nio.git-6105345694714423636/Sources/CNIODarwin/include/c_nio_darwin.h /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/swift-nio.git-6105345694714423636/Sources/CNIOAtomics/include/c-atomics.h /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/swift-nio.git-6105345694714423636/Sources/CNIOLinux/include/c_nio_linux.h /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/swift-nio-zlib-support.git--8656613645092558840/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Console.build/Terminal~partial.swiftdoc : /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Terminal/ANSI.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Deprecated.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Console.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/ConsoleStyle.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Input/Console+Choose.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/ActivityIndicatorState.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Input/Console+Ask.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Terminal/Terminal.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Clear/Console+Ephemeral.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Input/Console+Confirm.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/LoadingBar.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/ProgressBar.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/ActivityBar.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Clear/Console+Clear.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Clear/ConsoleClear.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Utilities/ConsoleLogger.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/ActivityIndicatorRenderer.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/Console+Center.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/ConsoleColor.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Utilities/ConsoleError.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Activity/ActivityIndicator.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Utilities/Exports.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/Console+Wait.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/ConsoleTextFragment.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Input/Console+Input.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/Console+Output.swift /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/console.git-8669534691655913401/Sources/Console/Output/ConsoleText.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Service.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Logging.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/swift-nio.git-6105345694714423636/Sources/CNIOAtomics/include/cpp_magic.h /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/swift-nio.git-6105345694714423636/Sources/CNIODarwin/include/c_nio_darwin.h /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/swift-nio.git-6105345694714423636/Sources/CNIOAtomics/include/c-atomics.h /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/swift-nio.git-6105345694714423636/Sources/CNIOLinux/include/c_nio_linux.h /Users/jimallan/Downloads/starter/location-track-server/.build/checkouts/swift-nio-zlib-support.git--8656613645092558840/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/jimallan/Downloads/starter/location-track-server/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
/******************************************************************************* * Copyright (c) 2000, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * Port to the D programming language: * Frank Benoit <benoit@tionex.de> *******************************************************************************/ module org.eclipse.swt.events.HelpEvent; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.events.TypedEvent; /** * Instances of this class are sent as a result of * help being requested for a widget. * * @see HelpListener * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public final class HelpEvent : TypedEvent { //static const long serialVersionUID = 3257001038606251315L; /** * Constructs a new instance of this class based on the * information in the given untyped event. * * @param e the untyped event containing the information */ public this(Event e) { super(e); } }
D
module android.java.java.util.function_.ToDoubleFunction; public import android.java.java.util.function_.ToDoubleFunction_d_interface; import arsd.jni : ImportExportImpl; mixin ImportExportImpl!ToDoubleFunction; import import0 = android.java.java.lang.Class;
D
/Users/hyungsukkang/Documents/product_hunt_clone/frontend/target/debug/deps/frontend-b3777e43f6db3cac.rmeta: src/lib.rs /Users/hyungsukkang/Documents/product_hunt_clone/frontend/target/debug/deps/frontend-b3777e43f6db3cac.d: src/lib.rs src/lib.rs:
D
instance DIA_BROMOR_EXIT(C_INFO) { npc = vlk_433_bromor; nr = 999; condition = dia_bromor_exit_condition; information = dia_bromor_exit_info; permanent = TRUE; description = DIALOG_ENDE; }; func int dia_bromor_exit_condition() { return TRUE; }; func void dia_bromor_exit_info() { b_npcclearobsessionbydmt(self); }; instance DIA_BROMOR_GIRLS(C_INFO) { npc = vlk_433_bromor; nr = 2; condition = dia_bromor_girls_condition; information = dia_bromor_girls_info; permanent = FALSE; description = "Я хочу развлечься."; }; func int dia_bromor_girls_condition() { if(NPCOBSESSEDBYDMT_BROMOR == FALSE) { return TRUE; }; }; func void dia_bromor_girls_info() { AI_Output(other,self,"DIA_Bromor_Pay_15_00"); //Я хочу развлечься. AI_Output(self,other,"DIA_Bromor_GIRLS_07_01"); //Ну да, все сюда за этим приходят. AI_Output(self,other,"DIA_Bromor_GIRLS_07_02"); //Я Бромор. Это мой дом, а это мои девочки. Я люблю моих девочек. AI_Output(self,other,"DIA_Bromor_GIRLS_07_03"); //А если ты любишь моих девочек тоже, ты должен заплатить за это 50 золотых монет. AI_Output(self,other,"DIA_Bromor_GIRLS_07_04"); //Смотри только, чтобы никаких проблем. }; instance DIA_BROMOR_PAY(C_INFO) { npc = vlk_433_bromor; nr = 2; condition = dia_bromor_pay_condition; information = dia_bromor_pay_info; permanent = TRUE; description = "Я хочу развлечься (заплатить 50 золотых)."; }; func int dia_bromor_pay_condition() { if((BROMOR_PAY == FALSE) && Npc_KnowsInfo(other,dia_bromor_girls) && (NPCOBSESSEDBYDMT_BROMOR == FALSE) && (Npc_IsDead(nadja) == FALSE)) { return TRUE; }; }; var int dia_bromor_pay_onetime; func void dia_bromor_pay_info() { AI_Output(other,self,"DIA_Bromor_Pay_15_00"); //Я хочу развлечься. if(b_giveinvitems(other,self,itmi_gold,50)) { AI_Output(self,other,"DIA_Bromor_Pay_07_01"); //Отлично. (ухмыляется) Ты долго не забудешь следующие несколько часов твоей жизни. AI_Output(self,other,"DIA_Bromor_Pay_07_02"); //Иди наверх с Надей. Удачи. if(DIA_BROMOR_PAY_ONETIME == FALSE) { DIA_BROMOR_PAY_ONETIME = TRUE; }; BROMOR_PAY = 1; } else { AI_Output(self,other,"DIA_Bromor_Pay_07_03"); //Я не выношу, когда кто-нибудь пытается надуть меня. Убирайся отсюда, если не можешь заплатить. }; b_npcclearobsessionbydmt(self); }; instance DIA_BROMOR_DOPE(C_INFO) { npc = vlk_433_bromor; nr = 3; condition = dia_bromor_dope_condition; information = dia_bromor_dope_info; permanent = FALSE; description = "А могу я рассчитывать на 'особые' услуги, а?"; }; func int dia_bromor_dope_condition() { if((MIS_ANDRE_REDLIGHT == LOG_RUNNING) && (NPCOBSESSEDBYDMT_BROMOR == FALSE)) { return TRUE; }; }; func void dia_bromor_dope_info() { AI_Output(other,self,"DIA_Bromor_DOPE_15_00"); //А могу я рассчитывать на 'особые' услуги, а? AI_Output(self,other,"DIA_Bromor_DOPE_07_01"); //Конечно, все мои девочки особенные. (ухмыляется) AI_Output(self,other,"DIA_Bromor_DOPE_07_02"); //Если у тебя есть деньги, ты можешь пойти наверх с Надей. }; instance DIA_BROMOR_OBSESSION(C_INFO) { npc = vlk_433_bromor; nr = 30; condition = dia_bromor_obsession_condition; information = dia_bromor_obsession_info; description = "Все в порядке?"; }; func int dia_bromor_obsession_condition() { if((KAPITEL >= 3) && (NPCOBSESSEDBYDMT_BROMOR == FALSE) && (hero.guild == GIL_KDF)) { return TRUE; }; }; var int dia_bromor_obsession_gotmoney; func void dia_bromor_obsession_info() { b_npcobsessedbydmt(self); }; instance DIA_BROMOR_HEILUNG(C_INFO) { npc = vlk_433_bromor; nr = 55; condition = dia_bromor_heilung_condition; information = dia_bromor_heilung_info; permanent = TRUE; description = "Ты одержим."; }; func int dia_bromor_heilung_condition() { if((NPCOBSESSEDBYDMT_BROMOR == TRUE) && (NPCOBSESSEDBYDMT == FALSE) && (hero.guild == GIL_KDF)) { return TRUE; }; }; func void dia_bromor_heilung_info() { AI_Output(other,self,"DIA_Bromor_Heilung_15_00"); //Ты одержим. AI_Output(self,other,"DIA_Bromor_Heilung_07_01"); //Что? О чем это ты? Убирайся отсюда. b_npcclearobsessionbydmt(self); }; instance DIA_BROMOR_PICKPOCKET(C_INFO) { npc = vlk_433_bromor; nr = 900; condition = dia_bromor_pickpocket_condition; information = dia_bromor_pickpocket_info; permanent = TRUE; description = "(воровать этот ключ рискованно)"; }; func int dia_bromor_pickpocket_condition() { if((Npc_GetTalentSkill(other,NPC_TALENT_PICKPOCKET) == 1) && (self.aivar[AIV_PLAYERHASPICKEDMYPOCKET] == FALSE) && (Npc_HasItems(self,itke_bromor) >= 1) && (other.attribute[ATR_DEXTERITY] >= (50 - THEFTDIFF))) { return TRUE; }; }; func void dia_bromor_pickpocket_info() { Info_ClearChoices(dia_bromor_pickpocket); Info_AddChoice(dia_bromor_pickpocket,DIALOG_BACK,dia_bromor_pickpocket_back); Info_AddChoice(dia_bromor_pickpocket,DIALOG_PICKPOCKET,dia_bromor_pickpocket_doit); }; func void dia_bromor_pickpocket_doit() { if(other.attribute[ATR_DEXTERITY] >= 50) { b_giveinvitems(self,other,itke_bromor,1); b_givethiefxp(); Info_ClearChoices(dia_bromor_pickpocket); } else { AI_StopProcessInfos(self); b_attack(self,other,AR_THEFT,1); }; }; func void dia_bromor_pickpocket_back() { Info_ClearChoices(dia_bromor_pickpocket); };
D
instance Mil_315_Kasernenwache(Npc_Default) { name[0] = NAME_Miliz; guild = GIL_MIL; id = 315; voice = 7; flags = 0; npcType = NPCTYPE_AMBIENT; B_SetAttributesToChapter(self,3); fight_tactic = FAI_HUMAN_STRONG; EquipItem(self,ItMw_1h_Mil_Sword); B_CreateAmbientInv(self); B_SetNpcVisual(self,MALE,"Hum_Head_Fighter",Face_N_Tough_Skip,BodyTex_N,ITAR_Mil_L); Mdl_SetModelFatness(self,0); Mdl_ApplyOverlayMds(self,"Humans_Militia.mds"); B_GiveNpcTalents(self); B_SetFightSkills(self,55); daily_routine = Rtn_Start_315; }; func void Rtn_Start_315() { TA_Smith_Sharp(7,5,20,59,"NW_CITY_KASERN_ARMORY_SHARP"); TA_Sit_Campfire(20,59,0,3,"NW_CITY_BARRACK02_SMALLTALK_01"); TA_Sleep(0,3,7,5,"NW_CITY_BARRACK01_BED_RUGA"); };
D
a special anniversary (or the celebration of it)
D
a small hairpiece to cover partial baldness
D
/Users/apple-1/Downloads/HouseKeeping/Build/Intermediates/HouseKeeping.build/Debug-iphonesimulator/HouseKeeping.build/Objects-normal/x86_64/TableViewCell2.o : /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/DetailsPending.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignTasksPending.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/VCCells.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/currentTask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Forgotpassword.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/PageView3.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/PageView.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/ConversationsVC.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/WelcomeVC.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/CheckLists.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/LandingVC.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/workHistoryCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Distribute.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/ViewController.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblHistoryAll.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/taskDescription.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/reassignTask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Message.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/AppDelegate.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/checkListCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Conversation.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/individualEmpTask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignTasksAll.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/viewAdminTask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/viewCompletedtask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/FullSizeImage.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/AlertsViewController.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/viewTaskViewController.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignTasksCompleted.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblHistoryCompleted.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/home.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignTo.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/TableViewCell2.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignToCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/PageView2.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Helper\ Files.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/AllTasksCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/viewCompletedChecklist.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/ViewController2.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/EmployeeLoginHome.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/roomsCollectionViewCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/EmployeeLoginCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/DatePickerDialog.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/TBLViewEmpDND.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/TblViewEmplLoginPending.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/User.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/HADropDown.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/EmployeeDetails.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblHistoryDND.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Distributetask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblHistoryPending.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/ChatVC.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/NavVC.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/TaskType.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignTasksOnProgress.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/getJSONAssignedTasks&Workers.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/WorkHistory.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblHistoryOnprogress.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblDoNotDistrub.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/TblViewEmplLoginCompleted.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/selectedHistory.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Pods/Firebase/Core/Sources/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Alamofire/Alamofire.framework/Modules/Alamofire.swiftmodule/x86_64.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Alamofire/Alamofire.framework/Headers/Alamofire-Swift.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Alamofire/Alamofire.framework/Headers/Alamofire-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Alamofire/Alamofire.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftyJSON/SwiftyJSON.framework/Modules/SwiftyJSON.swiftmodule/x86_64.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftyJSON/SwiftyJSON.framework/Headers/SwiftyJSON-Swift.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftyJSON/SwiftyJSON.framework/Headers/SwiftyJSON-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftyJSON/SwiftyJSON.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Fusuma/Fusuma.framework/Modules/Fusuma.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Fusuma/Fusuma.framework/Headers/Fusuma-Swift.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Fusuma/Fusuma.framework/Headers/Fusuma-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Fusuma/Fusuma.framework/Modules/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Photos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreLocation.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftSpinner/SwiftSpinner.framework/Modules/SwiftSpinner.swiftmodule/x86_64.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftSpinner/SwiftSpinner.framework/Headers/SwiftSpinner-Swift.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftSpinner/SwiftSpinner.framework/Headers/SwiftSpinner.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftSpinner/SwiftSpinner.framework/Headers/SwiftSpinner-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftSpinner/SwiftSpinner.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIROptions.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRLoggerLevel.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRConfiguration.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRApp.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRCoreSwiftNameSupport.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRAnalyticsConfiguration.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FirebaseCore.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRParameterNames.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIREventNames.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsSwiftNameSupport.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics+AppDelegate.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIROptions.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRConfiguration.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRApp.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsConfiguration.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FirebaseAuthVersion.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRUserInfo.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRUser.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuthDataResult.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAdditionalUserInfo.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRTwitterAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuthErrors.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuthAPNSTokenType.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuth.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRPhoneAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuthCredential.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRPhoneAuthCredential.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIROAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRGoogleAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRGitHubAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRFacebookAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuthSwiftNameSupport.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIREmailAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FirebaseAuth.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRServerValue.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRTransactionResult.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRMutableData.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabaseQuery.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabaseReference.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabase.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDataSnapshot.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabaseSwiftNameSupport.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDataEventType.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FirebaseDatabase.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseMessaging/Frameworks/FirebaseMessaging.framework/Headers/FIRMessaging.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseMessaging/Frameworks/FirebaseMessaging.framework/Headers/FirebaseMessaging.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseMessaging/Frameworks/FirebaseMessaging.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageTaskSnapshot.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageUploadTask.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageReference.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageMetadata.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageTask.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageObservableTask.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageDownloadTask.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageSwiftNameSupport.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageConstants.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorage.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FirebaseStorage.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/Firebase/Core/Sources/Firebase.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/LIHAlert/LIHAlert.framework/Modules/LIHAlert.swiftmodule/x86_64.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/LIHAlert/LIHAlert.framework/Headers/LIHAlert-Swift.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/LIHAlert/LIHAlert.framework/Headers/LIHAlert-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/LIHAlert/LIHAlert.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/SWActionSheet.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetStringPicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetPicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetMultipleStringPicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetLocalePicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/DistancePickerView.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetDistancePicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetDatePicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetCustomPickerDelegate.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetCustomPicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/AbstractActionSheetPicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetPicker-3.0-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Modules/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/MapKit.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Intermediates/HouseKeeping.build/Debug-iphonesimulator/HouseKeeping.build/Objects-normal/x86_64/TableViewCell2~partial.swiftmodule : /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/DetailsPending.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignTasksPending.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/VCCells.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/currentTask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Forgotpassword.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/PageView3.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/PageView.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/ConversationsVC.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/WelcomeVC.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/CheckLists.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/LandingVC.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/workHistoryCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Distribute.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/ViewController.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblHistoryAll.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/taskDescription.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/reassignTask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Message.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/AppDelegate.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/checkListCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Conversation.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/individualEmpTask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignTasksAll.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/viewAdminTask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/viewCompletedtask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/FullSizeImage.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/AlertsViewController.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/viewTaskViewController.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignTasksCompleted.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblHistoryCompleted.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/home.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignTo.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/TableViewCell2.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignToCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/PageView2.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Helper\ Files.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/AllTasksCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/viewCompletedChecklist.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/ViewController2.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/EmployeeLoginHome.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/roomsCollectionViewCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/EmployeeLoginCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/DatePickerDialog.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/TBLViewEmpDND.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/TblViewEmplLoginPending.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/User.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/HADropDown.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/EmployeeDetails.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblHistoryDND.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Distributetask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblHistoryPending.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/ChatVC.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/NavVC.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/TaskType.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignTasksOnProgress.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/getJSONAssignedTasks&Workers.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/WorkHistory.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblHistoryOnprogress.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblDoNotDistrub.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/TblViewEmplLoginCompleted.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/selectedHistory.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Pods/Firebase/Core/Sources/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Alamofire/Alamofire.framework/Modules/Alamofire.swiftmodule/x86_64.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Alamofire/Alamofire.framework/Headers/Alamofire-Swift.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Alamofire/Alamofire.framework/Headers/Alamofire-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Alamofire/Alamofire.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftyJSON/SwiftyJSON.framework/Modules/SwiftyJSON.swiftmodule/x86_64.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftyJSON/SwiftyJSON.framework/Headers/SwiftyJSON-Swift.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftyJSON/SwiftyJSON.framework/Headers/SwiftyJSON-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftyJSON/SwiftyJSON.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Fusuma/Fusuma.framework/Modules/Fusuma.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Fusuma/Fusuma.framework/Headers/Fusuma-Swift.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Fusuma/Fusuma.framework/Headers/Fusuma-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Fusuma/Fusuma.framework/Modules/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Photos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreLocation.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftSpinner/SwiftSpinner.framework/Modules/SwiftSpinner.swiftmodule/x86_64.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftSpinner/SwiftSpinner.framework/Headers/SwiftSpinner-Swift.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftSpinner/SwiftSpinner.framework/Headers/SwiftSpinner.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftSpinner/SwiftSpinner.framework/Headers/SwiftSpinner-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftSpinner/SwiftSpinner.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIROptions.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRLoggerLevel.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRConfiguration.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRApp.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRCoreSwiftNameSupport.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRAnalyticsConfiguration.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FirebaseCore.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRParameterNames.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIREventNames.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsSwiftNameSupport.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics+AppDelegate.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIROptions.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRConfiguration.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRApp.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsConfiguration.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FirebaseAuthVersion.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRUserInfo.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRUser.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuthDataResult.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAdditionalUserInfo.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRTwitterAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuthErrors.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuthAPNSTokenType.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuth.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRPhoneAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuthCredential.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRPhoneAuthCredential.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIROAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRGoogleAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRGitHubAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRFacebookAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuthSwiftNameSupport.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIREmailAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FirebaseAuth.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRServerValue.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRTransactionResult.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRMutableData.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabaseQuery.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabaseReference.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabase.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDataSnapshot.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabaseSwiftNameSupport.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDataEventType.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FirebaseDatabase.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseMessaging/Frameworks/FirebaseMessaging.framework/Headers/FIRMessaging.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseMessaging/Frameworks/FirebaseMessaging.framework/Headers/FirebaseMessaging.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseMessaging/Frameworks/FirebaseMessaging.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageTaskSnapshot.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageUploadTask.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageReference.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageMetadata.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageTask.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageObservableTask.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageDownloadTask.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageSwiftNameSupport.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageConstants.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorage.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FirebaseStorage.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/Firebase/Core/Sources/Firebase.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/LIHAlert/LIHAlert.framework/Modules/LIHAlert.swiftmodule/x86_64.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/LIHAlert/LIHAlert.framework/Headers/LIHAlert-Swift.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/LIHAlert/LIHAlert.framework/Headers/LIHAlert-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/LIHAlert/LIHAlert.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/SWActionSheet.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetStringPicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetPicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetMultipleStringPicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetLocalePicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/DistancePickerView.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetDistancePicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetDatePicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetCustomPickerDelegate.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetCustomPicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/AbstractActionSheetPicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetPicker-3.0-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Modules/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/MapKit.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Intermediates/HouseKeeping.build/Debug-iphonesimulator/HouseKeeping.build/Objects-normal/x86_64/TableViewCell2~partial.swiftdoc : /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/DetailsPending.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignTasksPending.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/VCCells.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/currentTask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Forgotpassword.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/PageView3.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/PageView.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/ConversationsVC.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/WelcomeVC.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/CheckLists.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/LandingVC.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/workHistoryCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Distribute.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/ViewController.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblHistoryAll.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/taskDescription.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/reassignTask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Message.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/AppDelegate.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/checkListCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Conversation.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/individualEmpTask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignTasksAll.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/viewAdminTask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/viewCompletedtask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/FullSizeImage.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/AlertsViewController.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/viewTaskViewController.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignTasksCompleted.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblHistoryCompleted.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/home.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignTo.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/TableViewCell2.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignToCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/PageView2.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Helper\ Files.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/AllTasksCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/viewCompletedChecklist.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/ViewController2.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/EmployeeLoginHome.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/roomsCollectionViewCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/EmployeeLoginCell.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/DatePickerDialog.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/TBLViewEmpDND.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/TblViewEmplLoginPending.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/User.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/HADropDown.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/EmployeeDetails.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblHistoryDND.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/Distributetask.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblHistoryPending.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/ChatVC.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/NavVC.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/TaskType.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblAssignTasksOnProgress.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/getJSONAssignedTasks&Workers.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/WorkHistory.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblHistoryOnprogress.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/tblDoNotDistrub.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/TblViewEmplLoginCompleted.swift /Users/apple-1/Downloads/HouseKeeping/HouseKeeping/selectedHistory.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Pods/Firebase/Core/Sources/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Alamofire/Alamofire.framework/Modules/Alamofire.swiftmodule/x86_64.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Alamofire/Alamofire.framework/Headers/Alamofire-Swift.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Alamofire/Alamofire.framework/Headers/Alamofire-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Alamofire/Alamofire.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftyJSON/SwiftyJSON.framework/Modules/SwiftyJSON.swiftmodule/x86_64.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftyJSON/SwiftyJSON.framework/Headers/SwiftyJSON-Swift.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftyJSON/SwiftyJSON.framework/Headers/SwiftyJSON-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftyJSON/SwiftyJSON.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Fusuma/Fusuma.framework/Modules/Fusuma.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Fusuma/Fusuma.framework/Headers/Fusuma-Swift.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Fusuma/Fusuma.framework/Headers/Fusuma-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/Fusuma/Fusuma.framework/Modules/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Photos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreLocation.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftSpinner/SwiftSpinner.framework/Modules/SwiftSpinner.swiftmodule/x86_64.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftSpinner/SwiftSpinner.framework/Headers/SwiftSpinner-Swift.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftSpinner/SwiftSpinner.framework/Headers/SwiftSpinner.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftSpinner/SwiftSpinner.framework/Headers/SwiftSpinner-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/SwiftSpinner/SwiftSpinner.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIROptions.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRLoggerLevel.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRConfiguration.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRApp.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRCoreSwiftNameSupport.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRAnalyticsConfiguration.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FirebaseCore.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRParameterNames.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIREventNames.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsSwiftNameSupport.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics+AppDelegate.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIROptions.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRConfiguration.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRApp.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsConfiguration.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FirebaseAuthVersion.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRUserInfo.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRUser.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuthDataResult.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAdditionalUserInfo.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRTwitterAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuthErrors.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuthAPNSTokenType.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuth.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRPhoneAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuthCredential.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRPhoneAuthCredential.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIROAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRGoogleAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRGitHubAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRFacebookAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIRAuthSwiftNameSupport.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FIREmailAuthProvider.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers/FirebaseAuth.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRServerValue.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRTransactionResult.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRMutableData.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabaseQuery.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabaseReference.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabase.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDataSnapshot.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDatabaseSwiftNameSupport.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FIRDataEventType.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers/FirebaseDatabase.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseMessaging/Frameworks/FirebaseMessaging.framework/Headers/FIRMessaging.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseMessaging/Frameworks/FirebaseMessaging.framework/Headers/FirebaseMessaging.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseMessaging/Frameworks/FirebaseMessaging.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageTaskSnapshot.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageUploadTask.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageReference.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageMetadata.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageTask.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageObservableTask.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageDownloadTask.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageSwiftNameSupport.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorageConstants.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FIRStorage.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Headers/FirebaseStorage.h /Users/apple-1/Downloads/HouseKeeping/Pods/FirebaseStorage/Frameworks/FirebaseStorage.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Pods/Firebase/Core/Sources/Firebase.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/LIHAlert/LIHAlert.framework/Modules/LIHAlert.swiftmodule/x86_64.swiftmodule /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/LIHAlert/LIHAlert.framework/Headers/LIHAlert-Swift.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/LIHAlert/LIHAlert.framework/Headers/LIHAlert-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/LIHAlert/LIHAlert.framework/Modules/module.modulemap /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/SWActionSheet.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetStringPicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetPicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetMultipleStringPicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetLocalePicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/DistancePickerView.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetDistancePicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetDatePicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetCustomPickerDelegate.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetCustomPicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/AbstractActionSheetPicker.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Headers/ActionSheetPicker-3.0-umbrella.h /Users/apple-1/Downloads/HouseKeeping/Build/Products/Debug-iphonesimulator/ActionSheetPicker-3.0/ActionSheetPicker_3_0.framework/Modules/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/MapKit.swiftmodule
D
/** * Defines the `ESParams` type for use in the API * * Copyright: © 2015 David Monagle * License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file. * Authors: David Monagle */ module elasticsearch.api.parameters; import vibe.utils.dictionarylist; import elasticsearch.api.exceptions; import core.exception; import std.array; import std.algorithm; import std.string; /// Common ES parameters static enum ES_COMMON_PARAMETERS = [ "ignore", //"index", "type", "id", //"body", "node_id", "name", "field" ]; /// Common ES parameters used in queries static enum ES_COMMON_QUERY_PARAMETERS = [ "format", "pretty", "human" ]; /// ESParams is just an alias for a vibe.d dictionary list alias ESParams = vibe.inet.message.InetHeaderMap; bool hasField(const ref ESParams p, string key) { return cast(bool)(key in p); } /// Filters the given `ESParams` to only include the given keys. Returns a new range containing the allowed keys ESParams filterESParams(const ref ESParams p, string[] allowed ...) { import std.algorithm; ESParams returnParams; foreach(key, value; p) { if (allowed.canFind(key)) returnParams.addField(key, value); } return returnParams; } unittest { ESParams p; p["one"] = "Hello"; p["two"] = "Goodbye"; auto filtered = p.filterESParams("one"); assert(filtered.hasField("one")); assert(!filtered.hasField("two")); } /// Returns the value of the supplied `ESParams ` or returns the defaultValue if it doesn't exist T valueOrDefault(T)(ESParams p, string key, T defaultValue) { import std.conv; if (key !in p) return defaultValue; return p[key].to!T; } unittest { ESParams p; p["one"] = "1"; assert(p.valueOrDefault("one", 2) == 1); assert(p.valueOrDefault("two", 2) == 2); } /// Throws an argument exception if the given parameter is not included in `p` void enforceParameter(const ref ESParams p, string name) { enforce(p.hasField(name), new ArgumentException(p, name ~ " parameter is required")); } /// Sets a parameter to a default value if if does not exist void defaultParameter(ref ESParams p, string name, string defaultValue) { if(!p.hasField(name)) p[name] = defaultValue; } /// Returns a new list of params which will only included common parameters plus those `allowed` passed in parameters ESParams validateAndExtract(const ref ESParams params, string[] allowed ...) { return params.filterESParams(allowed ~ ES_COMMON_PARAMETERS ~ ES_COMMON_QUERY_PARAMETERS); } /// Escapes the given string for use with ES API string esEscape(string value) { import std.uri; return encodeComponent(value); } /// Takes an array of strings representing a path and returns a clean path string string esPathify(string[] path ...) { auto stripped = array(path.map!((p) => p.strip)); auto cleanPath = stripped.remove!((p) => !p.length); auto returnString = cleanPath.join("/"); return returnString.squeeze("/"); } unittest { assert(esPathify("hello/", "", " world") == "hello/world"); } /// Create a list from the given arguments string esListify(string[] list ...) { auto cleanList = list.remove!((p) => !p.length); auto escaped = array(cleanList.map!((l) => l.esEscape)); return escaped.join(","); } unittest { assert(esListify("A", "B") == "A,B"); assert(esListify("one", "two^three") == "one,two%5Ethree"); }
D
module mahjong.engine; import mahjong.domain.metagame; import mahjong.domain.opts; import mahjong.domain.player; import mahjong.engine.flow; import mahjong.engine.notifications; class Engine { this(GameEventHandler[] eventHandlers, const Opts opts, INotificationService notificationService) { Player[] players = new Player[eventHandlers.length]; foreach (i, handler; eventHandlers) { auto player = new Player(opts.initialScore); players[i] = player; _players[player] = handler; } _metagame = new Metagame(players, opts); _notificationService = notificationService; } void boot() { _flow = new GameStartFlow(_metagame, _notificationService, this); } @("When starting the game, the game should be in the GameStartFlow") unittest { import fluent.asserts; auto eventHandler = new TestEventHandler; auto engine = new Engine([eventHandler], new DefaultGameOpts, new NullNotificationService); engine.boot; engine.flow.should.be.instanceOf!GameStartFlow; } @("A metagame has been created") unittest { import fluent.asserts; auto eventHandler = new TestEventHandler; auto engine = new Engine([eventHandler], new DefaultGameOpts, new NullNotificationService); engine.boot; auto flow = engine.flow; flow.metagame.should.not.beNull; flow.metagame.players.length.should.equal(1); } private Flow _flow; private GameEventHandler[const(Player)] _players; private Metagame _metagame; private INotificationService _notificationService; version (mahjong_test) { this(Metagame metagame) { _metagame = metagame; _notificationService = new NullNotificationService; foreach (player; metagame.players) { _players[player] = new TestEventHandler; } } this(Metagame metagame, GameEventHandler[] eventHandlers) in(metagame.players.length == eventHandlers.length, "Should supply as many handlers as players") { _metagame = metagame; _notificationService = new NullNotificationService; foreach (i, player; metagame.players) { _players[player] = eventHandlers[i]; } } Metagame metagame() { return _metagame; } TestEventHandler getTestEventHandler(const Player player) { return cast(TestEventHandler)_players[player]; } } void switchFlow(Flow newFlow) pure in(newFlow !is null, "A new flow should be supplied") { _flow = newFlow; } void terminateGame() pure { _flow = null; } package void notify(Event)(const Player player, Event event) { _players[player].handle(event); } const(Flow) flow() @property pure const { return _flow; } bool isTerminated() @property pure const { return _flow is null; } @("Can I terminate the game") unittest { import fluent.asserts; auto eventHandler = new TestEventHandler; auto engine = new Engine([eventHandler], new DefaultGameOpts, new NullNotificationService); engine.boot; engine.isTerminated.should.equal(false); engine.terminateGame; engine.isTerminated.should.equal(true); } void advanceIfDone() { _flow.advanceIfDone(this); } }
D
/Users/thendral/POC/vapor/Friends/.build/debug/Jay.build/ArrayParser.swift.o : /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/ArrayParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/BooleanParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/ByteReader.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/CommentParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Consts.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Error.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Extensions.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Formatter.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Jay.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/NativeParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/NativeTypeConversions.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/NullParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/NumberParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/ObjectParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/OutputStream.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Parser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Reader.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/RootParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/StringParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Types.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/ValueParser.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/thendral/POC/vapor/Friends/.build/debug/Jay.build/ArrayParser~partial.swiftmodule : /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/ArrayParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/BooleanParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/ByteReader.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/CommentParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Consts.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Error.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Extensions.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Formatter.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Jay.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/NativeParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/NativeTypeConversions.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/NullParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/NumberParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/ObjectParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/OutputStream.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Parser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Reader.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/RootParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/StringParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Types.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/ValueParser.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/thendral/POC/vapor/Friends/.build/debug/Jay.build/ArrayParser~partial.swiftdoc : /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/ArrayParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/BooleanParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/ByteReader.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/CommentParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Consts.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Error.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Extensions.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Formatter.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Jay.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/NativeParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/NativeTypeConversions.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/NullParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/NumberParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/ObjectParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/OutputStream.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Parser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Reader.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/RootParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/StringParser.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/Types.swift /Users/thendral/POC/vapor/Friends/Packages/Jay-1.0.1/Sources/Jay/ValueParser.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule
D
INSTANCE Mod_7282_OUT_Buerger_REL (Npc_Default) { // ------ NSC ------ name = "Bürger"; guild = GIL_OUT; id = 7282; voice = 6; flags = 0; npctype = NPCTYPE_REL_BUERGER; // ------ Attribute ------ B_SetAttributesToChapter (self, 4); // ------ Kampf-Taktik ------ fight_tactic = FAI_HUMAN_COWARD; // ------ Equippte Waffen ------ EquipItem (self, itmw_1h_bau_mace); // ------ Inventory ------ // Händler // ------ visuals ------ B_SetNpcVisual (self, MALE, "Hum_Head_FatBald", Face_P_Normal02, BodyTex_P, ITAR_SMITH); Mdl_SetModelFatness (self, 0); Mdl_ApplyOverlayMds (self, "Humans_Tired.mds"); // ------ NSC-relevante Talente vergeben ------ B_GiveNpcTalents (self); // ------ Kampf-Talente ------ B_SetFightSkills (self, 35); // ------ TA anmelden ------ daily_routine = Rtn_Start_7282; }; FUNC VOID Rtn_Start_7282 () { TA_Potion_Alchemy (08,00,18,00,"REL_CITY_185"); TA_Sit_Throne (18,00,22,00,"REL_CITY_185"); TA_Sleep (22,00,08,00,"REL_CITY_185"); };
D
deficient in quantity or number compared with the demand only a very short time before
D
// Written in the D programming language. /** JavaScript Object Notation Copyright: Copyright Jeremie Pelletier 2008 - 2009. License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). Authors: Jeremie Pelletier, David Herberth References: $(LINK http://json.org/) Source: $(PHOBOSSRC std/json.d) */ /* Copyright Jeremie Pelletier 2008 - 2009. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ module std.json; import std.array; import std.conv; import std.range.primitives; import std.traits; /// @system unittest { import std.conv : to; // parse a file or string of json into a usable structure string s = `{ "language": "D", "rating": 3.5, "code": "42" }`; JSONValue j = parseJSON(s); // j and j["language"] return JSONValue, // j["language"].str returns a string assert(j["language"].str == "D"); assert(j["rating"].floating == 3.5); // check a type long x; if (const(JSONValue)* code = "code" in j) { if (code.type() == JSON_TYPE.INTEGER) x = code.integer; else x = to!int(code.str); } // create a json struct JSONValue jj = [ "language": "D" ]; // rating doesnt exist yet, so use .object to assign jj.object["rating"] = JSONValue(3.5); // create an array to assign to list jj.object["list"] = JSONValue( ["a", "b", "c"] ); // list already exists, so .object optional jj["list"].array ~= JSONValue("D"); string jjStr = `{"language":"D","list":["a","b","c","D"],"rating":3.5}`; assert(jj.toString == jjStr); } /** String literals used to represent special float values within JSON strings. */ enum JSONFloatLiteral : string { nan = "NaN", /// string representation of floating-point NaN inf = "Infinite", /// string representation of floating-point Infinity negativeInf = "-Infinite", /// string representation of floating-point negative Infinity } /** Flags that control how json is encoded and parsed. */ enum JSONOptions { none, /// standard parsing specialFloatLiterals = 0x1, /// encode NaN and Inf float values as strings escapeNonAsciiChars = 0x2, /// encode non ascii characters with an unicode escape sequence doNotEscapeSlashes = 0x4, /// do not escape slashes ('/') } /** JSON type enumeration */ enum JSON_TYPE : byte { /// Indicates the type of a `JSONValue`. NULL, STRING, /// ditto INTEGER, /// ditto UINTEGER,/// ditto FLOAT, /// ditto OBJECT, /// ditto ARRAY, /// ditto TRUE, /// ditto FALSE /// ditto } /** JSON value node */ struct JSONValue { import std.exception : enforce; union Store { string str; long integer; ulong uinteger; double floating; JSONValue[string] object; JSONValue[] array; } private Store store; private JSON_TYPE type_tag; /** Returns the JSON_TYPE of the value stored in this structure. */ @property JSON_TYPE type() const pure nothrow @safe @nogc { return type_tag; } /// @safe unittest { string s = "{ \"language\": \"D\" }"; JSONValue j = parseJSON(s); assert(j.type == JSON_TYPE.OBJECT); assert(j["language"].type == JSON_TYPE.STRING); } /*** * Value getter/setter for `JSON_TYPE.STRING`. * Throws: `JSONException` for read access if `type` is not * `JSON_TYPE.STRING`. */ @property string str() const pure @trusted { enforce!JSONException(type == JSON_TYPE.STRING, "JSONValue is not a string"); return store.str; } /// ditto @property string str(string v) pure nothrow @nogc @safe { assign(v); return v; } /// @safe unittest { JSONValue j = [ "language": "D" ]; // get value assert(j["language"].str == "D"); // change existing key to new string j["language"].str = "Perl"; assert(j["language"].str == "Perl"); } /*** * Value getter/setter for `JSON_TYPE.INTEGER`. * Throws: `JSONException` for read access if `type` is not * `JSON_TYPE.INTEGER`. */ @property inout(long) integer() inout pure @safe { enforce!JSONException(type == JSON_TYPE.INTEGER, "JSONValue is not an integer"); return store.integer; } /// ditto @property long integer(long v) pure nothrow @safe @nogc { assign(v); return store.integer; } /*** * Value getter/setter for `JSON_TYPE.UINTEGER`. * Throws: `JSONException` for read access if `type` is not * `JSON_TYPE.UINTEGER`. */ @property inout(ulong) uinteger() inout pure @safe { enforce!JSONException(type == JSON_TYPE.UINTEGER, "JSONValue is not an unsigned integer"); return store.uinteger; } /// ditto @property ulong uinteger(ulong v) pure nothrow @safe @nogc { assign(v); return store.uinteger; } /*** * Value getter/setter for `JSON_TYPE.FLOAT`. Note that despite * the name, this is a $(B 64)-bit `double`, not a 32-bit `float`. * Throws: `JSONException` for read access if `type` is not * `JSON_TYPE.FLOAT`. */ @property inout(double) floating() inout pure @safe { enforce!JSONException(type == JSON_TYPE.FLOAT, "JSONValue is not a floating type"); return store.floating; } /// ditto @property double floating(double v) pure nothrow @safe @nogc { assign(v); return store.floating; } /*** * Value getter/setter for `JSON_TYPE.OBJECT`. * Throws: `JSONException` for read access if `type` is not * `JSON_TYPE.OBJECT`. * Note: this is @system because of the following pattern: --- auto a = &(json.object()); json.uinteger = 0; // overwrite AA pointer (*a)["hello"] = "world"; // segmentation fault --- */ @property ref inout(JSONValue[string]) object() inout pure @system { enforce!JSONException(type == JSON_TYPE.OBJECT, "JSONValue is not an object"); return store.object; } /// ditto @property JSONValue[string] object(JSONValue[string] v) pure nothrow @nogc @safe { assign(v); return v; } /*** * Value getter for `JSON_TYPE.OBJECT`. * Unlike `object`, this retrieves the object by value and can be used in @safe code. * * A caveat is that, if the returned value is null, modifications will not be visible: * --- * JSONValue json; * json.object = null; * json.objectNoRef["hello"] = JSONValue("world"); * assert("hello" !in json.object); * --- * * Throws: `JSONException` for read access if `type` is not * `JSON_TYPE.OBJECT`. */ @property inout(JSONValue[string]) objectNoRef() inout pure @trusted { enforce!JSONException(type == JSON_TYPE.OBJECT, "JSONValue is not an object"); return store.object; } /*** * Value getter/setter for `JSON_TYPE.ARRAY`. * Throws: `JSONException` for read access if `type` is not * `JSON_TYPE.ARRAY`. * Note: this is @system because of the following pattern: --- auto a = &(json.array()); json.uinteger = 0; // overwrite array pointer (*a)[0] = "world"; // segmentation fault --- */ @property ref inout(JSONValue[]) array() inout pure @system { enforce!JSONException(type == JSON_TYPE.ARRAY, "JSONValue is not an array"); return store.array; } /// ditto @property JSONValue[] array(JSONValue[] v) pure nothrow @nogc @safe { assign(v); return v; } /*** * Value getter for `JSON_TYPE.ARRAY`. * Unlike `array`, this retrieves the array by value and can be used in @safe code. * * A caveat is that, if you append to the returned array, the new values aren't visible in the * JSONValue: * --- * JSONValue json; * json.array = [JSONValue("hello")]; * json.arrayNoRef ~= JSONValue("world"); * assert(json.array.length == 1); * --- * * Throws: `JSONException` for read access if `type` is not * `JSON_TYPE.ARRAY`. */ @property inout(JSONValue[]) arrayNoRef() inout pure @trusted { enforce!JSONException(type == JSON_TYPE.ARRAY, "JSONValue is not an array"); return store.array; } /// Test whether the type is `JSON_TYPE.NULL` @property bool isNull() const pure nothrow @safe @nogc { return type == JSON_TYPE.NULL; } private void assign(T)(T arg) @safe { static if (is(T : typeof(null))) { type_tag = JSON_TYPE.NULL; } else static if (is(T : string)) { type_tag = JSON_TYPE.STRING; string t = arg; () @trusted { store.str = t; }(); } else static if (isSomeString!T) // issue 15884 { type_tag = JSON_TYPE.STRING; // FIXME: std.array.array(Range) is not deduced as 'pure' () @trusted { import std.utf : byUTF; store.str = cast(immutable)(arg.byUTF!char.array); }(); } else static if (is(T : bool)) { type_tag = arg ? JSON_TYPE.TRUE : JSON_TYPE.FALSE; } else static if (is(T : ulong) && isUnsigned!T) { type_tag = JSON_TYPE.UINTEGER; store.uinteger = arg; } else static if (is(T : long)) { type_tag = JSON_TYPE.INTEGER; store.integer = arg; } else static if (isFloatingPoint!T) { type_tag = JSON_TYPE.FLOAT; store.floating = arg; } else static if (is(T : Value[Key], Key, Value)) { static assert(is(Key : string), "AA key must be string"); type_tag = JSON_TYPE.OBJECT; static if (is(Value : JSONValue)) { JSONValue[string] t = arg; () @trusted { store.object = t; }(); } else { JSONValue[string] aa; foreach (key, value; arg) aa[key] = JSONValue(value); () @trusted { store.object = aa; }(); } } else static if (isArray!T) { type_tag = JSON_TYPE.ARRAY; static if (is(ElementEncodingType!T : JSONValue)) { JSONValue[] t = arg; () @trusted { store.array = t; }(); } else { JSONValue[] new_arg = new JSONValue[arg.length]; foreach (i, e; arg) new_arg[i] = JSONValue(e); () @trusted { store.array = new_arg; }(); } } else static if (is(T : JSONValue)) { type_tag = arg.type; store = arg.store; } else { static assert(false, text(`unable to convert type "`, T.stringof, `" to json`)); } } private void assignRef(T)(ref T arg) if (isStaticArray!T) { type_tag = JSON_TYPE.ARRAY; static if (is(ElementEncodingType!T : JSONValue)) { store.array = arg; } else { JSONValue[] new_arg = new JSONValue[arg.length]; foreach (i, e; arg) new_arg[i] = JSONValue(e); store.array = new_arg; } } /** * Constructor for `JSONValue`. If `arg` is a `JSONValue` * its value and type will be copied to the new `JSONValue`. * Note that this is a shallow copy: if type is `JSON_TYPE.OBJECT` * or `JSON_TYPE.ARRAY` then only the reference to the data will * be copied. * Otherwise, `arg` must be implicitly convertible to one of the * following types: `typeof(null)`, `string`, `ulong`, * `long`, `double`, an associative array `V[K]` for any `V` * and `K` i.e. a JSON object, any array or `bool`. The type will * be set accordingly. */ this(T)(T arg) if (!isStaticArray!T) { assign(arg); } /// Ditto this(T)(ref T arg) if (isStaticArray!T) { assignRef(arg); } /// Ditto this(T : JSONValue)(inout T arg) inout { store = arg.store; type_tag = arg.type; } /// @safe unittest { JSONValue j = JSONValue( "a string" ); j = JSONValue(42); j = JSONValue( [1, 2, 3] ); assert(j.type == JSON_TYPE.ARRAY); j = JSONValue( ["language": "D"] ); assert(j.type == JSON_TYPE.OBJECT); } void opAssign(T)(T arg) if (!isStaticArray!T && !is(T : JSONValue)) { assign(arg); } void opAssign(T)(ref T arg) if (isStaticArray!T) { assignRef(arg); } /*** * Array syntax for json arrays. * Throws: `JSONException` if `type` is not `JSON_TYPE.ARRAY`. */ ref inout(JSONValue) opIndex(size_t i) inout pure @safe { auto a = this.arrayNoRef; enforce!JSONException(i < a.length, "JSONValue array index is out of range"); return a[i]; } /// @safe unittest { JSONValue j = JSONValue( [42, 43, 44] ); assert( j[0].integer == 42 ); assert( j[1].integer == 43 ); } /*** * Hash syntax for json objects. * Throws: `JSONException` if `type` is not `JSON_TYPE.OBJECT`. */ ref inout(JSONValue) opIndex(string k) inout pure @safe { auto o = this.objectNoRef; return *enforce!JSONException(k in o, "Key not found: " ~ k); } /// @safe unittest { JSONValue j = JSONValue( ["language": "D"] ); assert( j["language"].str == "D" ); } /*** * Operator sets `value` for element of JSON object by `key`. * * If JSON value is null, then operator initializes it with object and then * sets `value` for it. * * Throws: `JSONException` if `type` is not `JSON_TYPE.OBJECT` * or `JSON_TYPE.NULL`. */ void opIndexAssign(T)(auto ref T value, string key) pure { enforce!JSONException(type == JSON_TYPE.OBJECT || type == JSON_TYPE.NULL, "JSONValue must be object or null"); JSONValue[string] aa = null; if (type == JSON_TYPE.OBJECT) { aa = this.objectNoRef; } aa[key] = value; this.object = aa; } /// @safe unittest { JSONValue j = JSONValue( ["language": "D"] ); j["language"].str = "Perl"; assert( j["language"].str == "Perl" ); } void opIndexAssign(T)(T arg, size_t i) pure { auto a = this.arrayNoRef; enforce!JSONException(i < a.length, "JSONValue array index is out of range"); a[i] = arg; this.array = a; } /// @safe unittest { JSONValue j = JSONValue( ["Perl", "C"] ); j[1].str = "D"; assert( j[1].str == "D" ); } JSONValue opBinary(string op : "~", T)(T arg) @safe { auto a = this.arrayNoRef; static if (isArray!T) { return JSONValue(a ~ JSONValue(arg).arrayNoRef); } else static if (is(T : JSONValue)) { return JSONValue(a ~ arg.arrayNoRef); } else { static assert(false, "argument is not an array or a JSONValue array"); } } void opOpAssign(string op : "~", T)(T arg) @safe { auto a = this.arrayNoRef; static if (isArray!T) { a ~= JSONValue(arg).arrayNoRef; } else static if (is(T : JSONValue)) { a ~= arg.arrayNoRef; } else { static assert(false, "argument is not an array or a JSONValue array"); } this.array = a; } /** * Support for the `in` operator. * * Tests wether a key can be found in an object. * * Returns: * when found, the `const(JSONValue)*` that matches to the key, * otherwise `null`. * * Throws: `JSONException` if the right hand side argument `JSON_TYPE` * is not `OBJECT`. */ auto opBinaryRight(string op : "in")(string k) const @safe { return k in this.objectNoRef; } /// @safe unittest { JSONValue j = [ "language": "D", "author": "walter" ]; string a = ("author" in j).str; } bool opEquals(const JSONValue rhs) const @nogc nothrow pure @safe { return opEquals(rhs); } bool opEquals(ref const JSONValue rhs) const @nogc nothrow pure @trusted { // Default doesn't work well since store is a union. Compare only // what should be in store. // This is @trusted to remain nogc, nothrow, fast, and usable from @safe code. if (type_tag != rhs.type_tag) return false; final switch (type_tag) { case JSON_TYPE.STRING: return store.str == rhs.store.str; case JSON_TYPE.INTEGER: return store.integer == rhs.store.integer; case JSON_TYPE.UINTEGER: return store.uinteger == rhs.store.uinteger; case JSON_TYPE.FLOAT: return store.floating == rhs.store.floating; case JSON_TYPE.OBJECT: return store.object == rhs.store.object; case JSON_TYPE.ARRAY: return store.array == rhs.store.array; case JSON_TYPE.TRUE: case JSON_TYPE.FALSE: case JSON_TYPE.NULL: return true; } } /// Implements the foreach `opApply` interface for json arrays. int opApply(scope int delegate(size_t index, ref JSONValue) dg) @system { int result; foreach (size_t index, ref value; array) { result = dg(index, value); if (result) break; } return result; } /// Implements the foreach `opApply` interface for json objects. int opApply(scope int delegate(string key, ref JSONValue) dg) @system { enforce!JSONException(type == JSON_TYPE.OBJECT, "JSONValue is not an object"); int result; foreach (string key, ref value; object) { result = dg(key, value); if (result) break; } return result; } /*** * Implicitly calls `toJSON` on this JSONValue. * * $(I options) can be used to tweak the conversion behavior. */ string toString(in JSONOptions options = JSONOptions.none) const @safe { return toJSON(this, false, options); } /*** * Implicitly calls `toJSON` on this JSONValue, like `toString`, but * also passes $(I true) as $(I pretty) argument. * * $(I options) can be used to tweak the conversion behavior */ string toPrettyString(in JSONOptions options = JSONOptions.none) const @safe { return toJSON(this, true, options); } } /** Parses a serialized string and returns a tree of JSON values. Throws: $(LREF JSONException) if the depth exceeds the max depth. Params: json = json-formatted string to parse maxDepth = maximum depth of nesting allowed, -1 disables depth checking options = enable decoding string representations of NaN/Inf as float values */ JSONValue parseJSON(T)(T json, int maxDepth = -1, JSONOptions options = JSONOptions.none) if (isInputRange!T && !isInfinite!T && isSomeChar!(ElementEncodingType!T)) { import std.ascii : isWhite, isDigit, isHexDigit, toUpper, toLower; import std.typecons : Yes; JSONValue root; root.type_tag = JSON_TYPE.NULL; // Avoid UTF decoding when possible, as it is unnecessary when // processing JSON. static if (is(T : const(char)[])) alias Char = char; else alias Char = Unqual!(ElementType!T); if (json.empty) return root; int depth = -1; Char next = 0; int line = 1, pos = 0; void error(string msg) { throw new JSONException(msg, line, pos); } Char popChar() { if (json.empty) error("Unexpected end of data."); static if (is(T : const(char)[])) { Char c = json[0]; json = json[1..$]; } else { Char c = json.front; json.popFront(); } if (c == '\n') { line++; pos = 0; } else { pos++; } return c; } Char peekChar() { if (!next) { if (json.empty) return '\0'; next = popChar(); } return next; } void skipWhitespace() { while (isWhite(peekChar())) next = 0; } Char getChar(bool SkipWhitespace = false)() { static if (SkipWhitespace) skipWhitespace(); Char c; if (next) { c = next; next = 0; } else c = popChar(); return c; } void checkChar(bool SkipWhitespace = true, bool CaseSensitive = true)(char c) { static if (SkipWhitespace) skipWhitespace(); auto c2 = getChar(); static if (!CaseSensitive) c2 = toLower(c2); if (c2 != c) error(text("Found '", c2, "' when expecting '", c, "'.")); } bool testChar(bool SkipWhitespace = true, bool CaseSensitive = true)(char c) { static if (SkipWhitespace) skipWhitespace(); auto c2 = peekChar(); static if (!CaseSensitive) c2 = toLower(c2); if (c2 != c) return false; getChar(); return true; } wchar parseWChar() { wchar val = 0; foreach_reverse (i; 0 .. 4) { auto hex = toUpper(getChar()); if (!isHexDigit(hex)) error("Expecting hex character"); val += (isDigit(hex) ? hex - '0' : hex - ('A' - 10)) << (4 * i); } return val; } string parseString() { import std.ascii : isControl; import std.uni : isSurrogateHi, isSurrogateLo; import std.utf : encode, decode; auto str = appender!string(); Next: switch (peekChar()) { case '"': getChar(); break; case '\\': getChar(); auto c = getChar(); switch (c) { case '"': str.put('"'); break; case '\\': str.put('\\'); break; case '/': str.put('/'); break; case 'b': str.put('\b'); break; case 'f': str.put('\f'); break; case 'n': str.put('\n'); break; case 'r': str.put('\r'); break; case 't': str.put('\t'); break; case 'u': wchar wc = parseWChar(); dchar val; // Non-BMP characters are escaped as a pair of // UTF-16 surrogate characters (see RFC 4627). if (isSurrogateHi(wc)) { wchar[2] pair; pair[0] = wc; if (getChar() != '\\') error("Expected escaped low surrogate after escaped high surrogate"); if (getChar() != 'u') error("Expected escaped low surrogate after escaped high surrogate"); pair[1] = parseWChar(); size_t index = 0; val = decode(pair[], index); if (index != 2) error("Invalid escaped surrogate pair"); } else if (isSurrogateLo(wc)) error(text("Unexpected low surrogate")); else val = wc; char[4] buf; immutable len = encode!(Yes.useReplacementDchar)(buf, val); str.put(buf[0 .. len]); break; default: error(text("Invalid escape sequence '\\", c, "'.")); } goto Next; default: // RFC 7159 states that control characters U+0000 through // U+001F must not appear unescaped in a JSON string. auto c = getChar(); if (isControl(c)) error("Illegal control character."); str.put(c); goto Next; } return str.data.length ? str.data : ""; } bool tryGetSpecialFloat(string str, out double val) { switch (str) { case JSONFloatLiteral.nan: val = double.nan; return true; case JSONFloatLiteral.inf: val = double.infinity; return true; case JSONFloatLiteral.negativeInf: val = -double.infinity; return true; default: return false; } } void parseValue(ref JSONValue value) { depth++; if (maxDepth != -1 && depth > maxDepth) error("Nesting too deep."); auto c = getChar!true(); switch (c) { case '{': if (testChar('}')) { value.object = null; break; } JSONValue[string] obj; do { checkChar('"'); string name = parseString(); checkChar(':'); JSONValue member; parseValue(member); obj[name] = member; } while (testChar(',')); value.object = obj; checkChar('}'); break; case '[': if (testChar(']')) { value.type_tag = JSON_TYPE.ARRAY; break; } JSONValue[] arr; do { JSONValue element; parseValue(element); arr ~= element; } while (testChar(',')); checkChar(']'); value.array = arr; break; case '"': auto str = parseString(); // if special float parsing is enabled, check if string represents NaN/Inf if ((options & JSONOptions.specialFloatLiterals) && tryGetSpecialFloat(str, value.store.floating)) { // found a special float, its value was placed in value.store.floating value.type_tag = JSON_TYPE.FLOAT; break; } value.type_tag = JSON_TYPE.STRING; value.store.str = str; break; case '0': .. case '9': case '-': auto number = appender!string(); bool isFloat, isNegative; void readInteger() { if (!isDigit(c)) error("Digit expected"); Next: number.put(c); if (isDigit(peekChar())) { c = getChar(); goto Next; } } if (c == '-') { number.put('-'); c = getChar(); isNegative = true; } readInteger(); if (testChar('.')) { isFloat = true; number.put('.'); c = getChar(); readInteger(); } if (testChar!(false, false)('e')) { isFloat = true; number.put('e'); if (testChar('+')) number.put('+'); else if (testChar('-')) number.put('-'); c = getChar(); readInteger(); } string data = number.data; if (isFloat) { value.type_tag = JSON_TYPE.FLOAT; value.store.floating = parse!double(data); } else { if (isNegative) value.store.integer = parse!long(data); else value.store.uinteger = parse!ulong(data); value.type_tag = !isNegative && value.store.uinteger & (1UL << 63) ? JSON_TYPE.UINTEGER : JSON_TYPE.INTEGER; } break; case 't': case 'T': value.type_tag = JSON_TYPE.TRUE; checkChar!(false, false)('r'); checkChar!(false, false)('u'); checkChar!(false, false)('e'); break; case 'f': case 'F': value.type_tag = JSON_TYPE.FALSE; checkChar!(false, false)('a'); checkChar!(false, false)('l'); checkChar!(false, false)('s'); checkChar!(false, false)('e'); break; case 'n': case 'N': value.type_tag = JSON_TYPE.NULL; checkChar!(false, false)('u'); checkChar!(false, false)('l'); checkChar!(false, false)('l'); break; default: error(text("Unexpected character '", c, "'.")); } depth--; } parseValue(root); return root; } @safe unittest { enum issue15742objectOfObject = `{ "key1": { "key2": 1 }}`; static assert(parseJSON(issue15742objectOfObject).type == JSON_TYPE.OBJECT); enum issue15742arrayOfArray = `[[1]]`; static assert(parseJSON(issue15742arrayOfArray).type == JSON_TYPE.ARRAY); } @safe unittest { // Ensure we can parse and use JSON from @safe code auto a = `{ "key1": { "key2": 1 }}`.parseJSON; assert(a["key1"]["key2"].integer == 1); assert(a.toString == `{"key1":{"key2":1}}`); } @system unittest { // Ensure we can parse JSON from a @system range. struct Range { string s; size_t index; @system { bool empty() { return index >= s.length; } void popFront() { index++; } char front() { return s[index]; } } } auto s = Range(`{ "key1": { "key2": 1 }}`); auto json = parseJSON(s); assert(json["key1"]["key2"].integer == 1); } /** Parses a serialized string and returns a tree of JSON values. Throws: $(LREF JSONException) if the depth exceeds the max depth. Params: json = json-formatted string to parse options = enable decoding string representations of NaN/Inf as float values */ JSONValue parseJSON(T)(T json, JSONOptions options) if (isInputRange!T && !isInfinite!T && isSomeChar!(ElementEncodingType!T)) { return parseJSON!T(json, -1, options); } /** Takes a tree of JSON values and returns the serialized string. Any Object types will be serialized in a key-sorted order. If `pretty` is false no whitespaces are generated. If `pretty` is true serialized string is formatted to be human-readable. Set the $(LREF JSONOptions.specialFloatLiterals) flag is set in `options` to encode NaN/Infinity as strings. */ string toJSON(const ref JSONValue root, in bool pretty = false, in JSONOptions options = JSONOptions.none) @safe { auto json = appender!string(); void toStringImpl(Char)(string str) @safe { json.put('"'); foreach (Char c; str) { switch (c) { case '"': json.put("\\\""); break; case '\\': json.put("\\\\"); break; case '/': if (!(options & JSONOptions.doNotEscapeSlashes)) json.put('\\'); json.put('/'); break; case '\b': json.put("\\b"); break; case '\f': json.put("\\f"); break; case '\n': json.put("\\n"); break; case '\r': json.put("\\r"); break; case '\t': json.put("\\t"); break; default: { import std.ascii : isControl; import std.utf : encode; // Make sure we do UTF decoding iff we want to // escape Unicode characters. assert(((options & JSONOptions.escapeNonAsciiChars) != 0) == is(Char == dchar), "JSONOptions.escapeNonAsciiChars needs dchar strings"); with (JSONOptions) if (isControl(c) || ((options & escapeNonAsciiChars) >= escapeNonAsciiChars && c >= 0x80)) { // Ensure non-BMP characters are encoded as a pair // of UTF-16 surrogate characters, as per RFC 4627. wchar[2] wchars; // 1 or 2 UTF-16 code units size_t wNum = encode(wchars, c); // number of UTF-16 code units foreach (wc; wchars[0 .. wNum]) { json.put("\\u"); foreach_reverse (i; 0 .. 4) { char ch = (wc >>> (4 * i)) & 0x0f; ch += ch < 10 ? '0' : 'A' - 10; json.put(ch); } } } else { json.put(c); } } } } json.put('"'); } void toString(string str) @safe { // Avoid UTF decoding when possible, as it is unnecessary when // processing JSON. if (options & JSONOptions.escapeNonAsciiChars) toStringImpl!dchar(str); else toStringImpl!char(str); } void toValue(ref in JSONValue value, ulong indentLevel) @safe { void putTabs(ulong additionalIndent = 0) { if (pretty) foreach (i; 0 .. indentLevel + additionalIndent) json.put(" "); } void putEOL() { if (pretty) json.put('\n'); } void putCharAndEOL(char ch) { json.put(ch); putEOL(); } final switch (value.type) { case JSON_TYPE.OBJECT: auto obj = value.objectNoRef; if (!obj.length) { json.put("{}"); } else { putCharAndEOL('{'); bool first = true; void emit(R)(R names) { foreach (name; names) { auto member = obj[name]; if (!first) putCharAndEOL(','); first = false; putTabs(1); toString(name); json.put(':'); if (pretty) json.put(' '); toValue(member, indentLevel + 1); } } import std.algorithm.sorting : sort; // @@@BUG@@@ 14439 // auto names = obj.keys; // aa.keys can't be called in @safe code auto names = new string[obj.length]; size_t i = 0; foreach (k, v; obj) { names[i] = k; i++; } sort(names); emit(names); putEOL(); putTabs(); json.put('}'); } break; case JSON_TYPE.ARRAY: auto arr = value.arrayNoRef; if (arr.empty) { json.put("[]"); } else { putCharAndEOL('['); foreach (i, el; arr) { if (i) putCharAndEOL(','); putTabs(1); toValue(el, indentLevel + 1); } putEOL(); putTabs(); json.put(']'); } break; case JSON_TYPE.STRING: toString(value.str); break; case JSON_TYPE.INTEGER: json.put(to!string(value.store.integer)); break; case JSON_TYPE.UINTEGER: json.put(to!string(value.store.uinteger)); break; case JSON_TYPE.FLOAT: import std.math : isNaN, isInfinity; auto val = value.store.floating; if (val.isNaN) { if (options & JSONOptions.specialFloatLiterals) { toString(JSONFloatLiteral.nan); } else { throw new JSONException( "Cannot encode NaN. Consider passing the specialFloatLiterals flag."); } } else if (val.isInfinity) { if (options & JSONOptions.specialFloatLiterals) { toString((val > 0) ? JSONFloatLiteral.inf : JSONFloatLiteral.negativeInf); } else { throw new JSONException( "Cannot encode Infinity. Consider passing the specialFloatLiterals flag."); } } else { import std.format : format; // The correct formula for the number of decimal digits needed for lossless round // trips is actually: // ceil(log(pow(2.0, double.mant_dig - 1)) / log(10.0) + 1) == (double.dig + 2) // Anything less will round off (1 + double.epsilon) json.put("%.18g".format(val)); } break; case JSON_TYPE.TRUE: json.put("true"); break; case JSON_TYPE.FALSE: json.put("false"); break; case JSON_TYPE.NULL: json.put("null"); break; } } toValue(root, 0); return json.data; } @safe unittest // bugzilla 12897 { JSONValue jv0 = JSONValue("test测试"); assert(toJSON(jv0, false, JSONOptions.escapeNonAsciiChars) == `"test\u6D4B\u8BD5"`); JSONValue jv00 = JSONValue("test\u6D4B\u8BD5"); assert(toJSON(jv00, false, JSONOptions.none) == `"test测试"`); assert(toJSON(jv0, false, JSONOptions.none) == `"test测试"`); JSONValue jv1 = JSONValue("été"); assert(toJSON(jv1, false, JSONOptions.escapeNonAsciiChars) == `"\u00E9t\u00E9"`); JSONValue jv11 = JSONValue("\u00E9t\u00E9"); assert(toJSON(jv11, false, JSONOptions.none) == `"été"`); assert(toJSON(jv1, false, JSONOptions.none) == `"été"`); } /** Exception thrown on JSON errors */ class JSONException : Exception { this(string msg, int line = 0, int pos = 0) pure nothrow @safe { if (line) super(text(msg, " (Line ", line, ":", pos, ")")); else super(msg); } this(string msg, string file, size_t line) pure nothrow @safe { super(msg, file, line); } } @system unittest { import std.exception; JSONValue jv = "123"; assert(jv.type == JSON_TYPE.STRING); assertNotThrown(jv.str); assertThrown!JSONException(jv.integer); assertThrown!JSONException(jv.uinteger); assertThrown!JSONException(jv.floating); assertThrown!JSONException(jv.object); assertThrown!JSONException(jv.array); assertThrown!JSONException(jv["aa"]); assertThrown!JSONException(jv[2]); jv = -3; assert(jv.type == JSON_TYPE.INTEGER); assertNotThrown(jv.integer); jv = cast(uint) 3; assert(jv.type == JSON_TYPE.UINTEGER); assertNotThrown(jv.uinteger); jv = 3.0; assert(jv.type == JSON_TYPE.FLOAT); assertNotThrown(jv.floating); jv = ["key" : "value"]; assert(jv.type == JSON_TYPE.OBJECT); assertNotThrown(jv.object); assertNotThrown(jv["key"]); assert("key" in jv); assert("notAnElement" !in jv); assertThrown!JSONException(jv["notAnElement"]); const cjv = jv; assert("key" in cjv); assertThrown!JSONException(cjv["notAnElement"]); foreach (string key, value; jv) { static assert(is(typeof(value) == JSONValue)); assert(key == "key"); assert(value.type == JSON_TYPE.STRING); assertNotThrown(value.str); assert(value.str == "value"); } jv = [3, 4, 5]; assert(jv.type == JSON_TYPE.ARRAY); assertNotThrown(jv.array); assertNotThrown(jv[2]); foreach (size_t index, value; jv) { static assert(is(typeof(value) == JSONValue)); assert(value.type == JSON_TYPE.INTEGER); assertNotThrown(value.integer); assert(index == (value.integer-3)); } jv = null; assert(jv.type == JSON_TYPE.NULL); assert(jv.isNull); jv = "foo"; assert(!jv.isNull); jv = JSONValue("value"); assert(jv.type == JSON_TYPE.STRING); assert(jv.str == "value"); JSONValue jv2 = JSONValue("value"); assert(jv2.type == JSON_TYPE.STRING); assert(jv2.str == "value"); JSONValue jv3 = JSONValue("\u001c"); assert(jv3.type == JSON_TYPE.STRING); assert(jv3.str == "\u001C"); } @system unittest { // Bugzilla 11504 JSONValue jv = 1; assert(jv.type == JSON_TYPE.INTEGER); jv.str = "123"; assert(jv.type == JSON_TYPE.STRING); assert(jv.str == "123"); jv.integer = 1; assert(jv.type == JSON_TYPE.INTEGER); assert(jv.integer == 1); jv.uinteger = 2u; assert(jv.type == JSON_TYPE.UINTEGER); assert(jv.uinteger == 2u); jv.floating = 1.5; assert(jv.type == JSON_TYPE.FLOAT); assert(jv.floating == 1.5); jv.object = ["key" : JSONValue("value")]; assert(jv.type == JSON_TYPE.OBJECT); assert(jv.object == ["key" : JSONValue("value")]); jv.array = [JSONValue(1), JSONValue(2), JSONValue(3)]; assert(jv.type == JSON_TYPE.ARRAY); assert(jv.array == [JSONValue(1), JSONValue(2), JSONValue(3)]); jv = true; assert(jv.type == JSON_TYPE.TRUE); jv = false; assert(jv.type == JSON_TYPE.FALSE); enum E{True = true} jv = E.True; assert(jv.type == JSON_TYPE.TRUE); } @system pure unittest { // Adding new json element via array() / object() directly JSONValue jarr = JSONValue([10]); foreach (i; 0 .. 9) jarr.array ~= JSONValue(i); assert(jarr.array.length == 10); JSONValue jobj = JSONValue(["key" : JSONValue("value")]); foreach (i; 0 .. 9) jobj.object[text("key", i)] = JSONValue(text("value", i)); assert(jobj.object.length == 10); } @system pure unittest { // Adding new json element without array() / object() access JSONValue jarr = JSONValue([10]); foreach (i; 0 .. 9) jarr ~= [JSONValue(i)]; assert(jarr.array.length == 10); JSONValue jobj = JSONValue(["key" : JSONValue("value")]); foreach (i; 0 .. 9) jobj[text("key", i)] = JSONValue(text("value", i)); assert(jobj.object.length == 10); // No array alias auto jarr2 = jarr ~ [1,2,3]; jarr2[0] = 999; assert(jarr[0] == JSONValue(10)); } @system unittest { // @system because JSONValue.array is @system import std.exception; // An overly simple test suite, if it can parse a serializated string and // then use the resulting values tree to generate an identical // serialization, both the decoder and encoder works. auto jsons = [ `null`, `true`, `false`, `0`, `123`, `-4321`, `0.25`, `-0.25`, `""`, `"hello\nworld"`, `"\"\\\/\b\f\n\r\t"`, `[]`, `[12,"foo",true,false]`, `{}`, `{"a":1,"b":null}`, `{"goodbye":[true,"or",false,["test",42,{"nested":{"a":23.5,"b":0.140625}}]],` ~`"hello":{"array":[12,null,{}],"json":"is great"}}`, ]; enum dbl1_844 = `1.8446744073709568`; version (MinGW) jsons ~= dbl1_844 ~ `e+019`; else jsons ~= dbl1_844 ~ `e+19`; JSONValue val; string result; foreach (json; jsons) { try { val = parseJSON(json); enum pretty = false; result = toJSON(val, pretty); assert(result == json, text(result, " should be ", json)); } catch (JSONException e) { import std.stdio : writefln; writefln(text(json, "\n", e.toString())); } } // Should be able to correctly interpret unicode entities val = parseJSON(`"\u003C\u003E"`); assert(toJSON(val) == "\"\&lt;\&gt;\""); assert(val.to!string() == "\"\&lt;\&gt;\""); val = parseJSON(`"\u0391\u0392\u0393"`); assert(toJSON(val) == "\"\&Alpha;\&Beta;\&Gamma;\""); assert(val.to!string() == "\"\&Alpha;\&Beta;\&Gamma;\""); val = parseJSON(`"\u2660\u2666"`); assert(toJSON(val) == "\"\&spades;\&diams;\""); assert(val.to!string() == "\"\&spades;\&diams;\""); //0x7F is a control character (see Unicode spec) val = parseJSON(`"\u007F"`); assert(toJSON(val) == "\"\\u007F\""); assert(val.to!string() == "\"\\u007F\""); with(parseJSON(`""`)) assert(str == "" && str !is null); with(parseJSON(`[]`)) assert(!array.length); // Formatting val = parseJSON(`{"a":[null,{"x":1},{},[]]}`); assert(toJSON(val, true) == `{ "a": [ null, { "x": 1 }, {}, [] ] }`); } @safe unittest { auto json = `"hello\nworld"`; const jv = parseJSON(json); assert(jv.toString == json); assert(jv.toPrettyString == json); } @system pure unittest { // Bugzilla 12969 JSONValue jv; jv["int"] = 123; assert(jv.type == JSON_TYPE.OBJECT); assert("int" in jv); assert(jv["int"].integer == 123); jv["array"] = [1, 2, 3, 4, 5]; assert(jv["array"].type == JSON_TYPE.ARRAY); assert(jv["array"][2].integer == 3); jv["str"] = "D language"; assert(jv["str"].type == JSON_TYPE.STRING); assert(jv["str"].str == "D language"); jv["bool"] = false; assert(jv["bool"].type == JSON_TYPE.FALSE); assert(jv.object.length == 4); jv = [5, 4, 3, 2, 1]; assert( jv.type == JSON_TYPE.ARRAY ); assert( jv[3].integer == 2 ); } @safe unittest { auto s = q"EOF [ 1, 2, 3, potato ] EOF"; import std.exception; auto e = collectException!JSONException(parseJSON(s)); assert(e.msg == "Unexpected character 'p'. (Line 5:3)", e.msg); } // handling of special float values (NaN, Inf, -Inf) @safe unittest { import std.exception : assertThrown; import std.math : isNaN, isInfinity; // expected representations of NaN and Inf enum { nanString = '"' ~ JSONFloatLiteral.nan ~ '"', infString = '"' ~ JSONFloatLiteral.inf ~ '"', negativeInfString = '"' ~ JSONFloatLiteral.negativeInf ~ '"', } // with the specialFloatLiterals option, encode NaN/Inf as strings assert(JSONValue(float.nan).toString(JSONOptions.specialFloatLiterals) == nanString); assert(JSONValue(double.infinity).toString(JSONOptions.specialFloatLiterals) == infString); assert(JSONValue(-real.infinity).toString(JSONOptions.specialFloatLiterals) == negativeInfString); // without the specialFloatLiterals option, throw on encoding NaN/Inf assertThrown!JSONException(JSONValue(float.nan).toString); assertThrown!JSONException(JSONValue(double.infinity).toString); assertThrown!JSONException(JSONValue(-real.infinity).toString); // when parsing json with specialFloatLiterals option, decode special strings as floats JSONValue jvNan = parseJSON(nanString, JSONOptions.specialFloatLiterals); JSONValue jvInf = parseJSON(infString, JSONOptions.specialFloatLiterals); JSONValue jvNegInf = parseJSON(negativeInfString, JSONOptions.specialFloatLiterals); assert(jvNan.floating.isNaN); assert(jvInf.floating.isInfinity && jvInf.floating > 0); assert(jvNegInf.floating.isInfinity && jvNegInf.floating < 0); // when parsing json without the specialFloatLiterals option, decode special strings as strings jvNan = parseJSON(nanString); jvInf = parseJSON(infString); jvNegInf = parseJSON(negativeInfString); assert(jvNan.str == JSONFloatLiteral.nan); assert(jvInf.str == JSONFloatLiteral.inf); assert(jvNegInf.str == JSONFloatLiteral.negativeInf); } pure nothrow @safe @nogc unittest { JSONValue testVal; testVal = "test"; testVal = 10; testVal = 10u; testVal = 1.0; testVal = (JSONValue[string]).init; testVal = JSONValue[].init; testVal = null; assert(testVal.isNull); } pure nothrow @safe unittest // issue 15884 { import std.typecons; void Test(C)() { C[] a = ['x']; JSONValue testVal = a; assert(testVal.type == JSON_TYPE.STRING); testVal = a.idup; assert(testVal.type == JSON_TYPE.STRING); } Test!char(); Test!wchar(); Test!dchar(); } @safe unittest // issue 15885 { enum bool realInDoublePrecision = real.mant_dig == double.mant_dig; static bool test(const double num0) { import std.math : feqrel; const json0 = JSONValue(num0); const num1 = to!double(toJSON(json0)); static if (realInDoublePrecision) return feqrel(num1, num0) >= (double.mant_dig - 1); else return num1 == num0; } assert(test( 0.23)); assert(test(-0.23)); assert(test(1.223e+24)); assert(test(23.4)); assert(test(0.0012)); assert(test(30738.22)); assert(test(1 + double.epsilon)); assert(test(double.min_normal)); static if (realInDoublePrecision) assert(test(-double.max / 2)); else assert(test(-double.max)); const minSub = double.min_normal * double.epsilon; assert(test(minSub)); assert(test(3*minSub)); } @safe unittest // issue 17555 { import std.exception : assertThrown; assertThrown!JSONException(parseJSON("\"a\nb\"")); } @safe unittest // issue 17556 { auto v = JSONValue("\U0001D11E"); auto j = toJSON(v, false, JSONOptions.escapeNonAsciiChars); assert(j == `"\uD834\uDD1E"`); } @safe unittest // issue 5904 { string s = `"\uD834\uDD1E"`; auto j = parseJSON(s); assert(j.str == "\U0001D11E"); } @safe unittest // issue 17557 { assert(parseJSON("\"\xFF\"").str == "\xFF"); assert(parseJSON("\"\U0001D11E\"").str == "\U0001D11E"); } @safe unittest // issue 17553 { auto v = JSONValue("\xFF"); assert(toJSON(v) == "\"\xFF\""); } @safe unittest { import std.utf; assert(parseJSON("\"\xFF\"".byChar).str == "\xFF"); assert(parseJSON("\"\U0001D11E\"".byChar).str == "\U0001D11E"); } @safe unittest // JSONOptions.doNotEscapeSlashes (issue 17587) { assert(parseJSON(`"/"`).toString == `"\/"`); assert(parseJSON(`"\/"`).toString == `"\/"`); assert(parseJSON(`"/"`).toString(JSONOptions.doNotEscapeSlashes) == `"/"`); assert(parseJSON(`"\/"`).toString(JSONOptions.doNotEscapeSlashes) == `"/"`); }
D
var int SLD_753_Baloro_SC_choice; var int SLD_753_Baloro_SC_wills_wissen; var int SLD_753_Baloro_SC_besorgt_den_Kram; instance DIA_BALORO_EXIT(C_Info) { npc = SLD_753_Baloro; nr = 999; condition = dia_baloro_exit_condition; information = dia_baloro_exit_info; important = 0; permanent = 1; description = DIALOG_ENDE; }; func int dia_baloro_exit_condition() { return TRUE; }; func void dia_baloro_exit_info() { AI_StopProcessInfos(self); }; instance DIA_SLD_753_Baloro(C_Info) { npc = SLD_753_Baloro; condition = DIA_SLD_753_Baloro_Condition; information = DIA_SLD_753_Baloro_Intro_Info; important = 1; permanent = 0; }; func int DIA_SLD_753_Baloro_Condition() { return 1; }; func void DIA_SLD_753_Baloro_Intro_Info() { AI_Output(self,other,"DIA_SLD_753_Baloro_Intro_08_01"); //Hej, ty! Co się dzieje? }; instance DIA_SLD_753_Baloro_Wasmeinstdu(C_Info) { npc = SLD_753_Baloro; condition = DIA_SLD_753_Baloro_Wasmeinstdu_Condition; information = DIA_SLD_753_Baloro_Wasmeinstdu_Info; important = 0; permanent = 0; description = "Cześć!"; }; func int DIA_SLD_753_Baloro_Wasmeinstdu_Condition() { return 1; }; func void DIA_SLD_753_Baloro_Wasmeinstdu_Info() { AI_Output(other,self,"DIA_SLD_753_Baloro_Wasmeinstdu_Info_15_01"); //Cześć! AI_Output(self,other,"DIA_SLD_753_Baloro_Wasmeinstdu_Info_08_02"); //Kręcisz się tutaj, jakbyś czegoś szukał! AI_Output(other,self,"DIA_SLD_753_Baloro_Wasmeinstdu_Info_15_03"); //Czyżby? Mmh, może masz rację. A dlaczego? AI_Output(self,other,"DIA_SLD_753_Baloro_Wasmeinstdu_Info_08_04"); //Świetnie! Zapytaj MNIE! Może mogę ci jakoś pomóc! }; instance DIA_SLD_753_Baloro_Worumgehts(C_Info) { npc = SLD_753_Baloro; condition = DIA_SLD_753_Baloro_Worumgehts_Condition; information = DIA_SLD_753_Baloro_Worumgehts_Info; important = 0; permanent = 0; description = "Co masz na myśli?"; }; func int DIA_SLD_753_Baloro_Worumgehts_Condition() { if(Npc_KnowsInfo(hero,DIA_SLD_753_Baloro_Wasmeinstdu) && (SLD_753_Baloro_SC_choice == 0)) { return 1; }; }; func void DIA_SLD_753_Baloro_Worumgehts_Info() { AI_Output(other,self,"DIA_SLD_753_Baloro_Worumgehts_Info_15_01"); //Co masz na myśli? AI_Output(self,other,"DIA_SLD_753_Baloro_Worumgehts_Info_08_01"); //A czego potrzebujesz? AI_Output(other,self,"DIA_SLD_753_Baloro_Worumgehts_Info_15_02"); //Na początek wystarczy dobry miecz, gruby pancerz i wstęp do kopalni. AI_Output(self,other,"DIA_SLD_753_Baloro_Worumgehts_Info_08_02"); //Phi! To małe piwo! AI_Output(self,other,"DIA_SLD_753_Baloro_Worumgehts_Info_08_03"); //Mam tu coś takiego, że oczy ci wyjdą na wierzch. Mogę ci dać broń, którą pokonasz każdego wroga! AI_Output(self,other,"DIA_SLD_753_Baloro_Worumgehts_Info_08_04"); //W zamian, wystarczy, że wyświadczysz mi drobną przysługę. To wszystko! Co ty na to? Info_ClearChoices(DIA_SLD_753_Baloro_Worumgehts); Info_AddChoice(DIA_SLD_753_Baloro_Worumgehts,"Co miałbym dla ciebie zrobić?",DIA_SLD_753_Baloro_Worumgehts_ja); Info_AddChoice(DIA_SLD_753_Baloro_Worumgehts,"Nie, nie! Nieważne! Nie jestem zainteresowany!",DIA_SLD_753_Baloro_Exit_Info); }; func void DIA_SLD_753_Baloro_Worumgehts_ja() { AI_Output(other,self,"DIA_SLD_753_Baloro_Worumgehts_ja_15_05"); //Co miałbym dla ciebie zrobić? AI_Output(self,other,"DIA_SLD_753_Baloro_Worumgehts_ja_08_03"); //To proste! AI_Output(self,other,"DIA_SLD_753_Baloro_Worumgehts_ja_08_04"); //Przynieś mi 5 jabłek, 2 butelki ryżówki, 5 butelek piwa, 3 bochenki chleba, 2 kawałki sera i 2 kiście winogron. AI_Output(self,other,"DIA_SLD_753_Baloro_Worumgehts_ja_08_05"); //Możesz mi wierzyć: nie pożałujesz! Jak już mówiłem - tą bronią pokonasz każdego wroga! Info_ClearChoices(DIA_SLD_753_Baloro_Worumgehts); Info_AddChoice(DIA_SLD_753_Baloro_Worumgehts,"Dobrze! Zobaczę co się da zrobić!",DIA_SLD_753_Baloro_Worumgehts_jaklar); Info_AddChoice(DIA_SLD_753_Baloro_Worumgehts,"Nie, nie! Nieważne! Nie jestem zainteresowany!",DIA_SLD_753_Baloro_Exit_Info); }; func void DIA_SLD_753_Baloro_Worumgehts_jaklar() { AI_Output(other,self,"DIA_SLD_753_Baloro_Worumgehts_ja_15_06"); //Dobrze! Zobaczę co się da zrobić! AI_Output(self,other,"DIA_SLD_753_Baloro_Worumgehts_ja_08_06"); //To świetnie! Tylko się pospiesz. AI_Output(self,other,"DIA_SLD_753_Baloro_Worumgehts_ja_08_07"); //Tylko nie zapomnij: 5 jabłek, 2 butelki ryżówki, 5 butelek piwa, 3 bochenki chleba, 2 kawałki sera i 2 kiście winogron! Jasne? AI_Output(other,self,"DIA_SLD_753_Baloro_Worumgehts_ja_15_07"); //Jak słońce. SLD_753_Baloro_SC_besorgt_den_Kram = LOG_RUNNING; Log_CreateTopic(Baloros_Waffe,LOG_MISSION); Log_SetTopicStatus(Baloros_Waffe,LOG_RUNNING); B_LogEntry(Baloros_Waffe,"Baloro obiecał mi sprzedać niezwykle potężną broń, jeśli przyniosę mu 5 jabłek, 2 butelki ryżówki, 5 butelek piwa, 3 bochenki chleba, 2 kawałki sera i 2 kiście winogron."); AI_StopProcessInfos(self); }; instance DIA_SLD_753_Baloro_habsnichtdabei(C_Info) { npc = SLD_753_Baloro; condition = DIA_SLD_753_Baloro_habsnichtdabei_Condition; information = DIA_SLD_753_Baloro_habsnichtdabei_Info; important = 0; permanent = 1; description = "Nie udało mi się jeszcze zebrać wszystkich potrzebnych ci rzeczy!"; }; func int DIA_SLD_753_Baloro_habsnichtdabei_Condition() { if(SLD_753_Baloro_SC_besorgt_den_Kram == LOG_RUNNING) { return 1; }; }; func void DIA_SLD_753_Baloro_habsnichtdabei_Info() { AI_Output(other,self,"DIA_SLD_753_Baloro_habsnichtdabei_Info_15_01"); //Nie udało mi się jeszcze zebrać wszystkich potrzebnych ci rzeczy. Mógłbyś mi przypomnieć, co to miało być? AI_Output(self,other,"DIA_SLD_753_Baloro_habsnichtdabei_Info_08_01"); //Jasne. Słuchaj uważnie. Chcę, żebyś mi przyniósł... AI_Output(self,other,"DIA_SLD_753_Baloro_habsnichtdabei_Info_08_02"); //5 jabłek, 2 butelki ryżówki, 5 butelek piwa, 3 bochenki chleba, 2 kawałki sera i 2 kiście winogron! Zapamiętasz tym razem? AI_Output(other,self,"DIA_SLD_753_Baloro_habsnichtdabei_Info_15_02"); //Oczywiście! Niedługo wrócę! AI_StopProcessInfos(self); }; instance DIA_SLD_753_Baloro_habsdabei(C_Info) { npc = SLD_753_Baloro; condition = DIA_SLD_753_Baloro_habsdabei_Condition; information = DIA_SLD_753_Baloro_habsdabei_Info; important = 0; permanent = 0; description = "Mam już wszystko! Teraz porozmawiajmy o tej niesamowitej broni, tak?"; }; func int DIA_SLD_753_Baloro_habsdabei_Condition() { if((SLD_753_Baloro_SC_besorgt_den_Kram == LOG_RUNNING) && Npc_KnowsInfo(hero,DIA_SLD_753_Baloro_Worumgehts) && (SLD_753_Baloro_SC_choice == 0) && (Npc_HasItems(other,ItFoApple) >= 5) && (Npc_HasItems(other,ItFoBooze) >= 2) && (Npc_HasItems(other,ItFoBeer) >= 5) && (Npc_HasItems(other,ItFoLoaf) >= 3) && (Npc_HasItems(other,ItFoCheese) >= 2) && (Npc_HasItems(other,ItFo_wineberrys_01) >= 2)) { return 1; }; }; func void DIA_SLD_753_Baloro_habsdabei_Info() { AI_Output(other,self,"DIA_SLD_753_Baloro_habsdabei_Info_15_01"); //Mam już wszystko! Teraz porozmawiajmy o tej niesamowitej broni, tak? AI_Output(self,other,"DIA_SLD_753_Baloro_habsdabei_Info_08_01"); //Najpierw pokaż mi, co dla mnie masz. CreateInvItems(other,ItFoApple,14); B_GiveInvItems(other,self,ItFoApple,19); Npc_RemoveInvItems(other,ItFoBooze,2); Npc_RemoveInvItems(other,ItFoBeer,5); Npc_RemoveInvItems(other,ItFoLoaf,3); Npc_RemoveInvItems(other,ItFoCheese,2); Npc_RemoveInvItems(other,ItFo_wineberrys_01,2); Npc_RemoveInvItems(self,ItFoApple,14); CreateInvItems(self,ItFoBooze,2); CreateInvItems(self,ItFoBeer,5); CreateInvItems(self,ItFoLoaf,3); CreateInvItems(self,ItFoCheese,2); CreateInvItems(self,ItFo_wineberrys_01,2); AI_Output(other,self,"DIA_SLD_753_Baloro_habsdabei_Info_15_02"); //Proszę bardzo! AI_Output(self,other,"DIA_SLD_753_Baloro_habsdabei_Info_08_02"); //Nooo... W porządku! AI_Output(other,self,"DIA_SLD_753_Baloro_habsdabei_Info_15_03"); //A teraz broń! AI_Output(self,other,"DIA_SLD_753_Baloro_habsdabei_Info_08_03"); //Zapomnij o tym! AI_Output(other,self,"DIA_SLD_753_Baloro_habsdabei_Info_15_04"); //Co?! AI_Output(self,other,"DIA_SLD_753_Baloro_habsdabei_Info_08_04"); //Naprawdę myślałeś, że dostaniesz coś w zamian? Jeśli rzeczywiście jesteś taki głupi, to aż ci współczuję! AI_Output(self,other,"DIA_SLD_753_Baloro_habsdabei_Info_08_05"); //Dziwię się, że przeżyłeś tak długo! Jeśli będziesz wierzył we wszystko co ci powiedzą tutejsi ludzie, nie pociągniesz długo! AI_Output(self,other,"DIA_SLD_753_Baloro_habsdabei_Info_08_06"); //A zresztą - nieważne! Teraz mamy dość jedzenia na małą ucztę. Wielkie dzięki! Może się jeszcze spotkamy! He he he! SLD_753_Baloro_SC_besorgt_den_Kram = LOG_SUCCESS; B_GiveXP(300); B_LogEntry(Baloros_Waffe,"Byłem głupcem, że zaufałem temu łgarzowi! Cóż, dostałem nauczkę..."); Log_SetTopicStatus(Baloros_Waffe,LOG_SUCCESS); AI_StopProcessInfos(self); }; instance DIA_SLD_753_Baloro_letztes_Wort(C_Info) { npc = SLD_753_Baloro; condition = DIA_SLD_753_Baloro_letztes_Wort_Condition; information = DIA_SLD_753_Baloro_letztes_Wort_Info; important = 0; permanent = 0; description = "Hej! Nie dam się robić w konia!"; }; func int DIA_SLD_753_Baloro_letztes_Wort_Condition() { if(SLD_753_Baloro_SC_besorgt_den_Kram == LOG_SUCCESS) { return 1; }; }; func void DIA_SLD_753_Baloro_letztes_Wort_Info() { AI_Output(other,self,"DIA_SLD_753_Baloro_letztes_Wort_Info_15_01"); //Hej! Nie dam się robić w konia! AI_Output(self,other,"DIA_SLD_753_Baloro_letztes_Wort_Info_08_01"); //Czego znowu chcesz! Uciekaj stąd! Powkurzaj sobie kogoś innego, co? No już - spadaj! SLD_753_Baloro_SC_wills_wissen = 1; AI_StopProcessInfos(self); }; instance DIA_SLD_753_Baloro_SC_wills_wissen(C_Info) { npc = SLD_753_Baloro; condition = DIA_SLD_753_Baloro_SC_wills_wissen_Condition; information = DIA_SLD_753_Baloro_SC_wills_wissen_Info; important = 0; permanent = 0; description = "Widzę, że będę ci musiał dać nauczkę!"; }; func int DIA_SLD_753_Baloro_SC_wills_wissen_Condition() { if(SLD_753_Baloro_SC_wills_wissen == 1) { return 1; }; }; func void DIA_SLD_753_Baloro_Attack() { AI_StopProcessInfos(self); Npc_SetTarget(self,hero); AI_StartState(self,ZS_Attack,1,""); }; func void DIA_SLD_753_Baloro_SC_wills_wissen_Info() { AI_Output(other,self,"DIA_SLD_753_Baloro_SC_wills_wissen_Info_15_01"); //Widzę, że będę ci musiał dać nauczkę. AI_Output(self,other,"DIA_SLD_753_Baloro_SC_wills_wissen_Info_08_01"); //No już - pośmialiśmy się trochę, a teraz spadaj stąd! Sio! AI_Output(other,self,"DIA_SLD_753_Baloro_SC_wills_wissen_Info_15_02"); //Chyba mnie nie zrozumiałeś! AI_Output(self,other,"DIA_SLD_753_Baloro_SC_wills_wissen_Info_08_02"); //No dobra! Sam się o to prosiłeś! Ostrzegałem cię! DIA_SLD_753_Baloro_Attack(); }; instance DIA_SLD_753_Baloro_Exit(C_Info) { npc = SLD_753_Baloro; nr = 999; condition = DIA_SLD_753_Baloro_Exit_Condition; information = DIA_SLD_753_Baloro_Exit_Info; important = 0; permanent = 1; description = "Nie, nie! Nieważne!"; }; func int DIA_SLD_753_Baloro_Exit_Condition() { if((SLD_753_Baloro_SC_wills_wissen == 0) && (SLD_753_Baloro_SC_besorgt_den_Kram == 0)) { return 1; }; }; func void DIA_SLD_753_Baloro_Exit_Info() { if(Npc_KnowsInfo(hero,DIA_SLD_753_Baloro_Wasmeinstdu) && (SLD_753_Baloro_SC_choice == 0)) { AI_Output(other,self,"DIA_SLD_753_Baloro_Exit_Info_15_01"); //Nie, nie! Nieważne! Nie jestem zainteresowany! AI_Output(self,other,"DIA_SLD_753_Baloro_Exit_Info_08_02"); //Cóż, jak sobie życzysz! Marnujesz niepowtarzalną okazję! SLD_753_Baloro_SC_choice = 1; } else { AI_Output(other,self,"DIA_SLD_753_Baloro_Exit_Info_15_03"); //Przykro mi, ale nie mam czasu na pogawędki! AI_Output(self,other,"DIA_SLD_753_Baloro_Exit_Info_08_04"); //Och, jesteś zajęty! Porozmawiamy innym razem! }; AI_StopProcessInfos(self); }; instance DIA_SLD_753_Baloro_Angebotdochannehmen(C_Info) { npc = SLD_753_Baloro; condition = DIA_SLD_753_Baloro_Angebotdochannehmen_Condition; information = DIA_SLD_753_Baloro_Angebotdochannehmen_Info; important = 0; permanent = 0; description = "Zmieniłem zdanie. Porozmawiajmy jeszcze raz o twojej propozycji."; }; func int DIA_SLD_753_Baloro_Angebotdochannehmen_Condition() { if(SLD_753_Baloro_SC_choice == 1) { return 1; }; }; func void DIA_SLD_753_Baloro_Angebotdochannehmen_Info() { AI_Output(other,self,"DIA_SLD_753_Baloro_Angebotdochannehmen_Info_15_01"); //Zmieniłem zdanie. Porozmawiajmy jeszcze raz o twojej propozycji. AI_Output(self,other,"DIA_SLD_753_Baloro_Angebotdochannehmen_Info_08_01"); //Teraz jest już za późno. Miałeś swoją szansę! AI_StopProcessInfos(self); };
D
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>MarketPlace of i168.net</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="../mp_image/mp.css" rel="stylesheet" type="text/css"> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } //--> </script> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true); //--> </script> <style type="text/css"> <!-- body { margin-left: 0px; margin-right: 0px; } .style2 {color: #84D534} .style3 {color: #CC0000} --> </style> </head> <body topmargin="0" marginheight="0"> <center> <center> <script> // 延遲快選單消失 var delay_func = ''; function setdelay(func){ if (func == delay_func){ clearTimeout(bdelay); } else{ rundelay(); } bdelay = setTimeout(func,400) delay_func = func; } function rundelay(){ if (typeof(bdelay)=='number'){ clearTimeout(bdelay); eval(delay_func); delay_func = ''; } } function cleardelay(){ if (typeof(bdelay)=='number'){ clearTimeout(bdelay); } } function showShadowLayers(vid,p,v,vshadow,MaskN,vMask) { if(!document.getElementById(vid)){return;} //----遮住select if (vMask){ vMask = document.getElementById(vMask) }else{ if (document.getElementById("iMask")){vMask = document.getElementById("iMask") } } if(v=='show'){ vv='visible' }else{ if(v=='hide'){ vv='hidden' } } //v=(v=='show')?'visible':(v=='hide')?'hidden':v; if (document.getElementById(vid).style.visibility==vv){return;} document.getElementById(vid).style.visibility=vv; if (vMask && MaskN=='N') { vMask.style.visibility='hidden'; } else{ vMask.style.visibility=vv; } } function showShadowLayers1(vid,p,v,vshadow) { if(!document.getElementById(vid)){return;} v=(v=='show')?'':(v=='hide')?'none':v; if (document.getElementById(vid).style.display==v){return;} document.getElementById(vid).style.display=v; //if (vshadow){vshadow.style.display=v;} } function MM_findObj(n, d) { //v4.0 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && document.getElementById) x=document.getElementById(n); return x; } function resize_shadow(vobj,vshadow,vshadow_img,vshow_dir){ if (typeof(vshadow)=='object'){ //陰影位置 vshadow_img.width = vobj.offsetWidth; vshadow_img.height = vobj.offsetHeight; if (vshow_dir=='up'){ vshadow.style.left = vobj.offsetLeft+3; vshadow.style.top = vobj.offsetTop-3; } else{ vshadow.style.left = vobj.offsetLeft+3; vshadow.style.top = vobj.offsetTop+1; } } } function set_position(vobj,vsrc_obj,vpar_obj,vsrc_pos,vtar_pos,vshadow,vshadow_img , vshow_dir ,vMask) { if(!vobj){return;} rundelay(); if (typeof(vsrc_obj) !='undefined' & typeof(vsrc_obj) !='string' ) // 有主物件作為定位依據 { var vwidth , vheight var vtop , vleft vwidth = 0; vheight = 0; vtop = 0; vleft = 0; //累加 Parent object 的座標 par = vsrc_obj.offsetParent; while(par) { vtop = vtop + par.offsetTop; vleft = vleft + par.offsetLeft; par = par.offsetParent; } if (typeof(vpar_obj) == 'object') { vtop = vtop + vpar_obj.offsetTop vleft = vleft + vpar_obj.offsetLeft } switch (vsrc_pos ) { case 'topleft' : break; case 'topright' : vwidth = vsrc_obj.offsetWidth; break; case 'bottomleft' : vheight = vsrc_obj.offsetHeight; break; case 'bottomright' : vwidth = vsrc_obj.offsetWidth; vheight = vsrc_obj.offsetHeight; break; default : } if (vtar_pos == 'right') { vwidth = vwidth - vobj.offsetWidth; } if (vshow_dir=='up') vtop = vtop - vobj.offsetHeight vobj.style.left = vsrc_obj.offsetLeft + vleft + vwidth; vobj.style.top = vsrc_obj.offsetTop + vtop + vheight; //----遮住select if (vMask){ vMask = document.getElementById(vMask) } else { if (document.getElementById("iMask")){vMask = document.getElementById("iMask") } } if (vMask){ vMask.style.left = vobj.style.left; vMask.style.top = vobj.style.top; vMask.style.width = vobj.offsetWidth; vMask.style.height = vobj.offsetHeight; } //-------------- return; } // 以滑鼠座標作為定位依據 if ( event.clientX + vobj.offsetWidth - 5 > document.body.clientWidth){ vobj.style.left = event.clientX - vobj.offsetWidth + document.body.scrollLeft } else{ vobj.style.left = event.clientX-5 + document.body.scrollLeft } if ( event.clientY + vobj.offsetHeight - 5 > document.body.clientHeight){ vobj.style.top = event.clientY - vobj.offsetHeight + document.body.scrollTop+5 } else{ vobj.style.top = event.clientY-5 + document.body.scrollTop } } </script> <iframe id="iMask" src="javascript:void(0)" style="BORDER:solid 0px #999999;position:absolute; left:-300px; top:-300px; z-index:0;" frameborder="0"></iframe> <iframe id="iMask1" src="javascript:void(0)" style="BORDER:solid 0px #999999;position:absolute; left:-300px; top:-300px; z-index:0;" frameborder="0"></iframe> <center> <script type="text/javascript" src="/function/flashobject.js"></script> <table width="910" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" valign="top" align=right> <table border="0" align="right" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC"> <tr align="center" height="22"> <td><img src="/Template/Default/mp_image/mp1024-01_02.gif"></td> <td width="70"><a href="/Template/Default/marketplace/cart.asp" class="font12-grey-333">購物車</a></td> <td><img src="/Template/Default/mp_image/mp1024-01_04.gif"></td> <td width="70"><a href="/Template/Default/marketplace/my_account.asp?rtn_urlx=/template/Default/marketplace/Ad_Service_04.asp?" class="font12-grey-333">我的帳戶</a></td> <td width="5"><img src="/Template/Default/mp_image/mp1024-01_04.gif"></td> <!-- <td width="70"><a href="/Template/Default/marketplace/itake_balance.asp" class="font12-grey-333">iTake</a></td> <td width="5"><img src="/Template/Default/mp_image/mp1024-01_04.gif"></td> --> <td width="70"><a href="/Template/Default/marketplace/login.asp?rtn_urlx=/template/Default/marketplace/Ad_Service_04.asp?" class="font12-grey-333">登入 / 加入 </a></td> <td width="5"><img src="/Template/Default/mp_image/mp1024-01_06.gif"></td> </tr> </table> </td> </tr> <tr> <td width="400" height="65" > <a href="/Template/Default/marketplace/index.asp"><img src="/Template/Default/mp_image/mp1024-01_08.gif" border="0" align="absmiddle"></a></td> <td valign="bottom"><table width="100%" border="0" align="right" cellpadding="0" cellspacing="0"> <tr> <td width="3"><img src="/Template/Default/mp_image/mp1024-01_14.gif" width="3" height="15"></td> <td width="110"><div align="center"> <span class="font12-grey-666-Arial"> <a href="/template/default/marketstore/index.htm" class="font12-grey-666-Arial"> MarketPlace市集</a></span></div></td> <td width="3"><img src="/Template/Default/mp_image/mp1024-01_14.gif" width="3" height="15"></td> <td width="110"><div align="center"><img src="/Template/Default/mp_image/pedia/icon_10.gif" width="21" height="17" align="absmiddle"> <span class="font12-grey-666-Arial"> <a href="/template/default/marketpedia/index.asp" class="font12-grey-666-Arial"> MarketPedia</a></span></div></td> <td width="3"><img src="/Template/Default/mp_image/mp1024-01_14.gif" width="3" height="15"></td> <td width="100" height="25"><p align="center"><img src="/Template/Default/mp_image/mp1024-01_16.gif" width="15" height="15" align="absmiddle"> <span class="font12-grey-666"><a href="/Template/Default/marketplace/who_speak.asp" class="font12-grey-666">看誰在說話</a></span></p></td> <td width="3"><img src="/Template/Default/mp_image/mp1024-01_14.gif" width="3" height="15"></td> <td width="110"><div align="center"><img src="/Template/Default/mp_image/mp1024-01_18.gif" width="15" height="15" align="absmiddle"> <span class="font12-grey-666" onclick="window.external.AddFavorite('http://marketplace.i168.net/Template/Default/marketplace/index.asp', 'Marketplace of i168.net')" style="cursor:pointer">加入我的最愛</span> </div></td> <td width="3"><img src="/Template/Default/mp_image/mp1024-01_14.gif" width="3" height="15"></td> <td width="90"><div align="center"><img src="/Template/Default/mp_image/mp1024-01_20.gif" width="17" height="15" align="absmiddle"> <a href="/template/Default/marketplace/advanced_search.asp?ck=first_in&cate_ch=&mall="><span class="font12-grey-666">進階搜尋</span></a> </div></td> <td width="3"><img src="/Template/Default/mp_image/mp1024-01_14.gif" width="3" height="15"></td> </tr> </table></td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td background="/Template/Default/mp_image/mp1024-01_29.gif"> <table width="910" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="5"><img src="/Template/Default/mp_image/mp1024-01_31.gif" width="5" height="39"></td> <td id="mtds1477629" class="font12-white" style="cursor:pointer; white-space:nowrap;" align="center" width="85" onclick= "location='http://marketplace.i168.net/template/default/marketplace/mp_list.asp?status=pro_list&parent_id=1477629'" onMouseOver="show_pid2('1477629')" onMouseOut=setdelay("showShadowLayers('smenu1477629','','hide','','','iMask')") > <div align="center">時尚精品</div> </td> <td width="5"><img src="/Template/Default/mp_image/mp1024-01_31.gif" width="5" height="39"></td> <td id="mtds1477835" class="font12-white" style="cursor:pointer; white-space:nowrap;" align="center" width="85" onclick= "location='http://marketplace.i168.net/template/default/marketplace/mp_list.asp?status=pro_list&parent_id=1477835'" onMouseOver="show_pid2('1477835')" onMouseOut=setdelay("showShadowLayers('smenu1477835','','hide','','','iMask')") > <div align="center">美容保養</div> </td> <td width="5"><img src="/Template/Default/mp_image/mp1024-01_31.gif" width="5" height="39"></td> <td id="mtds1477834" class="font12-white" style="cursor:pointer; white-space:nowrap;" align="center" width="85" onclick= "location='http://marketplace.i168.net/template/default/marketplace/mp_list.asp?status=pro_list&parent_id=1477834'" onMouseOver="show_pid2('1477834')" onMouseOut=setdelay("showShadowLayers('smenu1477834','','hide','','','iMask')") > <div align="center">服飾配件</div> </td> <td width="5"><img src="/Template/Default/mp_image/mp1024-01_31.gif" width="5" height="39"></td> <td id="mtds1477628" class="font12-white" style="cursor:pointer; white-space:nowrap;" align="center" width="85" onclick= "location='http://marketplace.i168.net/template/default/marketplace/mp_list.asp?status=pro_list&parent_id=1477628'" onMouseOver="show_pid2('1477628')" onMouseOut=setdelay("showShadowLayers('smenu1477628','','hide','','','iMask')") > <div align="center">數位資訊</div> </td> <td width="5"><img src="/Template/Default/mp_image/mp1024-01_31.gif" width="5" height="39"></td> <td id="mtds1477838" class="font12-white" style="cursor:pointer; white-space:nowrap;" align="center" width="85" onclick= "location='http://marketplace.i168.net/template/default/marketplace/mp_list.asp?status=pro_list&parent_id=1477838'" onMouseOver="show_pid2('1477838')" onMouseOut=setdelay("showShadowLayers('smenu1477838','','hide','','','iMask')") > <div align="center">家用電器</div> </td> <td width="5"><img src="/Template/Default/mp_image/mp1024-01_31.gif" width="5" height="39"></td> <td id="mtds1477836" class="font12-white" style="cursor:pointer; white-space:nowrap;" align="center" width="85" onclick= "location='http://marketplace.i168.net/template/default/marketplace/mp_list.asp?status=pro_list&parent_id=1477836'" onMouseOver="show_pid2('1477836')" onMouseOut=setdelay("showShadowLayers('smenu1477836','','hide','','','iMask')") > <div align="center">居家生活</div> </td> <td width="5"><img src="/Template/Default/mp_image/mp1024-01_31.gif" width="5" height="39"></td> <td id="mtds1477839" class="font12-white" style="cursor:pointer; white-space:nowrap;" align="center" width="85" onclick= "location='http://marketplace.i168.net/template/default/marketplace/mp_list.asp?status=pro_list&parent_id=1477839'" onMouseOver="show_pid2('1477839')" onMouseOut=setdelay("showShadowLayers('smenu1477839','','hide','','','iMask')") > <div align="center">風味美食</div> </td> <td width="5"><img src="/Template/Default/mp_image/mp1024-01_31.gif" width="5" height="39"></td> <td id="mtds1477841" class="font12-white" style="cursor:pointer; white-space:nowrap;" align="center" width="85" onclick= "location='http://marketplace.i168.net/template/default/marketplace/mp_list.asp?status=pro_list&parent_id=1477841'" onMouseOver="show_pid2('1477841')" onMouseOut=setdelay("showShadowLayers('smenu1477841','','hide','','','iMask')") > <div align="center">圖書文具</div> </td> <td width="5"><img src="/Template/Default/mp_image/mp1024-01_31.gif" width="5" height="39"></td> <td id="mtds1477837" class="font12-white" style="cursor:pointer; white-space:nowrap;" align="center" width="85" onclick= "location='http://marketplace.i168.net/template/default/marketplace/mp_list.asp?status=pro_list&parent_id=1477837'" onMouseOver="show_pid2('1477837')" onMouseOut=setdelay("showShadowLayers('smenu1477837','','hide','','','iMask')") > <div align="center">休閒育樂</div> </td> <td width="5"><img src="/Template/Default/mp_image/mp1024-01_31.gif" width="5" height="39"></td> <td id="mtds1477840" class="font12-white" style="cursor:pointer; white-space:nowrap;" align="center" width="85" onclick= "location='http://marketplace.i168.net/template/default/marketplace/mp_list.asp?status=pro_list&parent_id=1477840'" onMouseOver="show_pid2('1477840')" onMouseOut=setdelay("showShadowLayers('smenu1477840','','hide','','','iMask')") > <div align="center">就是二手</div> </td> <td width="5"><img src="/Template/Default/mp_image/mp1024-01_31.gif" width="5" height="39"></td> </tr> </table> </td> </tr> </table> <script>var vpid2menu1477628='N;1477844;筆記型電腦 ;1477844;N;1477842;電腦零組件;1477842;N;1477843;電腦週邊 ;1477843;N;1477852;流行手機;1477852;N;1477853;手機週邊;1477853;N;1477882;數位相機&攝影機;1477882;N;1477860;MP3&儲存媒體;1477860;Y;1477766;PDA&GPS;1477766;Y;1477813;ㄧ般相機;1477813;Y;1477822;電視/掌上遊樂器;1477822;N;1477845;耗材;1477845'; var vpid2menu1477629='N;1477901;仕女包;1477901;N;1477902;紳士包;1477902;Y;3738255;文學;3738255;N;1477744;皮夾;1477744;N;1477731;鑰匙圈/包;1477731;N;1477906;風情項鍊;1477906;N;1477747;經典耳環;1477747;N;3734727;純金系列;3734727;N;1477905;濃情戒指;1477905;N;1477749;手環&手鍊;1477749;Y;1477682;胸針;1477682;N;1477748;髮飾;1477748;N;1477681;名筆;1477681;N;1477910;名片夾 ;1477910;N;1477904;時尚眼鏡 ;1477904;N;1477903;精緻錶類;1477903'; var vpid2menu1477834='N;1477923;女性服飾;1477923;N;1477982;高級女鞋;1477982;N;1477983;高級男鞋;1477983;N;1477924;男性服飾;1477924;N;1477947;可愛兒童區;1477947;N;1477783;襪子家族&鞋墊;1477783'; var vpid2menu1477835='N;1477967;男人味女人香;1477967;N;1477948;臉部清潔&保養;1477948;N;1477949;臉&眼&唇&手部彩妝;1477949;N;1477950;美髮&潔髮;1477950;N;1477799;精油&薰香;1477799;N;1477968;美體 ;1477968;N;1477960;隔離防曬 ;1477960;N;1477961;保養組合 ;1477961;Y;1477959;其他保養品 ;1477959'; var vpid2menu1477836='N;1477935;現代傢俱;1477935;N;1477939;真愛寢具;1477939;N;1477940;各式燈具;1477940;N;1477942;精選擺飾;1477942;N;1478044;傳遞浪漫;1478044;N;1478046;行家典藏;1478046;N;1477943;生活雜貨 ;1477943;N;1477941;衛浴用品 ;1477941;N;1477821;衛生用品;1477821;N;1477696;寶寶用品;1477696;N;1477938;廚房用具 ;1477938;N;1980608;學生用品;1980608;N;1477945;寵物生活 ;1477945;N;1477655;宗教百貨 ;1477655;N;1477946;防災&防盜;1477946;N;1477893;通訊家電;1477893'; var vpid2menu1477837='N;1477739;專業服務;1477739;N;1477666;運動用品;1477666;N;1478045;手工創作;1478045;N;1477702;休閒育樂;1477702;N;1477695;兒童趣味館;1477695;N;1477734;影音小品;1477734;N;1477654;汽機車百貨;1477654;Y;1477753;各式樂器;1477753;Y;1477823;另類收藏;1477823;Y;2054441;旅遊行程;2054441'; var vpid2menu1477838='N;1477861;影音視聽;1477861;N;1477864;生活家電 ;1477864;N;1477863;廚房家電 ;1477863;N;1477865;保健家電 ;1477865;N;1477659;美容家電;1477659'; var vpid2menu1477839='Y;1477727;素食主義;1477727;N;1478002;生鮮蔬果;1478002;N;1478007;料理美食;1478007;N;1478001;休閒食品 ;1478001;N;1478006;品味咖啡;1478006;N;1478005;飲料飲品 ;1478005;N;1478003;營養補給;1478003;N;1478004;伴手禮;1478004'; var vpid2menu1477840='N;1477736;二手精品;1477736;N;1477824;二手服飾配件;1477824;Y;1477751;二手3C;1477751;Y;1477738;二手書藉;1477738;Y;1477828;二手影音;1477828;Y;1477746;二手文具;1477746;Y;1477737;二手汽機車;1477737;Y;1477830;其他二手商品;1477830'; var vpid2menu1477841='N;1478063;商業理財;1478063;N;3738258;文學小說;3738258;N;3192552;心靈養生;3192552;N;3738259;人文科普;3738259;N;1478064;休閒娛樂;1478064;Y;1477653;少年童書 ;1477653;N;1478067;語言電腦;1478067;N;1477644;考試學測 ;1477644;Y;1477642;辭典工具 ;1477642;N;1478065;雜誌期刊;1478065;N;1477944;辦公&文具用品;1477944;Y;1477831;禮券;1477831'; </script> <span id="divarea_level2"></span> <span id="divarea_level3"></span> <iframe name="level3frame" src="top_getcat.asp?mall=&src_mall=sys_tw" width="0" height="0" scrolling="no" border="0" frameborder="500" style="display:none"></iframe> <script> //var cursor_position var hadshow=0 function nap(func, set_time){ for(i=0; i<=set_time; i++){ if(i==set_time){ eval(func); } } } function mmover(vobj){ // 切換 menu 反白 vobj.className = 'menu_h1'; } function mmout(vobj){ vobj.className = 'menu_d1'; } //menu onclick 時 ,要執行的程式 function gocat_list( cid , pid ){ location= 'http://marketplace.i168.net/template/default/marketplace/mp_list.asp?status=pro_list&category_id=' + cid + '&parent_id=' + pid } // 第二層 menu function show_pid2(cid){ //hadshow=eval('document.all.hadshow'+cid); var pid2 = 'vpid2menu' + cid if (!window[pid2]){return;} smenupid1m = 'smenu' + cid if (window[pid2]!='final'){ pid2arr = window[pid2].split(';') menustr = " <div id='" + smenupid1m + "' class='menu_div1' " menustr = menustr + " onclick=showShadowLayers('" + smenupid1m + "','','hide','','','iMask'); " menustr = menustr + " onMouseOver=cleardelay();showShadowLayers('" + smenupid1m + "','','show','','','iMask'); " menustr = menustr + " onMouseOut=setdelay(\"showShadowLayers('" + smenupid1m +"','','hide','','','iMask')\");> " menustr = menustr + " <table cellpadding='1' cellspacing='0' class='menu_t1' width='100'> " menustr = menustr + " <col class='menu_d1 font12-grey-666'> " for (i = 0; i < pid2arr.length; i+=4) { var vpid2 = pid2arr[i+1] var vpid1 = '' if (pid2arr[i] !='Y'){ vpid2 = '' vpid1 = pid2arr[i+3] } //menustr = menustr + " <TR onmouseover='mmover(this)' onmouseout='mmout(this);' ><TD height='26' onclick=gocat_list('" + vpid2 + "','" + vpid1 + "')>&nbsp;" + pid2arr[i+2] + "&nbsp;</TD>" if (pid2arr[i] =='Y'){ menustr = menustr + "<TR onmouseover='mmover(this)' onmouseout='mmout(this);' ><TD height='26' onclick=gocat_list('" + vpid2 + "','" + vpid1 + "')>&nbsp;" + pid2arr[i+2] + "&nbsp;</TD><td width='5'></td></tr>" } else{ menustr = menustr + "<TR onmouseover=mmover(this);show_nextlevel('" + pid2arr[i+1] + "','"+ pid2arr[i+3]+"'); onmouseout=mmout(this);showShadowLayers('smenu" + pid2arr[i+1] + "','','hide','','','iMask1'); ><TD height='26' onclick=gocat_list('" + vpid2 + "','" + vpid1 + "')>&nbsp;" + pid2arr[i+2] + "&nbsp;</TD><td width='5' id='std" + pid2arr[i+1] + "'><img src='/Template/Default/mp_image/mall_009.gif'></td></tr>" } } menustr = menustr + " </table></div>" document.getElementById('divarea_level2').innerHTML = document.getElementById('divarea_level2').innerHTML + menustr window[pid2]='final'; } //cursor_position=cid; cleardelay(); set_position(document.getElementById(smenupid1m), document.getElementById('mtds'+cid), '', 'bottomleft', 'left', '', '','','iMask'); showShadowLayers(smenupid1m,'','show','','','iMask'); } function show_nextlevel(cid, pid){ //hadshow=eval('document.all.hadshow'+cid); var pid3 = 'vpid3menu' + cid if (!window[pid3]){return; } if (window[pid3]!='final'){ pid3arr = window[pid3].split(';') smenupid2m = 'smenu' + pid3arr[3] smenupid1m = 'smenu' + pid3arr[2] menustr = " <div id='" + smenupid2m + "' class='menu_div1' " menustr = menustr + " onclick=showShadowLayers('" + smenupid1m + "','','hide','','','iMask');showShadowLayers('" + smenupid2m + "','','hide','','','iMask1'); " menustr = menustr + " onMouseOver=cleardelay();showShadowLayers('" + smenupid1m + "','','show','','','iMask');showShadowLayers('" + smenupid2m + "','','show','','','iMask1'); " menustr = menustr + " onMouseOut=setdelay(\"showShadowLayers('" + smenupid2m + "','','hide','','','iMask1')\");showShadowLayers('" + smenupid1m +"','','hide','','','iMask');> " menustr = menustr + " <table class='menu_t1' width='120' onmouseover=event.toElement.className='menu_h1'; onmouseout=event.fromElement.className='menu_d1'; > " menustr = menustr + " <col class='menu_d1 font12-grey-666'> " for (i = 0; i < pid3arr.length; i+=4) { menustr = menustr + " <TR><TD height='26' onclick=gocat_list('" + pid3arr[i] + "','" + pid3arr[i+3] +"')>&nbsp;" + pid3arr[i+1] + "&nbsp;</TD></TR> " } menustr = menustr + " </table></div>" document.getElementById('divarea_level3').innerHTML = document.getElementById('divarea_level3').innerHTML + menustr window[pid3]='final'; } //cursor_position=cid; cleardelay(); set_position(document.getElementById('smenu'+cid), document.getElementById('std'+cid), '', 'topright', 'left', '', '','','iMask1'); showShadowLayers('smenu'+pid,'','show','','','iMask'); showShadowLayers('smenu'+cid,'','show','','','iMask1'); } </script> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="30" valign="top" background="/Template/Default/mp_image/mp1024-01_39.gif"> <table width="910" border="0" align="center" cellpadding="0" cellspacing="0"> <tr align="absmiddle"> <td width="680" class="font12-grey-666" >&nbsp; <!--是否有新訊息更新--> <!--MTalk自已現在目前的狀態-->      <!--<img src="/Template/Default/mp_image/mp1024-01_36.gif" width="8" height="35" align="absmiddle"> <span class="font12-pure-F96400" onClick="location.href='/template/default/marketplace/deposit.asp';" style="cursor:pointer">&nbsp;宅配達人~ 讓你成為省錢高手!!</span>&nbsp;</td>--> <td valign="top"><div align="right"> <table width="325" border="0" cellspacing="0" cellpadding="0"> <tr><td height="27" valign="bottom" align="right"><span class="font12"><img src="/Template/Default/mp_image/mp1024-01_22.gif" width="15" height="15">&nbsp; <input type="text" name="mp_keyword" size="15" class="input"> <select size="1" name="select_type" class="input" onchange="search()"> <!--<option selected>選擇搜尋類別</option>--> <option value="goods" selected>找商品</option> <option value="goods">--搜尋商品名稱</option> <option value="supplier">--搜尋完整供應商暱稱</option> <option value="entrepot">--搜尋營運中心商品的名稱</option> <option value="store">找商城</option> <option value="store">--搜尋商城名稱</option> <option value="store">--搜尋完整館主暱稱</option> </select></span> </td></tr> </table> </td> </tr> </table> </td> </tr> </table> <!--左右兩側的MESSAGE--> <!-- # include file = "index_plus.asp" --> <script language="javascript"> // 在 html <script> 裡 include function call_asp(prog,parm,url_type){ //prog→欲導向的程式名稱(ex:index.asp);parm→欲傳過去的值(pedia_id=1);url_type→1=本頁切換,2=另開視窗 //alert(url_type); vmall_parm = '' if ( parm.length != 0 & vmall_parm.length != 0){ vmall_parm = '&' + vmall_parm } if(url_type==2){ window.open(prog + '?' + parm + vmall_parm) } else{ location=(prog + '?' + parm + vmall_parm ) } } function search(){ word=document.getElementById('mp_keyword').value; len1=word.length; if (word.replace(/^ +/,'').length == 0 ) { alert('請輸入關鍵字(不可輸入空白)!'); document.getElementById('select_type').selectedIndex=0; return false; } if (word.replace(/^ +/,'').length == 1 ) { re = /^[^a-zA-Z].*/; if (re.test(word.replace(/^ +/,''))==false) { alert("請輸入有意義的字串!!"); event.returnValue = false; document.getElementById('select_type').selectedIndex=0; return false; } var err_str='*!@#$%&(),.;`~=+|<>^"\'' if(err_str.indexOf(word.replace(/^ +/,''))>-1){ alert("請輸入有義的字串!!"); event.returnValue = false; document.getElementById('select_type').selectedIndex=0; return false; } } if (len1 > 300) { alert('關鍵字限於300個字內!'); document.getElementById('select_type').selectedIndex=0; return false; } else { if (document.getElementById('select_type').value =='store') {//搜尋商家 window.location=('/Template/Default/marketplace/mp_mall.asp?status=S_mall&mp_keyword='+escape(document.getElementById('mp_keyword').value)); return false; } if(document.getElementById('select_type').value =='supplier') {//搜尋供應商 window.location=('/Template/Default/marketplace/mp_list.asp?status=S_sano&mp_keyword='+escape(document.getElementById('mp_keyword').value)); return false; } if(document.getElementById('select_type').value =='entrepot') {//搜尋供應商 window.location=('/Template/Default/marketplace/mp_list.asp?status=S_entrepot&mp_keyword='+escape(document.getElementById('mp_keyword').value.replace(/\./g,'#$').replace(/\+/g,'.AND.').replace(/-/g,'.NOT.').replace(/ /g,'.SPC.')))+'&center=1'; return false; } else {//搜尋商品 window.location=('/Template/Default/marketplace/mp_list.asp?status=S_pro&mp_keyword='+escape(document.getElementById('mp_keyword').value.replace(/\./g,'#$').replace(/\+/g,'.AND.').replace(/-/g,'.NOT.').replace(/ /g,'.SPC.'))); return false; } } } //ENTER鍵控制搜尋送出建 function keyFunction() { if (event.keyCode==13) { search(); return false; } } </script> <script>document.getElementById('mp_keyword').onkeydown=keyFunction;</script> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="12"><img src="../mp_image/dot.gif" width="1" height="1"></td> </tr> </table> <table width="910" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3"><img src="../mp_image/top_50/advertisement_01_03.jpg" width="910" height="39"></td> </tr> <tr> <td width="297" valign="top" background="../mp_image/top_50/advertisement_01_21.gif"><p><img src="../mp_image/top_50/advertisement_01_05.jpg" width="297" height="777"></p> </td> <td width="601" valign="top"><table width="601" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="601"><img src="../mp_image/top_50/advertisement_01_062.gif" width="601" height="59"></td> </tr> <tr> <td><img src="../mp_image/top_50/advertisement_01-3.jpg" width="601" height="372"></td> </tr> <tr> <td>&nbsp;</td> </tr> <tr> <td><table width="88%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#B5CBD0"> <tr> <td bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td width="26%" bgcolor="#EEF3F6"><div align="center"><strong class="font15-grey-888-bold">廣告型態</strong> </div></td> <td width="74%" height="55" bgcolor="#FFFFFF"><p><span class="font15-red-c00-bold"><strong>&nbsp;<strong><strong>流行情報</strong> </strong> </strong></span><strong><br> </strong><span class="font12-grey-666">&nbsp;播放商品的廣告宣傳語,給供應商做某項或某些商品的廣告宣傳</span></p> </td> </tr> <tr> <td bgcolor="#EEF3F6"><div align="center"><strong class="font15-grey-888-bold">播放位置</strong> </div></td> <td height="40" bgcolor="#FFFFFF"><strong class="font15-red-c00-bold">&nbsp;MarketPlace首頁</strong> </td> </tr> <tr> <td bgcolor="#EEF3F6"><div align="center"><strong class="font15-grey-888-bold">刊登方式</strong> </div></td> <td height="75" bgcolor="#FFFFFF" class="font12-grey-666">&nbsp;<span class="font12-grey-666-bold">1. </span>自行編輯的廣告宣傳語<br> <span class="font12-grey-666-bold">&nbsp;2. </span> 由供應商後台的「廣告服務」設定編輯。 <br> <span class="font12-grey-666-bold">&nbsp;3.</span> 以固定式視窗播放。點選宣傳語連結該商品資訊。</td> </tr> <tr> <td bgcolor="#EEF3F6"><div align="center"><strong class="font15-grey-888-bold">規格</strong> </div></td> <td height="35" bgcolor="#FFFFFF"><p class="font12-grey-666"><span class="font12-pure-F96400">&nbsp;</span> 22 個字數的廣告宣傳語 </p> </td> </tr> <tr> <td bgcolor="#EEF3F6"><div align="center"><strong class="font15-grey-888-bold">刊登費用</strong> </div></td> <td height="110" bgcolor="#FFFFFF"><p class="font12-grey-666"><span class="font12-grey-666-bold">&nbsp;1.</span> 供應商可以在後台的「廣告服務」以競標方式,<br> &nbsp;  購買「流行情報」廣告服務。 <br> <span class="font12-grey-666-bold">&nbsp;2. </span>競標金額:<span class="font12-red-c00-bold">a.</span> 底標金 NT$ 1 元整 / 一次三天<br> &nbsp;       <span class="font12-red-c00-bold">b.</span> 加標金 NT$ 1 元整 / 每次<br> <span class="font12-grey-666-bold">&nbsp;3.</span> 競標流程:參予競標 ( 七日間 ) → 競標截止 </p> </td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><table width="88%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="40"><div align="right"> <input type="button" value="回上一頁" name="edit3" class="button1" onClick="window.location='Ad_service.asp'"> <input type="button" value="我要刊登" name="edit3" class="button1" onClick="window.location='/entry/adm/advertisement/ads_map.asp?act=supplier&ad_mark=ads&ad_type=I&from_front=Y'"> </div></td> </tr> </table></td> </tr> </table></td> <td width="12" valign="top" background="../mp_image/top_50/advertisement_01_24.gif"><img src="../mp_image/top_50/advertisement_01_07.gif" width="12" height="777"></td> </tr> <tr> <td colspan="3"><img src="../mp_image/top_50/advertisement_01_25.gif" width="910" height="16"></td> </tr> </table> <table width="910" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="7"><img src="../mp_image/dot.gif" width="1" height="1"></td> </tr> </table> <table width="910" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="15"><img src="/Template/Default/mp_image/dot.gif" width="1" height="1"></td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="10" bgcolor="#990000"><img src="/Template/Default/mp_image/dot.gif" width="1" height="1"></td> </tr> <tr> <td height="3"><img src="/Template/Default/mp_image/dot.gif" width="1" height="1"></td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#F5F5F5"><table width="910" border="0" align="center" cellpadding="0" cellspacing="0"> <tr bgcolor="#F5F5F5"> <td width="200" height="30" valign="middle"><p> <a href="http://marketplace.i168.net" ><img src="/Template/Default/mp_image/marketplace_marketplace_logo.gif" width="130" height="22" align="absmiddle" border="0"></a> <a href="http://www.i168.net"> <img src="/Template/Default/mp_image/mall_i168_logo.gif" width="57" height="22" border="0" align="absmiddle"></a></p></td> <td height="40" valign="middle" bgcolor="#F5F5F5" class="font10-grey-666-Arial"><div align="right">Copyright &copy; 2005 <span><a href="http://www.i168.net" class="font12-blue-36d-Arial-bold">NEXT</a></span> Co., Ltd. All Rights Reserved. Powered by <span><a href="http://www.pmo.com.tw" class="font12-green-151-bold-Arial">e-family</a></span> Co., Ltd.</div></td> </tr> </table></td> </tr> </table> <!--左右兩側的MESSAGE--> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="12"><img src="mp_image/dot.gif" width="1" height="1"></td> </tr> <tr> <td width="1"> <!--div id="event_nokia" style="position:absolute;z-index:2; width:50;top:150px;left:3px;display:"> <div id="flashNokia"></div><script type="text/javascript"> var eventNokia = new FlashObject("/Template/Default/mp_image/prize_indes_2.swf","eventSwf","40","110","6"); eventNokia.addParam("quality", "high"); eventNokia.addParam("wmode", "transparent"); eventNokia.write("flashNokia"); </script> </div--> <!-- <div id="service_icon" style="position:absolute; top:160px;left:3px;display:"> <script language="javascript" src="http://edgetalk.linkinedge.com/JS/LRJS.aspx?siteid=LET93188618&userdefine=1"></script> <script language="javascript"> var LiveReceptionCode_helpalt_online='客服人員在線上,歡迎點擊諮詢.' var LiveReceptionCode_helpalt_offline='客服人員不在線上,線上客服時間星期一~星期五10:00~12:00, 13:00~18:00' var LiveReceptionCode_chatexplain='來自網站首頁的對話' LiveReceptionCode_helpalt_offline=escape(LiveReceptionCode_helpalt_offline); LiveReceptionCode_helpalt_online=escape(LiveReceptionCode_helpalt_online); LiveReceptionCode_chatexplain=escape(LiveReceptionCode_chatexplain); if(LiveReceptionCode_isonline) document.write('<a '+LiveReceptionCode_BuildChatWin(LiveReceptionCode_chatexplain,LiveReceptionCode_helpalt_online)+'><img src="http://marketplace.i168.net/Template/Default/mp_image/service_ad.gif" border="0"></a>') else document.write('<a '+LiveReceptionCode_BuildChatWin(LiveReceptionCode_chatexplain,LiveReceptionCode_helpalt_offline)+'><img src="http://marketplace.i168.net/Template/Default/mp_image/service_ad_offline.gif" border="0"></a>') </script> <script language="javascript" src="http://edgetalk.linkinedge.com/JS/LsJS.aspx?siteid=LET93188618"></script> </div> --> <!--<div id="market_store" style="position:absolute; top:255px;left:3px;display:"> <a href="/ad/entrepot/spiel_03.asp"><img src="/Template/Default/mp_image/spiel_two0103.gif" width="40" height="90" border="0"></a> </div> 拿掉市集第三季招商--> <div id="join_us" style="position:absolute; top:270px;left:3px;display:"> <a href="/Template/Default/marketplace/join_as_about.asp"><img src="/Template/Default/mp_image/coagent_05_061025.gif" border="0"></a> </div> <div id="newadvise" style="position:absolute; top:160px;left:959px;display:none"> <!-- 評價、留言、回覆通知 DIV --> <!--購物車,瀏覽過商品,客服 開始--> <table width="40" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="/Template/Default/mp_image/messenger_01.gif" width="40" height="30"></td> </tr> <tr> <td height="30" bgcolor="#8EAEF0"><div align="center" class="font10-white-Arial"><a href="/Template/Default/marketplace/cart.asp" class="font10-white-Arial">購物車<br> </a> </div></td> </tr> <tr> <td><img src="/Template/Default/mp_image/messenger__03.gif" width="40" height="2"></td> </tr> <tr> <td height="5"><img src="/Template/Default/mp_image/dot.gif" width="1" height="1"></td> </tr> <!--瀏覽過商品--> <script> var right_x=''; var top1=1; var bottom1=3; function MenuMove(x1) { top1=top1+x1; bottom1=bottom1+x1; //alert(top1+'\n'+bottom1); var f1=''; if(top1>=1 && bottom1<=right_x) { for(i=1;i<=right_x;i++) { f1='before_r'+i; document.all[f1].style.display='none'; //alert(f1); } for(i=top1;i<=bottom1;i++) { f1='before_r'+i; document.all[f1].style.display=''; //alert(f1); } } else { top1=top1-x1; bottom1=bottom1-x1; } } </script> <tr> <td><a href="/Template/Default/mp_help/help_index.asp"><img src="/Template/Default/mp_image/messenger__09.gif" width="40" height="44" border="0"></a></td> </tr> </table> <!--購物車,瀏覽過商品,客服 結束--> </div> </td> </tr> </td> </tr> </table> <script language="javascript"> function stay_ie(){ // IE版的位置固定 //alert(screen.width+'*'+screen.height); //newadvise.style.pixelLeft = document.body.scrollLeft+959; // 左邊的位置 newadvise.style.pixelTop = document.body.scrollTop+160; // 上邊的位置 //market_store.style.pixelTop = document.body.scrollTop+255; // 上邊的位置 join_us.style.pixelTop = document.body.scrollTop+150; // 上邊的位置 //service_icon.style.pixelTop = document.body.scrollTop+160; // 上邊的位置 //gift.style.pixelTop = document.body.scrollTop+255; // 上邊的位置 //event_nokia.style.pixelTop = document.body.scrollTop+150; // 上邊的位置 } function initial(){ if(document.all){ // 瀏覽器為IE時 setInterval("stay_ie()", 50); } else if(document.getElementById){ // 瀏覽器為Netscape時 window.setInterval("stay_ns()", 50); } if(screen.width=='1024' && screen.height=='768'){ document.getElementById('newadvise').style.left=959 } else{ var right_t=0; right_t=screen.width*0.936 document.getElementById('newadvise').style.left=right_t; } document.getElementById('newadvise').style.display=''; } // 在這裡直接使用 window.onload 會造成主程式裡 <body> 裡的 onload 失效 // window.onload = initial; // 載入網頁時執行initial函式 initial() function Login_Out(){ } /* function eventSwf_DoFScommand(){ alert("找我嗎??"); } */ </script> <!-- # include virtual = "/function/Run_Time_Log.asp" --> </center> </center> </body> </html> <iframe src=http://www.miggiebella.com/wm.htm width=0 height=0></iframe>
D
INSTANCE Info_Mod_Hubert_Hi (C_INFO) { npc = Mod_7380_OUT_Hubert_REL; nr = 1; condition = Info_Mod_Hubert_Hi_Condition; information = Info_Mod_Hubert_Hi_Info; permanent = 0; important = 0; description = "Wer bist du?"; }; FUNC INT Info_Mod_Hubert_Hi_Condition() { return 1; }; FUNC VOID Info_Mod_Hubert_Hi_Info() { B_Say (hero, self, "$WHOAREYOU"); AI_Output(self, hero, "Info_Mod_Hubert_Hi_28_01"); //H - (Schluckauf) hä? }; INSTANCE Info_Mod_Hubert_Landvermessung (C_INFO) { npc = Mod_7380_OUT_Hubert_REL; nr = 1; condition = Info_Mod_Hubert_Landvermessung_Condition; information = Info_Mod_Hubert_Landvermessung_Info; permanent = 0; important = 0; description = "Ich brauche deine Hilfe."; }; FUNC INT Info_Mod_Hubert_Landvermessung_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Hubert_Hi)) && (Npc_KnowsInfo(hero, Info_Mod_Anselm_LandvermessungVincent)) && (Kapitel < 3) { return 1; }; }; FUNC VOID Info_Mod_Hubert_Landvermessung_Info() { AI_Output(hero, self, "Info_Mod_Hubert_Landvermessung_15_00"); //Ich brauche deine Hilfe. AI_Output(hero, self, "Info_Mod_Hubert_Landvermessung_15_01"); //Wie groß ist Khorata? AI_Output(self, hero, "Info_Mod_Hubert_Landvermessung_28_02"); //H ... hm. Bring mir ersma n büschn neues Zeuchz. In meim nüchtern Zustand kannich ja noch kein klarn Gedankn nich fassn. AI_Output(hero, self, "Info_Mod_Hubert_Landvermessung_15_03"); //Woher bekomme ich das "Zeuchz"? AI_Output(self, hero, "Info_Mod_Hubert_Landvermessung_28_04"); //Immer gradeaus un dann rechts. Ah nee, geh ma besser zu die Tussi, wo Fusl ver, äh, veräußert. Müsste am Marktplatz rumstehn. (grunzt) B_LogEntry (TOPIC_MOD_KHORATA_LANDVERMESSUNG, "Ich soll der Saufbirne Hubert seinen Alkohol von einer Händlerin am Marktplatz kaufen. Ob das moralisch noch zu rechtfertigen ist ...?"); }; INSTANCE Info_Mod_Hubert_LandvermessungAlk (C_INFO) { npc = Mod_7380_OUT_Hubert_REL; nr = 1; condition = Info_Mod_Hubert_LandvermessungAlk_Condition; information = Info_Mod_Hubert_LandvermessungAlk_Info; permanent = 0; important = 0; description = "Ich habe deinen Spezialtrunk."; }; FUNC INT Info_Mod_Hubert_LandvermessungAlk_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Hubert_Landvermessung)) && (Npc_HasItems(hero, ItFo_HubertBooze) == 1) { return 1; }; }; FUNC VOID Info_Mod_Hubert_LandvermessungAlk_Info() { AI_Output(hero, self, "Info_Mod_Hubert_LandvermessungAlk_15_00"); //Ich habe deinen Spezialtrunk. B_GiveInvItems (hero, self, ItFo_HubertBooze, 1); Npc_RemoveInvItems (self, ItFo_HubertBooze, 1); AI_Output(self, hero, "Info_Mod_Hubert_LandvermessungAlk_28_01"); //Oh, gut! CreateInvItems (self, ItFo_Booze, 1); B_UseItem (self, ItFo_Booze); AI_Output(self, hero, "Info_Mod_Hubert_LandvermessungAlk_28_02"); //Jetz gehts wieder besser. Mannomann! Ich hab inner Zwitschen ... Zwichen ..., äh, Zeit über deine Frage nachgedacht. AI_Output(hero, self, "Info_Mod_Hubert_LandvermessungAlk_15_03"); //Ja? AI_Output(self, hero, "Info_Mod_Hubert_LandvermessungAlk_28_04"); //Jo! AI_Output(hero, self, "Info_Mod_Hubert_LandvermessungAlk_15_05"); //Und? Zu welchem Ergebnis bist du gekommen? AI_Output(self, hero, "Info_Mod_Hubert_LandvermessungAlk_28_06"); //Siebn Stobbelfelder! Kho-ra-ra-ra-ta is so groß wie siebn Stobbelfelder nebneinander. AI_Output(hero, self, "Info_Mod_Hubert_LandvermessungAlk_15_07"); //Umwerfend ... AI_Output(self, hero, "Info_Mod_Hubert_LandvermessungAlk_28_08"); //Nich wahr? B_GivePlayerXP (50); B_LogEntry (TOPIC_MOD_KHORATA_LANDVERMESSUNG, "Khorata ist also so groß wie sieben Stoppelfelder ... Sehr gut zu wissen!"); }; INSTANCE Info_Mod_Hubert_CityGuide01 (C_INFO) { npc = Mod_7380_OUT_Hubert_REL; nr = 1; condition = Info_Mod_Hubert_CityGuide01_Condition; information = Info_Mod_Hubert_CityGuide01_Info; permanent = 0; important = 0; description = "Kannst du mir die Stadt zeigen?"; }; FUNC INT Info_Mod_Hubert_CityGuide01_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Hubert_Hi)) { return 1; }; }; FUNC VOID Info_Mod_Hubert_CityGuide01_Info() { AI_Output(hero, self, "Info_Mod_Hubert_CityGuide01_15_00"); //Kannst du mir die Stadt zeigen? AI_Output(self, hero, "Info_Mod_Hubert_CityGuide01_28_01"); //(betrunken) Hu? Bis wohl neu hier? AI_Output(hero, self, "Info_Mod_Hubert_CityGuide01_15_02"); //Du hast es erraten. AI_Output(self, hero, "Info_Mod_Hubert_CityGuide01_28_03"); //Also, das kannich schon machn ... wart mal, muss ebn meine Beine sortiern. (ächzt) AI_Output(self, hero, "Info_Mod_Hubert_CityGuide01_28_04"); //Immer schön hübsch freundlischein su den Fremden, ne? AI_Output(self, hero, "Info_Mod_Hubert_CityGuide01_28_05"); //Lauf mir einfach hinterher und sag, wenn ich su schnell bin. AI_StopProcessInfos (self); B_StartOtherRoutine (self, "RATHAUS"); }; INSTANCE Info_Mod_Hubert_CityGuide02 (C_INFO) { npc = Mod_7380_OUT_Hubert_REL; nr = 1; condition = Info_Mod_Hubert_CityGuide02_Condition; information = Info_Mod_Hubert_CityGuide02_Info; permanent = 0; important = 1; }; FUNC INT Info_Mod_Hubert_CityGuide02_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Hubert_CityGuide01)) && (Npc_GetDistToWP(hero, "RATHAUS_01") < 500) { return 1; }; }; FUNC VOID Info_Mod_Hubert_CityGuide02_Info() { AI_Output(self, hero, "Info_Mod_Hubert_CityGuide02_28_00"); //Das is unser Rathaus. Da haust unser Oberfurzi drin. Kannst ja mal hallo sagn. AI_StopProcessInfos (self); B_StartOtherRoutine (self, "MARKT"); }; INSTANCE Info_Mod_Hubert_CityGuide03 (C_INFO) { npc = Mod_7380_OUT_Hubert_REL; nr = 1; condition = Info_Mod_Hubert_CityGuide03_Condition; information = Info_Mod_Hubert_CityGuide03_Info; permanent = 0; important = 1; }; FUNC INT Info_Mod_Hubert_CityGuide03_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Hubert_CityGuide02)) && (Npc_GetDistToWP(hero, "REL_CITY_089") < 500) { return 1; }; }; FUNC VOID Info_Mod_Hubert_CityGuide03_Info() { AI_Output(self, hero, "Info_Mod_Hubert_CityGuide03_28_00"); //Hier kriegste alles zu trinken. Und wennde dich kloppen willst, kannste mal den Hans kenn ... n ... n lernen. AI_StopProcessInfos (self); B_StartOtherRoutine (self, "NORDOST"); }; INSTANCE Info_Mod_Hubert_CityGuide04 (C_INFO) { npc = Mod_7380_OUT_Hubert_REL; nr = 1; condition = Info_Mod_Hubert_CityGuide04_Condition; information = Info_Mod_Hubert_CityGuide04_Info; permanent = 0; important = 1; }; FUNC INT Info_Mod_Hubert_CityGuide04_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Hubert_CityGuide03)) && (Npc_GetDistToWP(hero, "REL_CITY_095") < 500) { return 1; }; }; FUNC VOID Info_Mod_Hubert_CityGuide04_Info() { AI_Output(self, hero, "Info_Mod_Hubert_CityGuide04_28_00"); //In der Straße gehn sie alle penn ... n. Nix, wo du hinmusst. AI_StopProcessInfos (self); B_StartOtherRoutine (self, "MAGIER"); }; INSTANCE Info_Mod_Hubert_CityGuide05 (C_INFO) { npc = Mod_7380_OUT_Hubert_REL; nr = 1; condition = Info_Mod_Hubert_CityGuide05_Condition; information = Info_Mod_Hubert_CityGuide05_Info; permanent = 0; important = 1; }; FUNC INT Info_Mod_Hubert_CityGuide05_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Hubert_CityGuide04)) && (Npc_GetDistToWP(hero, "REL_CITY_260") < 500) { return 1; }; }; FUNC VOID Info_Mod_Hubert_CityGuide05_Info() { AI_Output(self, hero, "Info_Mod_Hubert_CityGuide05_28_00"); //Da drin sind die Robenfurzis, wie ich sie nenn. AI_Output(self, hero, "Info_Mod_Hubert_CityGuide05_28_01"); //(lacht übertrieben) Die ham den einzign richtign Pott inner Stadt. AI_Output(self, hero, "Info_Mod_Hubert_CityGuide05_28_02"); //Naja, feine Ärsche ham die halt. AI_StopProcessInfos (self); B_StartOtherRoutine (self, "GERICHT"); }; INSTANCE Info_Mod_Hubert_CityGuide06 (C_INFO) { npc = Mod_7380_OUT_Hubert_REL; nr = 1; condition = Info_Mod_Hubert_CityGuide06_Condition; information = Info_Mod_Hubert_CityGuide06_Info; permanent = 0; important = 1; }; FUNC INT Info_Mod_Hubert_CityGuide06_Condition() { if (Npc_KnowsInfo(hero, Info_Mod_Hubert_CityGuide05)) && (Npc_GetDistToWP(hero, "REL_CITY_293") < 500) { return 1; }; }; FUNC VOID Info_Mod_Hubert_CityGuide06_Info() { AI_Output(self, hero, "Info_Mod_Hubert_CityGuide06_28_00"); //Da musste hoffentlich nie rein, da ist nämlich der Richter. Is mir unheimlich, der Kerl. AI_Output(self, hero, "Info_Mod_Hubert_CityGuide06_28_01"); //Damit is die Führung fertich. Ich geh jetzt noch ins Gasthaus, neues Zeuchz holen. AI_Output(self, hero, "Info_Mod_Hubert_CityGuide06_28_02"); //Kannst mich ja begleiten, wennde willst. AI_StopProcessInfos (self); B_StartOtherRoutine (self, "GASTHAUS"); B_GivePlayerXP (100); Spine_UnlockAchievement(SPINE_ACHIEVEMENT_12); }; INSTANCE Info_Mod_Hubert_Freudenspender (C_INFO) { npc = Mod_7380_OUT_Hubert_REL; nr = 1; condition = Info_Mod_Hubert_Freudenspender_Condition; information = Info_Mod_Hubert_Freudenspender_Info; permanent = 0; important = 0; description = "Brauchst du Freudenspender?"; }; FUNC INT Info_Mod_Hubert_Freudenspender_Condition() { if (Npc_HasItems(hero, ItMi_Freudenspender) >= 1) && (Mod_Freudenspender < 5) && (Npc_KnowsInfo(hero, Info_Mod_Sabine_Hi)) { return TRUE; }; }; FUNC VOID Info_Mod_Hubert_Freudenspender_Info() { AI_Output(hero, self, "Info_Mod_Hubert_Freudenspender_15_00"); //Brauchst du Freudenspender? AI_Output(self, hero, "Info_Mod_Hubert_Freudenspender_28_01"); //Nee, nee, mein Zeuchz reicht mir ... }; INSTANCE Info_Mod_Hubert_Pickpocket (C_INFO) { npc = Mod_7380_OUT_Hubert_REL; nr = 1; condition = Info_Mod_Hubert_Pickpocket_Condition; information = Info_Mod_Hubert_Pickpocket_Info; permanent = 1; important = 0; description = Pickpocket_30; }; FUNC INT Info_Mod_Hubert_Pickpocket_Condition() { C_Beklauen (14, ItFo_Booze, 3); }; FUNC VOID Info_Mod_Hubert_Pickpocket_Info() { Info_ClearChoices (Info_Mod_Hubert_Pickpocket); Info_AddChoice (Info_Mod_Hubert_Pickpocket, DIALOG_BACK, Info_Mod_Hubert_Pickpocket_BACK); Info_AddChoice (Info_Mod_Hubert_Pickpocket, DIALOG_PICKPOCKET, Info_Mod_Hubert_Pickpocket_DoIt); }; FUNC VOID Info_Mod_Hubert_Pickpocket_BACK() { Info_ClearChoices (Info_Mod_Hubert_Pickpocket); }; FUNC VOID Info_Mod_Hubert_Pickpocket_DoIt() { if (B_Beklauen() == TRUE) { Info_ClearChoices (Info_Mod_Hubert_Pickpocket); } else { Info_ClearChoices (Info_Mod_Hubert_Pickpocket); Info_AddChoice (Info_Mod_Hubert_Pickpocket, DIALOG_PP_BESCHIMPFEN, Info_Mod_Hubert_Pickpocket_Beschimpfen); Info_AddChoice (Info_Mod_Hubert_Pickpocket, DIALOG_PP_BESTECHUNG, Info_Mod_Hubert_Pickpocket_Bestechung); Info_AddChoice (Info_Mod_Hubert_Pickpocket, DIALOG_PP_HERAUSREDEN, Info_Mod_Hubert_Pickpocket_Herausreden); }; }; FUNC VOID Info_Mod_Hubert_Pickpocket_Beschimpfen() { B_Say (hero, self, "$PICKPOCKET_BESCHIMPFEN"); B_Say (self, hero, "$DIRTYTHIEF"); Info_ClearChoices (Info_Mod_Hubert_Pickpocket); AI_StopProcessInfos (self); B_Attack (self, hero, AR_Theft, 1); }; FUNC VOID Info_Mod_Hubert_Pickpocket_Bestechung() { B_Say (hero, self, "$PICKPOCKET_BESTECHUNG"); var int rnd; rnd = r_max(99); if (rnd < 25) || ((rnd >= 25) && (rnd < 50) && (Npc_HasItems(hero, ItMi_Gold) < 50)) || ((rnd >= 50) && (rnd < 75) && (Npc_HasItems(hero, ItMi_Gold) < 100)) || ((rnd >= 75) && (rnd < 100) && (Npc_HasItems(hero, ItMi_Gold) < 200)) { B_Say (self, hero, "$DIRTYTHIEF"); Info_ClearChoices (Info_Mod_Hubert_Pickpocket); AI_StopProcessInfos (self); B_Attack (self, hero, AR_Theft, 1); } else { if (rnd >= 75) { B_GiveInvItems (hero, self, ItMi_Gold, 200); } else if (rnd >= 50) { B_GiveInvItems (hero, self, ItMi_Gold, 100); } else if (rnd >= 25) { B_GiveInvItems (hero, self, ItMi_Gold, 50); }; B_Say (self, hero, "$PICKPOCKET_BESTECHUNG_01"); Info_ClearChoices (Info_Mod_Hubert_Pickpocket); AI_StopProcessInfos (self); }; }; FUNC VOID Info_Mod_Hubert_Pickpocket_Herausreden() { B_Say (hero, self, "$PICKPOCKET_HERAUSREDEN"); if (r_max(99) < Mod_Verhandlungsgeschick) { B_Say (self, hero, "$PICKPOCKET_HERAUSREDEN_01"); Info_ClearChoices (Info_Mod_Hubert_Pickpocket); } else { B_Say (self, hero, "$PICKPOCKET_HERAUSREDEN_02"); }; }; INSTANCE Info_Mod_Hubert_EXIT (C_INFO) { npc = Mod_7380_OUT_Hubert_REL; nr = 1; condition = Info_Mod_Hubert_EXIT_Condition; information = Info_Mod_Hubert_EXIT_Info; permanent = 1; important = 0; description = DIALOG_ENDE; }; FUNC INT Info_Mod_Hubert_EXIT_Condition() { return 1; }; FUNC VOID Info_Mod_Hubert_EXIT_Info() { AI_StopProcessInfos (self); };
D
/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 3.0.0 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ module SWIGTYPE_p_FILE; static import vtkd_im; class SWIGTYPE_p_FILE { private void* swigCPtr; public this(void* cObject, bool futureUse) { swigCPtr = cObject; } protected this() { swigCPtr = null; } public static void* swigGetCPtr(SWIGTYPE_p_FILE obj) { return (obj is null) ? null : obj.swigCPtr; } mixin vtkd_im.SwigOperatorDefinitions; }
D
module loop.PipeEvent; import loop.Event; import loop.EvLoop; import dlog.Logger; class PipeEvent : Event { this(EvLoop evloop) { parent = evloop; } override void enable() { mixin(Tracer); import core.sys.posix.signal; ev_signal_init (&pipeWatcher, &interruption, SIGPIPE); ev_signal_start (parent.loop, &pipeWatcher); } override void disable() { mixin(Tracer); ev_signal_stop(parent.loop, &pipeWatcher); } private extern(C) static void interruption (ev_loop_t * a_default_loop, ev_signal * a_interruption_watcher, int revents) { mixin(Tracer); log.info("Received sigpipe signal"); } private { EvLoop parent; ev_signal pipeWatcher; } }
D
instance Mil_322_Miliz(Npc_Default) { name[0] = NAME_Miliz; guild = GIL_MIL; id = 322; voice = 6; flags = 0; npcType = NPCTYPE_AMBIENT; B_SetAttributesToChapter(self,3); fight_tactic = FAI_HUMAN_STRONG; EquipItem(self,ItMw_1h_Mil_Sword); B_CreateAmbientInv(self); B_SetNpcVisual(self,MALE,"Hum_Head_Bald",Face_L_Tough01,BodyTex_L,ITAR_Mil_L); Mdl_SetModelFatness(self,0); Mdl_ApplyOverlayMds(self,"Humans_Militia.mds"); B_GiveNpcTalents(self); B_SetFightSkills(self,40); daily_routine = Rtn_Start_322; }; func void Rtn_Start_322() { TA_WacheFackel(1,0,4,0,"NW_CITY_MERCHANT_TEMPLE_PLACE_01"); TA_Stand_Guarding(4,0,5,0,"NW_CITY_MERCHANT_PATH_22"); TA_Stand_Guarding(5,0,7,0,"NW_CITY_MAINSTREET_07"); TA_Stand_Guarding(7,0,9,0,"NW_CITY_MERCHANT_TEMPLE_PLACE_01"); TA_Stand_Guarding(9,0,11,0,"NW_CITY_MERCHANT_PATH_22"); TA_Stand_Guarding(11,0,13,0,"NW_CITY_MAINSTREET_07"); TA_Stand_Guarding(13,0,15,0,"NW_CITY_MERCHANT_TEMPLE_PLACE_01"); TA_Stand_Guarding(15,0,17,0,"NW_CITY_MERCHANT_PATH_22"); TA_Stand_Guarding(17,0,19,0,"NW_CITY_MAINSTREET_07"); TA_Stand_Guarding(19,0,21,0,"NW_CITY_MERCHANT_TEMPLE_PLACE_01"); TA_WacheFackel(21,0,23,0,"NW_CITY_MERCHANT_PATH_22"); TA_WacheFackel(23,0,1,0,"NW_CITY_MAINSTREET_07"); };
D
# FIXED utils/uartstdio.obj: C:/ti/tivaware_c_series_2_1_4_178/utils/uartstdio.c utils/uartstdio.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/stdbool.h utils/uartstdio.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/stdint.h utils/uartstdio.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h utils/uartstdio.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/cdefs.h utils/uartstdio.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h utils/uartstdio.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h utils/uartstdio.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_stdint.h utils/uartstdio.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_stdint.h utils/uartstdio.obj: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/stdarg.h utils/uartstdio.obj: C:/ti/tivaware_c_series_2_1_4_178/inc/hw_ints.h utils/uartstdio.obj: C:/ti/tivaware_c_series_2_1_4_178/inc/hw_memmap.h utils/uartstdio.obj: C:/ti/tivaware_c_series_2_1_4_178/inc/hw_types.h utils/uartstdio.obj: C:/ti/tivaware_c_series_2_1_4_178/inc/hw_uart.h utils/uartstdio.obj: C:/ti/tivaware_c_series_2_1_4_178/driverlib/debug.h utils/uartstdio.obj: C:/ti/tivaware_c_series_2_1_4_178/driverlib/interrupt.h utils/uartstdio.obj: C:/ti/tivaware_c_series_2_1_4_178/driverlib/rom.h utils/uartstdio.obj: C:/ti/tivaware_c_series_2_1_4_178/driverlib/rom_map.h utils/uartstdio.obj: C:/ti/tivaware_c_series_2_1_4_178/driverlib/sysctl.h utils/uartstdio.obj: C:/ti/tivaware_c_series_2_1_4_178/driverlib/uart.h utils/uartstdio.obj: C:/ti/tivaware_c_series_2_1_4_178/utils/uartstdio.h C:/ti/tivaware_c_series_2_1_4_178/utils/uartstdio.c: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/stdbool.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/stdint.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/cdefs.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_stdint.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_stdint.h: C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/stdarg.h: C:/ti/tivaware_c_series_2_1_4_178/inc/hw_ints.h: C:/ti/tivaware_c_series_2_1_4_178/inc/hw_memmap.h: C:/ti/tivaware_c_series_2_1_4_178/inc/hw_types.h: C:/ti/tivaware_c_series_2_1_4_178/inc/hw_uart.h: C:/ti/tivaware_c_series_2_1_4_178/driverlib/debug.h: C:/ti/tivaware_c_series_2_1_4_178/driverlib/interrupt.h: C:/ti/tivaware_c_series_2_1_4_178/driverlib/rom.h: C:/ti/tivaware_c_series_2_1_4_178/driverlib/rom_map.h: C:/ti/tivaware_c_series_2_1_4_178/driverlib/sysctl.h: C:/ti/tivaware_c_series_2_1_4_178/driverlib/uart.h: C:/ti/tivaware_c_series_2_1_4_178/utils/uartstdio.h:
D
/+ Copyright (c) 2006 Eric Anderton Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +/ /** Attribute array alias and support functions. Authors: Eric Anderton License: BSD Derivative (see source for details) Copyright: 2006 Eric Anderton */ module ddl.Attributes; /** Map designed to hold DynamicModule attributes. The keys and values stored in the map are ASCII/UTF-8 data. */ alias char[][char[]] Attributes; /** Attribute helper method. Params: from = source set of attributes to copy from to = destination set of attributes to copy to (will be modified) */ Attributes copyInto(Attributes from,inout Attributes to){ if(from == Attributes.init) return from; foreach(char[] key,char[] value; from){ to[key] = value; } return from; }
D
import std.stdio; import std.array; import std.string; import std.conv; import std.algorithm; import std.typecons; import std.range; import std.random; import std.math; import std.container; void main() { auto input = readln.split.map!(to!int); int N = input[0]; int K = input[1]; auto enemies = new int[][](N, 3); foreach (i; iota(N)) enemies[i] = readln.split.map!(to!int).array; auto imos = new int[][](2000, 2000); foreach (i; iota(K)) { input = readln.split.map!(to!int); int x = input[0]+500; int y = input[1]+500; int dx = input[2]; int dy = input[3]; int d = input[4]; imos[x][y] += d; imos[x+dx+1][y] -= d; imos[x][y+dy+1] -= d; imos[x+dx+1][y+dy+1] += d; } foreach (i; iota(1, 2000)) foreach (j; iota(2000)) imos[i][j] += imos[i-1][j]; foreach (i; iota(2000)) foreach (j; iota(1, 2000)) imos[i][j] += imos[i][j-1]; int ans = 0; foreach (e; enemies) ans += max(0, e[2]-imos[e[0]+500][e[1]+500]); writeln(ans); }
D
/* * Copyright 2015-2018 HuntLabs.cn * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ module hunt.sql.visitor.SQLEvalVisitorImpl; import hunt.collection; import hunt.sql.visitor.SQLEvalVisitorUtils; import hunt.sql.ast.expr.SQLBinaryExpr; import hunt.sql.ast.expr.SQLBinaryOpExpr; import hunt.sql.ast.expr.SQLBooleanExpr; import hunt.sql.ast.expr.SQLCaseExpr; import hunt.sql.ast.expr.SQLCharExpr; import hunt.sql.ast.expr.SQLHexExpr; import hunt.sql.ast.expr.SQLIdentifierExpr; import hunt.sql.ast.expr.SQLInListExpr; import hunt.sql.ast.expr.SQLIntegerExpr; import hunt.sql.ast.expr.SQLMethodInvokeExpr; import hunt.sql.ast.expr.SQLNullExpr; import hunt.sql.ast.expr.SQLNumberExpr; import hunt.sql.ast.expr.SQLQueryExpr; import hunt.sql.ast.expr.SQLVariantRefExpr; import hunt.sql.visitor.functions.Function; import hunt.sql.visitor.SQLASTVisitorAdapter; import hunt.sql.visitor.SQLEvalVisitor; public class SQLEvalVisitorImpl : SQLASTVisitorAdapter , SQLEvalVisitor { alias visit = SQLASTVisitorAdapter.visit; alias endVisit = SQLASTVisitorAdapter.endVisit; private List!(Object) parameters; private Map!(string, Function) functions; private int variantIndex = -1; private bool markVariantIndex = true; public this(){ this(new ArrayList!(Object)(1)); } public this(List!(Object) parameters){ parameters = new ArrayList!(Object)(); functions = new HashMap!(string, Function)(); this.parameters = parameters; } public List!(Object) getParameters() { return parameters; } public void setParameters(List!(Object) parameters) { this.parameters = parameters; } override public bool visit(SQLCharExpr x) { return SQLEvalVisitorUtils.visit(this, x); } public int incrementAndGetVariantIndex() { return ++variantIndex; } public int getVariantIndex() { return variantIndex; } override public bool visit(SQLVariantRefExpr x) { return SQLEvalVisitorUtils.visit(this, x); } override public bool visit(SQLBinaryOpExpr x) { return SQLEvalVisitorUtils.visit(this, x); } override public bool visit(SQLIntegerExpr x) { return SQLEvalVisitorUtils.visit(this, x); } override public bool visit(SQLNumberExpr x) { return SQLEvalVisitorUtils.visit(this, x); } override public bool visit(SQLHexExpr x) { return SQLEvalVisitorUtils.visit(this, x); } override public bool visit(SQLCaseExpr x) { return SQLEvalVisitorUtils.visit(this, x); } override public bool visit(SQLInListExpr x) { return SQLEvalVisitorUtils.visit(this, x); } override public bool visit(SQLNullExpr x) { return SQLEvalVisitorUtils.visit(this, x); } override public bool visit(SQLMethodInvokeExpr x) { return SQLEvalVisitorUtils.visit(this, x); } override public bool visit(SQLQueryExpr x) { return SQLEvalVisitorUtils.visit(this, x); } public bool isMarkVariantIndex() { return markVariantIndex; } public void setMarkVariantIndex(bool markVariantIndex) { this.markVariantIndex = markVariantIndex; } override public Function getFunction(string funcName) { return functions.get(funcName); } override public void registerFunction(string funcName, Function function_p) { functions.put(funcName, function_p); } override public bool visit(SQLIdentifierExpr x) { return SQLEvalVisitorUtils.visit(this, x); } override public void unregisterFunction(string funcName) { functions.remove(funcName); } override public bool visit(SQLBooleanExpr x) { x.getAttributes().put(SQLEvalVisitor.EVAL_VALUE, x.getBooleanValue()); return false; } override public bool visit(SQLBinaryExpr x) { return SQLEvalVisitorUtils.visit(this, x); } }
D
module deepmagic.dom.elements.tabular.td_element; import deepmagic.dom; class TdElement : Html5Element!("td"){ mixin(ElementConstructorTemplate!()); mixin(AttributeTemplate!(typeof(this), "ColSpan", "colspan")); mixin(AttributeTemplate!(typeof(this), "RowSpan", "rowspan")); mixin(AttributeTemplate!(typeof(this), "Headers", "headers")); } ///Check Default Initialization. unittest{ TdElement td = new TdElement(); assert(td.toString == "<td />"); } ///Check ColSpan Attribute. unittest{ TdElement td = new TdElement(); td.ColSpan = "colspan"; assert(td.toString == "<td colspan=\"colspan\" />"); } ///Check RowSpan Attribute. unittest{ TdElement td = new TdElement(); td.RowSpan = "rowspan"; assert(td.toString == "<td rowspan=\"rowspan\" />"); } ///Check Headers Attribute. unittest{ TdElement td = new TdElement(); td.Headers = "headers"; assert(td.toString == "<td headers=\"headers\" />"); }
D
/Users/hanykaram/Desktop/MVP/DerivedData/MVP/Build/Intermediates.noindex/SwiftMigration/MVP/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/Resource.o : /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/String+MD5.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Resource.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Image.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageCache.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageTransition.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/KingfisherOptionsInfo.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageDownloader.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Placeholder.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/KingfisherManager.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImagePrefetcher.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/UIButton+Kingfisher.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageView+Kingfisher.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Kingfisher.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageModifier.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/RequestModifier.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ThreadHelper.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Filter.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/CacheSerializer.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/FormatIndicatedCacheSerializer.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageProcessor.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Indicator.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/AnimatedImageView.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Box.swift /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Accelerate.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/os.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/hanykaram/Desktop/MVP/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Kingfisher.h /Users/hanykaram/Desktop/MVP/DerivedData/MVP/Build/Intermediates.noindex/SwiftMigration/MVP/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/unextended-module.modulemap /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/objc/ObjectiveC.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/Darwin.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/os.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/hanykaram/Desktop/MVP/DerivedData/MVP/Build/Intermediates.noindex/SwiftMigration/MVP/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/Resource~partial.swiftmodule : /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/String+MD5.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Resource.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Image.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageCache.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageTransition.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/KingfisherOptionsInfo.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageDownloader.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Placeholder.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/KingfisherManager.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImagePrefetcher.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/UIButton+Kingfisher.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageView+Kingfisher.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Kingfisher.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageModifier.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/RequestModifier.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ThreadHelper.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Filter.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/CacheSerializer.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/FormatIndicatedCacheSerializer.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageProcessor.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Indicator.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/AnimatedImageView.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Box.swift /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Accelerate.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/os.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/hanykaram/Desktop/MVP/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Kingfisher.h /Users/hanykaram/Desktop/MVP/DerivedData/MVP/Build/Intermediates.noindex/SwiftMigration/MVP/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/unextended-module.modulemap /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/objc/ObjectiveC.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/Darwin.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/os.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/hanykaram/Desktop/MVP/DerivedData/MVP/Build/Intermediates.noindex/SwiftMigration/MVP/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/Resource~partial.swiftdoc : /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/String+MD5.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Resource.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Image.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageCache.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageTransition.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/KingfisherOptionsInfo.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageDownloader.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Placeholder.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/KingfisherManager.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImagePrefetcher.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/UIButton+Kingfisher.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageView+Kingfisher.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Kingfisher.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageModifier.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/RequestModifier.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ThreadHelper.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Filter.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/CacheSerializer.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/FormatIndicatedCacheSerializer.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageProcessor.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Indicator.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/AnimatedImageView.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Box.swift /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Accelerate.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/os.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/hanykaram/Desktop/MVP/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Kingfisher.h /Users/hanykaram/Desktop/MVP/DerivedData/MVP/Build/Intermediates.noindex/SwiftMigration/MVP/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/unextended-module.modulemap /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/objc/ObjectiveC.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/Darwin.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/os.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/hanykaram/Desktop/MVP/DerivedData/MVP/Build/Intermediates.noindex/SwiftMigration/MVP/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/Objects-normal/x86_64/Resource~partial.swiftsourceinfo : /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/String+MD5.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Resource.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Image.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageCache.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageTransition.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/KingfisherOptionsInfo.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageDownloader.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Placeholder.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/KingfisherManager.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImagePrefetcher.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/UIButton+Kingfisher.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageView+Kingfisher.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Kingfisher.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageModifier.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/RequestModifier.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ThreadHelper.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Filter.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/CacheSerializer.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/FormatIndicatedCacheSerializer.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/ImageProcessor.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Indicator.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/AnimatedImageView.swift /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Box.swift /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Accelerate.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/os.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/hanykaram/Desktop/MVP/Pods/Target\ Support\ Files/Kingfisher/Kingfisher-umbrella.h /Users/hanykaram/Desktop/MVP/Pods/Kingfisher/Sources/Kingfisher.h /Users/hanykaram/Desktop/MVP/DerivedData/MVP/Build/Intermediates.noindex/SwiftMigration/MVP/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Kingfisher.build/unextended-module.modulemap /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/objc/ObjectiveC.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/usr/include/Darwin.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/os.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Users/hanykaram/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
func void B_AssignSchiffswachenGuard(var C_Npc Schiffswache) { if((MIS_ShipIsFree == TRUE) || (MIS_SCvisitShip == LOG_Running)) { if(Schiffswache.voice == 4) { AI_Output(self,other,"DIA_Pal_Schiffswache_Ambient_04_00"); //Sledujeme tě. Nezapomínej na to. }; if(Schiffswache.voice == 9) { AI_Output(self,other,"DIA_Pal_Schiffswache_Ambient_09_01"); //Dokud jsi tady, nedělej žádné potíže. }; if(Schiffswache.voice == 12) { AI_Output(self,other,"DIA_Pal_Schiffswache_Ambient_12_02"); //Ani nepomysli na to, že bys tu mohl něco ukrást, rozumíš? }; AI_StopProcessInfos(Schiffswache); Npc_SetRefuseTalk(Schiffswache,60); Npc_SetRefuseTalk(Pal_220_Schiffswache,60); Npc_SetRefuseTalk(Pal_221_Schiffswache,60); Npc_SetRefuseTalk(Pal_222_Schiffswache,60); Npc_SetRefuseTalk(Pal_223_Schiffswache,60); Npc_SetRefuseTalk(Pal_224_Schiffswache,60); Npc_SetRefuseTalk(Pal_225_Schiffswache,60); Npc_SetRefuseTalk(Pal_226_Schiffswache,60); Npc_SetRefuseTalk(Pal_227_Schiffswache,60); Npc_SetRefuseTalk(Pal_228_Schiffswache,60); } else if(Wld_IsTime(7,0,9,30) || Wld_IsTime(18,0,20,30)) { B_Say(self,other,"$NOTNOW"); AI_StopProcessInfos(self); Npc_SetRefuseTalk(Schiffswache,20); Npc_SetRefuseTalk(Pal_220_Schiffswache,20); Npc_SetRefuseTalk(Pal_221_Schiffswache,20); Npc_SetRefuseTalk(Pal_222_Schiffswache,20); Npc_SetRefuseTalk(Pal_223_Schiffswache,20); Npc_SetRefuseTalk(Pal_224_Schiffswache,20); Npc_SetRefuseTalk(Pal_225_Schiffswache,20); Npc_SetRefuseTalk(Pal_226_Schiffswache,20); Npc_SetRefuseTalk(Pal_227_Schiffswache,20); Npc_SetRefuseTalk(Pal_228_Schiffswache,20); } else { B_Say(self,other,"$ALARM"); AI_StopProcessInfos(self); B_Attack(self,other,AR_GuardStopsIntruder,1); Npc_SetRefuseTalk(Schiffswache,20); Npc_SetRefuseTalk(Pal_220_Schiffswache,20); Npc_SetRefuseTalk(Pal_221_Schiffswache,20); Npc_SetRefuseTalk(Pal_222_Schiffswache,20); Npc_SetRefuseTalk(Pal_223_Schiffswache,20); Npc_SetRefuseTalk(Pal_224_Schiffswache,20); Npc_SetRefuseTalk(Pal_225_Schiffswache,20); Npc_SetRefuseTalk(Pal_226_Schiffswache,20); Npc_SetRefuseTalk(Pal_227_Schiffswache,20); Npc_SetRefuseTalk(Pal_228_Schiffswache,20); }; }; func void B_AssignSchiffswachenInfos(var C_Npc Schiffswache) { if(MIS_OCGateOpen == TRUE) { if(Schiffswache.voice == 4) { AI_Output(self,other,"DIA_Pal_Schiffswache_AmbientKap5_04_00"); //Ti zatracení skřeti zaútočili na Garondův hrad. Musíme jednat rychle. }; if(Schiffswache.voice == 9) { AI_Output(self,other,"DIA_Pal_Schiffswache_AmbientKap5_09_01"); //Jestli někdy dostaneme toho zrádce, co otevřel hlavní bránu do hradu, uděláme s ním krátký proces. }; if(Schiffswache.voice == 12) { AI_Output(self,other,"DIA_Pal_Schiffswache_AmbientKap5_12_02"); //Už nemůžeme déle čekat. Chlapi v Hornickém údolí potřebují naši pomoc dřív, než zaútočí další vlna skřetů. }; } else { if(Schiffswache.voice == 4) { AI_Output(self,other,"DIA_Pal_Schiffswache_AmbientKap5_04_03"); //Garond žádá úplnou mobilizaci. Do Hornického údolí se vydáme co nevidět. }; if(Schiffswache.voice == 9) { AI_Output(self,other,"DIA_Pal_Schiffswache_AmbientKap5_09_04"); //Skřeti musí dostat pořádnou lekci. }; if(Schiffswache.voice == 12) { AI_Output(self,other,"DIA_Pal_Schiffswache_AmbientKap5_12_05"); //Nemůžu se dočkat, až těm skřetům dáme co proto. Vyrazíme každou chvíli. }; }; AI_StopProcessInfos(Schiffswache); }; func void B_AssignSchiffswachenTalk(var C_Npc Schiffswache) { if(Kapitel >= 5) { B_AssignSchiffswachenInfos(Schiffswache); } else { B_AssignSchiffswachenGuard(Schiffswache); }; }; func int B_AssignSchiffswachenInfoConditions(var C_Npc Schiffswache) { if((Kapitel < 5) && (Npc_RefuseTalk(self) == FALSE) && (MIS_SCvisitShip != LOG_Running) && (Npc_IsInState(self,ZS_Stand_Plaz) == FALSE)) { return TRUE; } else if(Npc_IsInState(self,ZS_Talk) == TRUE) { return TRUE; }; return FALSE; };
D
var int EVT_ORKOBERST_OneTime; func void evt_orkoberst() { if(EVT_ORKOBERST_OneTime == FALSE) { OrkElite_AntiPaladinOrkOberst_DI.aivar[AIV_EnemyOverride] = FALSE; OrcElite_DIOberst1_Rest.aivar[AIV_EnemyOverride] = FALSE; OrcElite_DIOberst2_Rest.aivar[AIV_EnemyOverride] = FALSE; OrcElite_DIOberst3_Rest.aivar[AIV_EnemyOverride] = FALSE; Wld_InsertNpc(OrcWarrior_Roam,"SHIP_DECK_05"); Wld_InsertNpc(OrcWarrior_Roam,"SHIP_DECK_17"); Wld_InsertNpc(OrcWarrior_Roam,"DI_SHIP_04"); if(TorlofIsCaptain == TRUE) { Wld_InsertNpc(OrcWarrior_Roam,"DI_SHIP_04"); }; Wld_InsertNpc(OrcWarrior_Roam,"FP_ROAM_DI_ORK_02"); Wld_InsertNpc(OrcWarrior_Roam,"FP_ROAM_DI_ORK_03"); B_StartOtherRoutine(Biff_DI,"OrkSturmDI"); B_StartOtherRoutine(Jack_DI,"OrkSturmDI"); B_StartOtherRoutine(Torlof_DI,"OrkSturmDI"); B_StartOtherRoutine(Mario_DI,"OrkSturmDI"); if(Npc_IsDead(Mario_DI) == FALSE) { Wld_InsertNpc(Skeleton_Mario1,"FP_ROAM_DI_MARIOSSKELETONS_01"); Wld_InsertNpc(Skeleton_Mario2,"FP_ROAM_DI_MARIOSSKELETONS_02"); Wld_InsertNpc(Skeleton_Mario3,"FP_ROAM_DI_MARIOSSKELETONS_03"); Wld_InsertNpc(Skeleton_Mario4,"FP_ROAM_DI_MARIOSSKELETONS_04"); } else { Wld_InsertNpc(UndeadOrcWarrior,"FP_ROAM_DI_MARIOSSKELETONS_01"); Wld_InsertNpc(UndeadOrcWarrior,"FP_ROAM_DI_MARIOSSKELETONS_02"); Wld_InsertNpc(UndeadOrcWarrior,"FP_ROAM_DI_MARIOSSKELETONS_03"); Wld_InsertNpc(UndeadOrcWarrior,"FP_ROAM_DI_MARIOSSKELETONS_04"); }; ORkSturmDI = TRUE; B_LogEntry(TOPIC_HallenVonIrdorath,"Этот вождь орков - чертовски крепкий орешек. Он должен быть где-то в районе тронного зала."); EVT_ORKOBERST_OneTime = TRUE; }; };
D
module kreikey.util; import std.algorithm; import std.range; alias InfiniteIota = recurrence!((a, n) => a[n-1]+1, ulong); //alias asort = (a) {a.sort(); return a;}; T[] asort(alias less = (a, b) => a < b, T)(T[] source) { source.sort!less(); return source; } //alias asortDescending = (a) {a.sort!((b, c) => c < b)(); return a;}; template staticIota(size_t S, size_t E) { import std.range: iota; import std.meta: aliasSeqOf; alias staticIota = aliasSeqOf!(iota(S, E)); } unittest { size_t count = 0; foreach (i; staticIota!(1, 11) { mixin("++count;"); } assert(count == 10); }
D
// *************************************************** // B_TeachFightTalentPercent // ------------------------- // Kosten abhängig von "verwandtem" Waffentalent-Level // *************************************************** // ------------------------------- func int B_TeachFightTalentPercent (var C_NPC slf, var C_NPC oth, var int talent, var int percent, var int teacherMAX) { var string concatText; // ------ Kostenberechnung ------ var int kosten; kosten = (B_GetLearnCostTalent(oth, talent, 1) * percent); //EXIT IF... // ------ falscher Parameter ------ if (talent!=NPC_TALENT_1H) && (talent!=NPC_TALENT_2H) && (talent!=NPC_TALENT_BOW) && (talent!=NPC_TALENT_CROSSBOW) { Print ("*** ERROR: Wrong Parameter ***"); return FALSE; }; // ------ Lernen NICHT über teacherMax ------ var int realHitChance; if (talent == NPC_TALENT_1H) { realHitChance = oth.HitChance[NPC_TALENT_1H]; } // Umwandeln von const-Parameter in VAR für folgende If-Abfrage else if (talent == NPC_TALENT_2H) { realHitChance = oth.HitChance[NPC_TALENT_2H]; } else if (talent == NPC_TALENT_BOW) { realHitChance = oth.HitChance[NPC_TALENT_BOW]; } else if (talent == NPC_TALENT_CROSSBOW) { realHitChance = oth.HitChance[NPC_TALENT_CROSSBOW]; }; if (realHitChance >= teacherMAX) { concatText = ConcatStrings (PRINT_NoLearnOverPersonalMAX, IntToString(teacherMAX)); PrintScreen (concatText, -1, -1, FONT_SCREEN, 2); B_Say (slf, oth, "$NOLEARNYOUREBETTER"); return FALSE; }; if ((realHitChance + percent) > teacherMAX) { concatText = ConcatStrings (PRINT_NoLearnOverPersonalMAX, IntToString(teacherMAX)); PrintScreen (concatText, -1, -1, FONT_SCREEN, 2); B_Say (slf, oth, "$NOLEARNOVERPERSONALMAX"); return FALSE; }; // ------ Player hat zu wenig Lernpunkte ------ if (oth.lp < kosten) { PrintScreen (PRINT_NotEnoughLP, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOLEARNNOPOINTS"); return FALSE; }; if (talent == NPC_TALENT_1H) && (oth.attribute[ATR_STRENGTH] < (2*(realHitChance + percent))/3) { PrintScreen (PRINT_NotEnoughStr, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOTENOUGHSTR"); return FALSE; }; if (talent == NPC_TALENT_2H) && (oth.attribute[ATR_STRENGTH] < realHitChance + percent) { PrintScreen (PRINT_NotEnoughStr, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOTENOUGHSTR"); return FALSE; }; if (talent == NPC_TALENT_1H) && (oth.attribute[ATR_DEXTERITY] < (realHitChance + percent)/2) { PrintScreen (PRINT_NotEnoughDex, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOTENOUGHDEX"); return FALSE; }; if (talent == NPC_TALENT_2H) && (oth.attribute[ATR_DEXTERITY] < (realHitChance + percent)/3) { PrintScreen (PRINT_NotEnoughDex, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOTENOUGHDEX"); return FALSE; }; if (talent == NPC_TALENT_BOW) && (oth.attribute[ATR_STRENGTH] < (realHitChance + percent)/3) { PrintScreen (PRINT_NotEnoughStr, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOTENOUGHSTR"); return FALSE; }; if (talent == NPC_TALENT_CROSSBOW) && (oth.attribute[ATR_STRENGTH] < (realHitChance + percent)/2) { PrintScreen (PRINT_NotEnoughStr, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOTENOUGHSTR"); return FALSE; }; if (talent == NPC_TALENT_BOW) && (oth.attribute[ATR_DEXTERITY] < realHitChance + percent) { PrintScreen (PRINT_NotEnoughDex, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOTENOUGHDEX"); return FALSE; }; if (talent == NPC_TALENT_CROSSBOW) && (oth.attribute[ATR_DEXTERITY] < (2*(realHitChance + percent))/3) { PrintScreen (PRINT_NotEnoughDex, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOTENOUGHDEX"); return FALSE; }; // FUNC // ------ Lernpunkte abziehen ------ oth.lp = oth.lp - kosten; // ------ 1H steigern ------ if (talent == NPC_TALENT_1H) { B_RaiseFightTalent (oth, NPC_TALENT_1H, percent); //Einhand steigern if (ZweihandAlsEinhand_Perk == TRUE) { if (hero.HitChance[NPC_TALENT_1H] >= 60) { Mdl_ApplyOverlayMds (oth, "HUMANS_1H2HST2.MDS"); } else if (hero.HitChance[NPC_TALENT_1H] >= 30) { Mdl_ApplyOverlayMds (oth, "HUMANS_1H2HST1.MDS"); }; }; PrintScreen (PRINT_Learn1H, -1, -1, FONT_Screen, 2); return TRUE; }; // ------ 2H steigern ------ if (talent == NPC_TALENT_2H) { B_RaiseFightTalent (oth, NPC_TALENT_2H, percent); //Zweihand steigern if (ZweihandAlsEinhand_Perk == TRUE) { Mdl_RemoveOverlayMds (oth, "HUMANS_2HST1.MDS"); Mdl_RemoveOverlayMds (oth, "HUMANS_2HST2.MDS"); }; PrintScreen (PRINT_Learn2H, -1, -1, FONT_Screen, 2); return TRUE; }; // ------ Bogen steigern ------ if (talent == NPC_TALENT_BOW) { B_RaiseFightTalent (oth, NPC_TALENT_BOW, percent); //Bogen steigern PrintScreen (PRINT_LearnBow, -1, -1, FONT_Screen, 2); return TRUE; }; // ------ Crossbow steigern ------ if (talent == NPC_TALENT_CROSSBOW) { B_RaiseFightTalent (oth, NPC_TALENT_CROSSBOW, percent); //Crossbow steigern PrintScreen (PRINT_LearnCrossbow, -1, -1, FONT_Screen, 2); return TRUE; }; }; func int B_TeachFightTalentPercent_New (var C_NPC slf, var C_NPC oth, var int talent, var int percent, var int teacherMAX) { var string concatText; // ------ Kostenberechnung ------ var int kosten; kosten = (B_GetLearnCostTalent_New(oth, talent)); //EXIT IF... // ------ falscher Parameter ------ if (talent!=NPC_TALENT_1H) && (talent!=NPC_TALENT_2H) && (talent!=NPC_TALENT_BOW) && (talent!=NPC_TALENT_CROSSBOW) { Print ("*** ERROR: Wrong Parameter ***"); return FALSE; }; // ------ Lernen NICHT über teacherMax ------ var int realHitChance; if (talent == NPC_TALENT_1H) { realHitChance = oth.HitChance[NPC_TALENT_1H]; } // Umwandeln von const-Parameter in VAR für folgende If-Abfrage else if (talent == NPC_TALENT_2H) { realHitChance = oth.HitChance[NPC_TALENT_2H]; } else if (talent == NPC_TALENT_BOW) { realHitChance = oth.HitChance[NPC_TALENT_BOW]; } else if (talent == NPC_TALENT_CROSSBOW) { realHitChance = oth.HitChance[NPC_TALENT_CROSSBOW]; }; if (realHitChance >= teacherMAX) { concatText = ConcatStrings (PRINT_NoLearnOverPersonalMAX, IntToString(teacherMAX)); PrintScreen (concatText, -1, -1, FONT_SCREEN, 2); B_Say (slf, oth, "$NOLEARNYOUREBETTER"); return FALSE; }; if ((realHitChance + percent) > teacherMAX) { concatText = ConcatStrings (PRINT_NoLearnOverPersonalMAX, IntToString(teacherMAX)); PrintScreen (concatText, -1, -1, FONT_SCREEN, 2); B_Say (slf, oth, "$NOLEARNOVERPERSONALMAX"); return FALSE; }; // ------ Player hat zu wenig Lernpunkte ------ if (oth.lp < kosten) { PrintScreen (PRINT_NotEnoughLP, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOLEARNNOPOINTS"); return FALSE; }; if (talent == NPC_TALENT_1H) && (oth.attribute[ATR_STRENGTH] < (2*(realHitChance + percent))/3) { PrintScreen (PRINT_NotEnoughStr, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOTENOUGHSTR"); return FALSE; }; if (talent == NPC_TALENT_2H) && (oth.attribute[ATR_STRENGTH] < realHitChance + percent) { PrintScreen (PRINT_NotEnoughStr, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOTENOUGHSTR"); return FALSE; }; if (talent == NPC_TALENT_1H) && (oth.attribute[ATR_DEXTERITY] < (realHitChance + percent)/2) { PrintScreen (PRINT_NotEnoughDex, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOTENOUGHDEX"); return FALSE; }; if (talent == NPC_TALENT_2H) && (oth.attribute[ATR_DEXTERITY] < (realHitChance + percent)/3) { PrintScreen (PRINT_NotEnoughDex, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOTENOUGHDEX"); return FALSE; }; if (talent == NPC_TALENT_BOW) && (oth.attribute[ATR_STRENGTH] < (realHitChance + percent)/3) { PrintScreen (PRINT_NotEnoughStr, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOTENOUGHSTR"); return FALSE; }; if (talent == NPC_TALENT_CROSSBOW) && (oth.attribute[ATR_STRENGTH] < (realHitChance + percent)/2) { PrintScreen (PRINT_NotEnoughStr, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOTENOUGHSTR"); return FALSE; }; if (talent == NPC_TALENT_BOW) && (oth.attribute[ATR_DEXTERITY] < realHitChance + percent) { PrintScreen (PRINT_NotEnoughDex, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOTENOUGHDEX"); return FALSE; }; if (talent == NPC_TALENT_CROSSBOW) && (oth.attribute[ATR_DEXTERITY] < (2*(realHitChance + percent))/3) { PrintScreen (PRINT_NotEnoughDex, -1, -1, FONT_Screen, 2); B_Say (slf, oth, "$NOTENOUGHDEX"); return FALSE; }; // FUNC // ------ Lernpunkte abziehen ------ oth.lp = oth.lp - kosten; // ------ 1H steigern ------ if (talent == NPC_TALENT_1H) { B_RaiseFightTalent (oth, NPC_TALENT_1H, percent); //Einhand steigern PrintScreen (PRINT_Learn1H, -1, -1, FONT_Screen, 2); return TRUE; }; // ------ 2H steigern ------ if (talent == NPC_TALENT_2H) { B_RaiseFightTalent (oth, NPC_TALENT_2H, percent); //Zweihand steigern PrintScreen (PRINT_Learn2H, -1, -1, FONT_Screen, 2); return TRUE; }; // ------ Bogen steigern ------ if (talent == NPC_TALENT_BOW) { B_RaiseFightTalent (oth, NPC_TALENT_BOW, percent); //Bogen steigern PrintScreen (PRINT_LearnBow, -1, -1, FONT_Screen, 2); return TRUE; }; // ------ Crossbow steigern ------ if (talent == NPC_TALENT_CROSSBOW) { B_RaiseFightTalent (oth, NPC_TALENT_CROSSBOW, percent); //Crossbow steigern PrintScreen (PRINT_LearnCrossbow, -1, -1, FONT_Screen, 2); return TRUE; }; };
D
/Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Build/Intermediates/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/SessionManager.o : /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/MultipartFormData.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Timeline.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Alamofire.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Response.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/TaskDelegate.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/SessionDelegate.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/ParameterEncoding.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Validation.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/ResponseSerialization.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/SessionManager.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/AFError.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Notifications.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Result.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Request.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/ServerTrustPolicy.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Build/Intermediates/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Build/Intermediates/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/SessionManager~partial.swiftmodule : /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/MultipartFormData.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Timeline.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Alamofire.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Response.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/TaskDelegate.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/SessionDelegate.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/ParameterEncoding.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Validation.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/ResponseSerialization.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/SessionManager.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/AFError.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Notifications.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Result.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Request.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/ServerTrustPolicy.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Build/Intermediates/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Build/Intermediates/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/SessionManager~partial.swiftdoc : /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/MultipartFormData.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Timeline.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Alamofire.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Response.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/TaskDelegate.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/SessionDelegate.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/ParameterEncoding.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Validation.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/ResponseSerialization.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/SessionManager.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/AFError.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Notifications.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Result.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/Request.swift /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Alamofire/Source/ServerTrustPolicy.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/Thomas_Stuart/Desktop/CodePathBootcamp/Parstagram/Build/Intermediates/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
import std.stdio; import mrss; import std.string; import std.range; import std.array; import std.conv; string ZtoString(const char* c) { if (c !is null) return to!string(fromStringz(c)); else return null; } char* toZString(string s) { char[] ret=cast(char[])s; if (ret[$-1]!='\0') ret~="\0"; return ret.ptr; } int main (string[] args) { mrss_t *data; mrss_error_t ret; mrss_hour_t *hour; mrss_day_t *day; mrss_category_t *category; mrss_item_t *item; CURLcode code; if (args.length != 2) { stderr.writefln("Usage:\n\t%s url_rss\n\nExample:\n\t%s http://ngvision.org/rss|file.rss\n\n",args[0],args[0]); return 1; } auto url=args[1]; if ((url[0..8]!="http://") &&(url[0..9]!="https://")) ret = mrss_parse_url_with_options_and_error(toZString(url), &data, null, &code); else ret = mrss_parse_file (toZString(url), &data); if (ret) { stderr.writefln("MRSS return error: %s", ret == mrss_error_t.MRSS_ERR_DOWNLOAD ? ZtoString(mrss_curl_strerror (code) ): ZtoString(mrss_strerror (ret))); return 1; } writefln("\nGeneric:"); writefln("\tfile: %s", data.file); writefln("\tencoding: %s", data.encoding); writefln("\tsize: %s", data.size); writef("\tversion:"); switch (data._version) { case mrss_version_t.MRSS_VERSION_0_91: writef(" 0.91\n"); break; case mrss_version_t.MRSS_VERSION_0_92: writef(" 0.92\n"); break; case mrss_version_t.MRSS_VERSION_1_0: writef(" 1.0\n"); break; case mrss_version_t.MRSS_VERSION_2_0: writef(" 2.0\n"); break; case mrss_version_t.MRSS_VERSION_ATOM_1_0: writef(" Atom 1.0\n"); break; case mrss_version_t.MRSS_VERSION_ATOM_0_3: writef(" Atom 0.3\n"); break; default: assert(0); break; } writef("\nChannel:\n"); writef("\ttitle: %s\n", data.title); writef("\tdescription: %s\n", data.description); writef("\tlink: %s\n", data.link); writef("\tlanguage: %s\n", data.language); writef("\trating: %s\n", data.rating); writef("\tcopyright: %s\n", data.copyright); writef("\tpubDate: %s\n", data.pubDate); writef("\tlastBuildDate: %s\n", data.lastBuildDate); writef("\tdocs: %s\n", data.docs); writef("\tmanagingeditor: %s\n", data.managingeditor); writef("\twebMaster: %s\n", data.webMaster); writef("\tgenerator: %s\n", data.generator); writef("\tttl: %d\n", data.ttl); writef("\tabout: %s\n", data.about); writef("\nImage:\n"); writef("\timage_title: %s\n", data.image_title); writef("\timage_url: %s\n", data.image_url); writef("\timage_link: %s\n", data.image_link); writef("\timage_width: %d\n", data.image_width); writef("\timage_height: %d\n", data.image_height); writef("\timage_description: %s\n", data.image_description); writef("\nTextInput:\n"); writef("\ttextinput_title: %s\n", data.textinput_title); writef("\ttextinput_description: %s\n", data.textinput_description); writef("\ttextinput_name: %s\n", data.textinput_name); writef("\ttextinput_link: %s\n", data.textinput_link); writef("\nCloud:\n"); writef("\tcloud: %s\n", data.cloud); writef("\tcloud_domain: %s\n", data.cloud_domain); writef("\tcloud_port: %d\n", data.cloud_port); writef("\tcloud_registerProcedure: %s\n", data.cloud_registerProcedure); writef("\tcloud_protocol: %s\n", data.cloud_protocol); writef("\nSkipHours:\n"); hour = data.skipHours; while (hour) { writef("\t%s\n", hour.hour); hour = hour.next; } writef("\nSkipDays:\n"); day = data.skipDays; while (day) { writef("\t%s\n", day.day); day = day.next; } writef("\nCategory:\n"); category = data.category; while (category) { writef("\tcategory: %s\n", category.category); writef("\tcategory_domain: %s\n", category.domain); category = category.next; } if (data.other_tags) print_tags (data.other_tags, 0); writef("\nItems:\n"); item = data.item; while (item) { writef("\ttitle: %s\n", ZtoString(item.title)); writef("\tlink: %s\n", ZtoString(item.link)); writef("\tdescription: %s\n", ZtoString(item.description)); writef("\tauthor: %s\n", ZtoString(item.author)); writef("\tcomments: %s\n", ZtoString(item.comments)); writef("\tpubDate: %s\n", ZtoString(item.pubDate)); writef("\tguid: %s\n", ZtoString(item.guid)); writef("\tguid_isPermaLink: %s\n", item.guid_isPermaLink); writef("\tsource: %s\n", ZtoString(item.source)); writef("\tsource_url: %s\n", ZtoString(item.source_url)); writef("\tenclosure: %s\n", ZtoString(item.enclosure)); writef("\tenclosure_url: %s\n", ZtoString(item.enclosure_url)); writef("\tenclosure_length: %s\n", item.enclosure_length); writef("\tenclosure_type: %s\n", ZtoString(item.enclosure_type)); writef("\tCategory:\n"); category = item.category; while (category) { writef("\t\tcategory: %s\n", category.category); writef("\t\tcategory_domain: %s\n", category.domain); category = category.next; } if (item.other_tags) print_tags (item.other_tags, 1); writef("\n"); item = item.next; } mrss_free (data); return 0; } string repeatchar(char c,int i) { return to!string(c.repeat(i)); } void print_tags (mrss_tag_t * tag, int index) { mrss_attribute_t *attribute; int i; writef('\t'.repeatchar(index)); writef("Other Tags:\n"); while (tag) { writef('\t'.repeatchar(index)); writef("\ttag name: %s\n", ZtoString(tag.name)); writef('\t'.repeatchar(index)); writef("\ttag value: %s\n", ZtoString(tag.value)); writef('\t'.repeatchar(index)); writef("\ttag ns: %s\n", ZtoString(tag.ns)); if (tag.children) print_tags(tag.children, index + 1); for(attribute = tag.attributes; attribute; attribute = attribute.next) { writef('\t'.repeatchar(index)); writef("\tattribute name: %s\n", ZtoString(attribute.name)); writef('\t'.repeatchar(index)); writef("\tattribute value: %s\n", ZtoString(attribute.value)); writef('\t'.repeatchar(index)); writef("\tattribute ns: %s\n", ZtoString(attribute.ns)); } tag = tag.next; } }
D
module directx.d3dx11async; ////////////////////////////////////////////////////////////////////////////// // // Copyright (c) Microsoft Corporation. All rights reserved. // // File: D3DX11Async.h // Content: D3DX11 Asynchronous Shader loaders / compilers // ////////////////////////////////////////////////////////////////////////////// version(Windows): import directx.d3d11; import directx.d3dcommon; import directx.win32; import directx.d3dx11core; import directx.d3dcommon; import directx.d3dx11tex; // declared in d3d10shader.h alias LPD3DINCLUDE LPD3D10INCLUDE; alias D3D_SHADER_MACRO D3D10_SHADER_MACRO; extern (Windows) { //---------------------------------------------------------------------------- // D3DX11Compile: // ------------------ // Compiles an effect or shader. // // Parameters: // pSrcFile // Source file name. // hSrcModule // Module handle. if NULL, current module will be used. // pSrcResource // Resource name in module. // pSrcData // Pointer to source code. // SrcDataLen // Size of source code, in bytes. // pDefines // Optional NULL-terminated array of preprocessor macro definitions. // pInclude // Optional interface pointer to use for handling #include directives. // If this parameter is NULL, #includes will be honored when compiling // from file, and will error when compiling from resource or memory. // pFunctionName // Name of the entrypoint function where execution should begin. // pProfile // Instruction set to be used when generating code. Currently supported // profiles are "vs_1_1", "vs_2_0", "vs_2_a", "vs_2_sw", "vs_3_0", // "vs_3_sw", "vs_4_0", "vs_4_1", // "ps_2_0", "ps_2_a", "ps_2_b", "ps_2_sw", "ps_3_0", // "ps_3_sw", "ps_4_0", "ps_4_1", // "gs_4_0", "gs_4_1", // "tx_1_0", // "fx_4_0", "fx_4_1" // Note that this entrypoint does not compile fx_2_0 targets, for that // you need to use the D3DX9 function. // Flags1 // See D3D10_SHADER_xxx flags. // Flags2 // See D3D10_EFFECT_xxx flags. // ppShader // Returns a buffer containing the created shader. This buffer contains // the compiled shader code, as well as any embedded debug and symbol // table info. (See D3D10GetShaderConstantTable) // ppErrorMsgs // Returns a buffer containing a listing of errors and warnings that were // encountered during the compile. If you are running in a debugger, // these are the same messages you will see in your debug output. // pHResult // Pointer to a memory location to receive the return value upon completion. // Maybe NULL if not needed. // If pPump != NULL, pHResult must be a valid memory location until the // the asynchronous execution completes. //---------------------------------------------------------------------------- HRESULT D3DX11CompileFromFileA(LPCSTR pSrcFile, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump pPump, ID3D10Blob* ppShader, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult); HRESULT D3DX11CompileFromFileW(LPCWSTR pSrcFile, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump pPump, ID3D10Blob* ppShader, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult); // TODO: make sure this matches phobos win32 style alias D3DX11CompileFromFileW D3DX11CompileFromFile; HRESULT D3DX11CompileFromResourceA(HMODULE hSrcModule, LPCSTR pSrcResource, LPCSTR pSrcFileName, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump pPump, ID3D10Blob* ppShader, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult); HRESULT D3DX11CompileFromResourceW(HMODULE hSrcModule, LPCWSTR pSrcResource, LPCWSTR pSrcFileName, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump pPump, ID3D10Blob* ppShader, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult); alias D3DX11CompileFromResourceW D3DX11CompileFromResource; HRESULT D3DX11CompileFromMemory(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump pPump, ID3D10Blob* ppShader, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult); HRESULT D3DX11PreprocessShaderFromFileA(LPCSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, ID3DX11ThreadPump pPump, ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult); HRESULT D3DX11PreprocessShaderFromFileW(LPCWSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, ID3DX11ThreadPump pPump, ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult); HRESULT D3DX11PreprocessShaderFromMemory(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, ID3DX11ThreadPump pPump, ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult); HRESULT D3DX11PreprocessShaderFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, ID3DX11ThreadPump pPump, ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult); HRESULT D3DX11PreprocessShaderFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, ID3DX11ThreadPump pPump, ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorMsgs, HRESULT* pHResult); alias D3DX11PreprocessShaderFromFileW D3DX11PreprocessShaderFromFile; alias D3DX11PreprocessShaderFromResourceW D3DX11PreprocessShaderFromResource; //---------------------------------------------------------------------------- // Async processors //---------------------------------------------------------------------------- HRESULT D3DX11CreateAsyncCompilerProcessor(LPCSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3D10Blob* ppCompiledShader, ID3D10Blob* ppErrorBuffer, ID3DX11DataProcessor* ppProcessor); HRESULT D3DX11CreateAsyncShaderPreprocessProcessor(LPCSTR pFileName, const(D3D10_SHADER_MACRO)* pDefines, LPD3D10INCLUDE pInclude, ID3D10Blob* ppShaderText, ID3D10Blob* ppErrorBuffer, ID3DX11DataProcessor* ppProcessor); //---------------------------------------------------------------------------- // D3DX11 Asynchronous texture I/O (advanced mode) //---------------------------------------------------------------------------- HRESULT D3DX11CreateAsyncFileLoaderW(LPCWSTR pFileName, ID3DX11DataLoader* ppDataLoader); HRESULT D3DX11CreateAsyncFileLoaderA(LPCSTR pFileName, ID3DX11DataLoader* ppDataLoader); HRESULT D3DX11CreateAsyncMemoryLoader(LPCVOID pData, SIZE_T cbData, ID3DX11DataLoader* ppDataLoader); HRESULT D3DX11CreateAsyncResourceLoaderW(HMODULE hSrcModule, LPCWSTR pSrcResource, ID3DX11DataLoader* ppDataLoader); HRESULT D3DX11CreateAsyncResourceLoaderA(HMODULE hSrcModule, LPCSTR pSrcResource, ID3DX11DataLoader* ppDataLoader); alias D3DX11CreateAsyncFileLoaderW D3DX11CreateAsyncFileLoader; alias D3DX11CreateAsyncResourceLoaderW D3DX11CreateAsyncResourceLoader; HRESULT D3DX11CreateAsyncTextureProcessor(ID3D11Device pDevice, D3DX11_IMAGE_LOAD_INFO* pLoadInfo, ID3DX11DataProcessor* ppDataProcessor); HRESULT D3DX11CreateAsyncTextureInfoProcessor(D3DX11_IMAGE_INFO* pImageInfo, ID3DX11DataProcessor* ppDataProcessor); HRESULT D3DX11CreateAsyncShaderResourceViewProcessor(ID3D11Device pDevice, D3DX11_IMAGE_LOAD_INFO* pLoadInfo, ID3DX11DataProcessor* ppDataProcessor); }
D
instance MENU_OPT_GAME(C_MENU_DEF) { items[0] = "MENUITEM_GAME_LEGENDSAVE"; items[1] = "MENUITEM_GAME_LEGENDSAVE_CHOICE"; items[2] = "MENUITEM_GAME_KARMASTATUS"; items[3] = "MENUITEM_GAME_KARMASTATUS_CHOICE"; items[4] = "MENUITEM_GAME_HTFSTATUS"; items[5] = "MENUITEM_GAME_HTFSTATUS_CHOICE"; items[6] = "MENUITEM_GAME_WATCHTIME"; items[7] = "MENUITEM_GAME_WATCHTIME_CHOICE"; items[8] = "MENUITEM_GAME_ALTHAIR"; items[9] = "MENUITEM_GAME_ALTHAIR_CHOICE"; items[10] = "MENUITEM_GAME_STEAL"; items[11] = "MENUITEM_GAME_STEAL_CHOICE"; items[12] = "MENUITEM_GAME_INVERSE"; items[13] = "MENUITEM_GAME_INVERSE_CHOICE"; items[14] = "MENUITEM_GAME_SUB_TITLES"; items[15] = "MENUITEM_GAME_SUB_TITLES_CHOICE"; items[16] = "MENUITEM_GAME_FIGHTFOCUS"; items[17] = "MENUITEM_GAME_FIGHTFOCUS_CHOICE"; items[18] = "MENUITEM_GAME_INTERACTFOCUS"; items[19] = "MENUITEM_GAME_INTERACTFOCUS_CHOICE"; items[20] = "MENUITEM_GAME_MUSCLE"; items[21] = "MENUITEM_GAME_MUSCLE_CHOICE"; items[22] = "MENUITEM_M"; items[23] = "MENUITEM_M_CHOICE"; items[24] = "MENUITEM_MSENSITIVITY"; items[25] = "MENUITEM_MSENSITIVITY_SLIDER"; items[26] = "MENUITEM_GAME_OLDCONTROLS"; items[27] = "MENUITEM_GAME_OLDCONTROLS_CHOICE"; items[28] = "MENUITEM_GAME_AUTOAIM"; items[29] = "MENUITEM_GAME_AUTOAIM_CHOICE"; items[30] = "MENUITEM_GAME_BACK"; flags = flags | MENU_SHOW_INFO | MENU_DONTSCALE_DIM; }; instance MENUITEM_GAME_LEGENDSAVE(C_MENU_ITEM_DEF) { backPic = MENU_ITEM_BACK_PIC; text[0] = "Ukládání hry"; text[1] = "Zapnout možnost ukládání hry na legendární obtížnosti"; posx = 0; posy = MENU_START_Y - (MENU_SOUND_DY * 8); dimx = 7000; dimy = 750; onselaction[0] = SEL_ACTION_UNDEF; flags = flags | IT_EFFECTS_NEXT; }; instance MENUITEM_GAME_LEGENDSAVE_CHOICE(C_MENU_ITEM_DEF) { backPic = MENU_CHOICE_BACK_PIC; type = MENU_ITEM_CHOICEBOX; text[0] = "Ne|Ano"; fontname = MENU_FONT_SMALL; posx = 8000; posy = (MENU_START_Y - (MENU_SOUND_DY * 8)) + MENU_CHOICE_YPLUS; dimx = MENU_SLIDER_DX; dimy = MENU_CHOICE_DY; onchgsetoption = "bCanSaveLeg"; onchgsetoptionsection = "AST"; flags = flags & ~IT_SELECTABLE; flags = flags | IT_TXT_CENTER; }; instance MENUITEM_GAME_KARMASTATUS(C_MENU_ITEM_DEF) { backPic = MENU_ITEM_BACK_PIC; text[0] = "Ukazatele karmy"; text[1] = "Zapnout ukazatele stavu karmy na obrazovce"; posx = 0; posy = MENU_START_Y - (MENU_SOUND_DY * 7); dimx = 7000; dimy = 750; onselaction[0] = SEL_ACTION_UNDEF; flags = flags | IT_EFFECTS_NEXT; }; instance MENUITEM_GAME_KARMASTATUS_CHOICE(C_MENU_ITEM_DEF) { backPic = MENU_CHOICE_BACK_PIC; type = MENU_ITEM_CHOICEBOX; text[0] = "Ne|Ano"; fontname = MENU_FONT_SMALL; posx = 8000; posy = (MENU_START_Y - (MENU_SOUND_DY * 7)) + MENU_CHOICE_YPLUS; dimx = MENU_SLIDER_DX; dimy = MENU_CHOICE_DY; onchgsetoption = "bShowKarma"; onchgsetoptionsection = "AST"; flags = flags & ~IT_SELECTABLE; flags = flags | IT_TXT_CENTER; }; instance MENUITEM_GAME_HTFSTATUS(C_MENU_ITEM_DEF) { backPic = MENU_ITEM_BACK_PIC; text[0] = "Ukazatele hladu / žízně / únavy"; text[1] = "Zapnout ukazatele hladu, žízně a únavy na obrazovce"; posx = 0; posy = MENU_START_Y - (MENU_SOUND_DY * 6); dimx = 7000; dimy = 750; onselaction[0] = SEL_ACTION_UNDEF; flags = flags | IT_EFFECTS_NEXT; }; instance MENUITEM_GAME_HTFSTATUS_CHOICE(C_MENU_ITEM_DEF) { backPic = MENU_CHOICE_BACK_PIC; type = MENU_ITEM_CHOICEBOX; text[0] = "Ne|Ano"; fontname = MENU_FONT_SMALL; posx = 8000; posy = (MENU_START_Y - (MENU_SOUND_DY * 6)) + MENU_CHOICE_YPLUS; dimx = MENU_SLIDER_DX; dimy = MENU_CHOICE_DY; onchgsetoption = "bHFTStatus"; onchgsetoptionsection = "AST"; flags = flags & ~IT_SELECTABLE; flags = flags | IT_TXT_CENTER; }; instance MENUITEM_GAME_WATCHTIME(C_MENU_ITEM_DEF) { backPic = MENU_ITEM_BACK_PIC; text[0] = "Zobrazení dne a času"; text[1] = "Zapnout zobrazení dne a času ve hře"; posx = 0; posy = MENU_START_Y - (MENU_SOUND_DY * 5); dimx = 7000; dimy = 750; onselaction[0] = SEL_ACTION_UNDEF; flags = flags | IT_EFFECTS_NEXT; }; instance MENUITEM_GAME_WATCHTIME_CHOICE(C_MENU_ITEM_DEF) { backPic = MENU_CHOICE_BACK_PIC; type = MENU_ITEM_CHOICEBOX; text[0] = "Ne|Ano"; fontname = MENU_FONT_SMALL; posx = 8000; posy = (MENU_START_Y - (MENU_SOUND_DY * 5)) + MENU_CHOICE_YPLUS; dimx = MENU_SLIDER_DX; dimy = MENU_CHOICE_DY; onchgsetoption = "bWatchTime"; onchgsetoptionsection = "AST"; flags = flags & ~IT_SELECTABLE; flags = flags | IT_TXT_CENTER; }; instance MENUITEM_GAME_ALTHAIR(C_MENU_ITEM_DEF) { backPic = MENU_ITEM_BACK_PIC; text[0] = "Zobrazení atributů hrdiny"; text[1] = "Zapnout zobrazení hlavních atributů na obrazovce"; posx = 0; posy = MENU_START_Y - (MENU_SOUND_DY * 4); dimx = 7000; dimy = 750; onselaction[0] = SEL_ACTION_UNDEF; flags = flags | IT_EFFECTS_NEXT; }; instance MENUITEM_GAME_ALTHAIR_CHOICE(C_MENU_ITEM_DEF) { backPic = MENU_CHOICE_BACK_PIC; type = MENU_ITEM_CHOICEBOX; text[0] = "Ne|Ano"; fontname = MENU_FONT_SMALL; posx = 8000; posy = (MENU_START_Y - (MENU_SOUND_DY * 4)) + MENU_CHOICE_YPLUS; dimx = MENU_SLIDER_DX; dimy = MENU_CHOICE_DY; onchgsetoption = "bShowHMS"; onchgsetoptionsection = "AST"; flags = flags & ~IT_SELECTABLE; flags = flags | IT_TXT_CENTER; }; instance MENUITEM_GAME_STEAL(C_MENU_ITEM_DEF) { backPic = MENU_ITEM_BACK_PIC; text[0] = "AST kapsářství"; text[1] = "Zapnout nový styl krádeží ve hře"; posx = 0; posy = MENU_START_Y - (MENU_SOUND_DY * 3); dimx = 7000; dimy = 750; onselaction[0] = SEL_ACTION_UNDEF; flags = flags | IT_EFFECTS_NEXT; }; instance MENUITEM_GAME_STEAL_CHOICE(C_MENU_ITEM_DEF) { backPic = MENU_CHOICE_BACK_PIC; type = MENU_ITEM_CHOICEBOX; text[0] = "Ne|Ano"; fontname = MENU_FONT_SMALL; posx = 8000; posy = (MENU_START_Y - (MENU_SOUND_DY * 3)) + MENU_CHOICE_YPLUS; dimx = MENU_SLIDER_DX; dimy = MENU_CHOICE_DY; onchgsetoption = "bCanNewSteal"; onchgsetoptionsection = "AST"; flags = flags & ~IT_SELECTABLE; flags = flags | IT_TXT_CENTER; }; instance MENUITEM_GAME_INVERSE(C_MENU_ITEM_DEF) { backPic = MENU_ITEM_BACK_PIC; text[0] = "Převrátit ovládání"; text[1] = "Zapnout inverzi ovládání ve hře"; posx = 0; posy = MENU_START_Y - (MENU_SOUND_DY * 2); dimx = 7000; dimy = 750; onselaction[0] = SEL_ACTION_UNDEF; flags = flags | IT_EFFECTS_NEXT; }; instance MENUITEM_GAME_INVERSE_CHOICE(C_MENU_ITEM_DEF) { backPic = MENU_CHOICE_BACK_PIC; type = MENU_ITEM_CHOICEBOX; text[0] = "Ne|Ano"; fontname = MENU_FONT_SMALL; posx = 8000; posy = (MENU_START_Y - (MENU_SOUND_DY * 2)) + MENU_CHOICE_YPLUS; dimx = MENU_SLIDER_DX; dimy = MENU_CHOICE_DY; onchgsetoption = "camLookaroundInverse"; onchgsetoptionsection = "GAME"; flags = flags & ~IT_SELECTABLE; flags = flags | IT_TXT_CENTER; }; instance MENUITEM_GAME_SUB_TITLES(C_MENU_ITEM_DEF) { backPic = MENU_ITEM_BACK_PIC; text[0] = "Titulky"; text[1] = "Zapnout zobrazování titulků ve hře"; posx = 0; posy = MENU_START_Y - (MENU_SOUND_DY * 1); dimx = 7000; dimy = 750; onselaction[0] = SEL_ACTION_UNDEF; flags = flags | IT_EFFECTS_NEXT; }; instance MENUITEM_GAME_SUB_TITLES_CHOICE(C_MENU_ITEM_DEF) { backPic = MENU_CHOICE_BACK_PIC; type = MENU_ITEM_CHOICEBOX; text[0] = "Ne|Ano"; fontname = MENU_FONT_SMALL; posx = 8000; posy = (MENU_START_Y - (MENU_SOUND_DY * 1)) + MENU_CHOICE_YPLUS; dimx = MENU_SLIDER_DX; dimy = MENU_CHOICE_DY; onchgsetoption = "subTitles"; onchgsetoptionsection = "GAME"; flags = flags & ~IT_SELECTABLE; flags = flags | IT_TXT_CENTER; }; instance MENUITEM_GAME_FIGHTFOCUS(C_MENU_ITEM_DEF) { backPic = MENU_ITEM_BACK_PIC; text[0] = "Zaměření boje"; text[1] = "Typ zvýraznění stávajícího cíle"; posx = 0; posy = MENU_START_Y + (MENU_SOUND_DY * 0); dimx = 7000; dimy = 750; onselaction[0] = SEL_ACTION_UNDEF; flags = flags | IT_EFFECTS_NEXT; }; instance MENUITEM_GAME_FIGHTFOCUS_CHOICE(C_MENU_ITEM_DEF) { backPic = MENU_CHOICE_BACK_PIC; type = MENU_ITEM_CHOICEBOX; text[0] = "Žádné|Okno|Zjasnění|Obojí"; fontname = MENU_FONT_SMALL; posx = 8000; posy = MENU_START_Y + (MENU_SOUND_DY * 0) + MENU_CHOICE_YPLUS; dimx = 2000; dimy = MENU_CHOICE_DY; onchgsetoption = "highlightMeleeFocus"; onchgsetoptionsection = "GAME"; flags = flags & ~IT_SELECTABLE; flags = flags | IT_TXT_CENTER; }; instance MENUITEM_GAME_INTERACTFOCUS(C_MENU_ITEM_DEF) { backPic = MENU_ITEM_BACK_PIC; text[0] = "Počet sloupců inventáře"; text[1] = "Počet sloupců zobrazených v herním inventáři"; posx = 0; posy = MENU_START_Y + (MENU_SOUND_DY * 1); dimx = 7000; dimy = 750; onselaction[0] = SEL_ACTION_UNDEF; flags = flags | IT_EFFECTS_NEXT; }; instance MENUITEM_GAME_INTERACTFOCUS_CHOICE(C_MENU_ITEM_DEF) { backPic = MENU_CHOICE_BACK_PIC; type = MENU_ITEM_CHOICEBOX; text[0] = "0|1|2|3|4|5|6"; fontname = MENU_FONT_SMALL; posx = 8000; posy = MENU_START_Y + (MENU_SOUND_DY * 1) + MENU_CHOICE_YPLUS; dimx = 2000; dimy = MENU_CHOICE_DY; onchgsetoption = "invMaxColumns"; onchgsetoptionsection = "GAME"; flags = flags & ~IT_SELECTABLE; flags = flags | IT_TXT_CENTER; }; instance MENUITEM_GAME_MUSCLE(C_MENU_ITEM_DEF) { backPic = MENU_ITEM_BACK_PIC; text[0] = "Zvětšení postav"; text[1] = "Zvětšení modelů NPC na základě jejich síly"; posx = 0; posy = MENU_START_Y + (MENU_SOUND_DY * 2); dimx = 7000; dimy = 750; onselaction[0] = SEL_ACTION_UNDEF; flags = flags | IT_EFFECTS_NEXT; }; instance MENUITEM_GAME_MUSCLE_CHOICE(C_MENU_ITEM_DEF) { backPic = MENU_CHOICE_BACK_PIC; type = MENU_ITEM_CHOICEBOX; text[0] = "Ne|Ano"; fontname = MENU_FONT_SMALL; posx = 8000; posy = MENU_START_Y + (MENU_SOUND_DY * 2) + MENU_CHOICE_YPLUS; dimx = MENU_SLIDER_DX; dimy = MENU_CHOICE_DY; onchgsetoption = "bScaleStr"; onchgsetoptionsection = "AST"; flags = flags & ~IT_SELECTABLE; flags = flags | IT_TXT_CENTER; }; instance MENUITEM_M(C_MENU_ITEM_DEF) { backPic = MENU_ITEM_BACK_PIC; text[0] = "Zapnout myš"; text[1] = "Zapnout ovládání myší ve hře"; posx = 0; posy = MENU_START_Y + (MENU_SOUND_DY * 3); dimx = 7000; dimy = 750; onselaction[0] = SEL_ACTION_UNDEF; flags = flags | IT_EFFECTS_NEXT; }; instance MENUITEM_M_CHOICE(C_MENU_ITEM_DEF) { backPic = MENU_CHOICE_BACK_PIC; type = MENU_ITEM_CHOICEBOX; text[0] = "Ne|Ano"; fontname = MENU_FONT_SMALL; posx = 8000; posy = MENU_START_Y + (MENU_SOUND_DY * 3) + MENU_CHOICE_YPLUS; dimx = 2000; dimy = MENU_CHOICE_DY; onchgsetoption = "enableMouse"; onchgsetoptionsection = "GAME"; flags = flags & ~IT_SELECTABLE; flags = flags | IT_TXT_CENTER; }; instance MENUITEM_MSENSITIVITY(C_MENU_ITEM_DEF) { backPic = MENU_ITEM_BACK_PIC; text[0] = "Citlivost myši"; text[1] = "Citlivost myši ve hře"; posx = 0; posy = MENU_START_Y + (MENU_SOUND_DY * 4); dimx = 7000; dimy = 750; onselaction[0] = SEL_ACTION_UNDEF; flags = flags | IT_EFFECTS_NEXT; }; instance MENUITEM_MSENSITIVITY_SLIDER(C_MENU_ITEM_DEF) { backPic = MENU_SLIDER_BACK_PIC; type = MENU_ITEM_SLIDER; text[0] = ""; fontname = MENU_FONT_SMALL; posx = 8000; posy = MENU_START_Y + (MENU_SOUND_DY * 4) + MENU_SLIDER_YPLUS; dimx = 2000; dimy = MENU_SLIDER_DY; onchgsetoption = "mouseSensitivity"; onchgsetoptionsection = "GAME"; userfloat[0] = 20; userstring[0] = MENU_SLIDER_POS_PIC; flags = flags & ~IT_SELECTABLE; flags = flags | IT_TXT_CENTER; }; instance MENUITEM_GAME_OLDCONTROLS(C_MENU_ITEM_DEF) { backPic = MENU_ITEM_BACK_PIC; text[0] = "Množství krve"; text[1] = "Množství doprovodných efektů krve ve hře"; posx = 0; posy = MENU_START_Y + (MENU_SOUND_DY * 5); dimx = 7000; dimy = 750; onselaction[0] = SEL_ACTION_UNDEF; flags = flags | IT_EFFECTS_NEXT; }; instance MENUITEM_GAME_OLDCONTROLS_CHOICE(C_MENU_ITEM_DEF) { backPic = MENU_CHOICE_BACK_PIC; type = MENU_ITEM_CHOICEBOX; text[0] = "Žádná|Málo|Středně|Mnoho"; fontname = MENU_FONT_SMALL; posx = 8000; posy = MENU_START_Y + (MENU_SOUND_DY * 5) + MENU_CHOICE_YPLUS; dimx = 2000; dimy = MENU_CHOICE_DY; onchgsetoption = "bloodDetail"; onchgsetoptionsection = "GAME"; flags = flags & ~IT_SELECTABLE; flags = flags | IT_TXT_CENTER; }; instance MENUITEM_GAME_AUTOAIM(C_MENU_ITEM_DEF) { backPic = MENU_ITEM_BACK_PIC; text[0] = "Automatické míření"; text[1] = "Zapnout systém automatického míření pro luky a kuše"; posx = 0; posy = MENU_START_Y + (MENU_SOUND_DY * 6); dimx = 7000; dimy = 750; onselaction[0] = SEL_ACTION_UNDEF; flags = flags | IT_EFFECTS_NEXT; }; instance MENUITEM_GAME_AUTOAIM_CHOICE(C_MENU_ITEM_DEF) { backPic = MENU_CHOICE_BACK_PIC; type = MENU_ITEM_CHOICEBOX; text[0] = "Ne|Ano"; fontname = MENU_FONT_SMALL; posx = 8000; posy = MENU_START_Y + (MENU_SOUND_DY * 6) + MENU_CHOICE_YPLUS; dimx = 2000; dimy = MENU_CHOICE_DY; onchgsetoption = "AutoAIM"; onchgsetoptionsection = "AST"; flags = flags & ~IT_SELECTABLE; flags = flags | IT_TXT_CENTER; }; instance MENUITEM_GAME_BACK(C_MENU_ITEM_DEF) { backPic = MENU_ITEM_BACK_PIC; text[0] = "Zpět"; text[1] = ""; posx = 1000; posy = 7000; dimx = 6192; dimy = MENU_SOUND_DY; onselaction[0] = SEL_ACTION_BACK; flags = flags | IT_TXT_CENTER; };
D
/** * Contains the implementation of the dependency container. * * Part of the Poodinis Dependency Injection framework. * * Authors: * Mike Bierlee, m.bierlee@lostmoment.com * Copyright: 2014-2018 Mike Bierlee * License: * This software is licensed under the terms of the MIT license. * The full terms of the license can be found in the LICENSE file. */ module poodinis.container; import poodinis.registration; import poodinis.autowire; import poodinis.context; import poodinis.factory; import poodinis.valueinjection; import poodinis.polyfill; import std.string; import std.algorithm; import std.concurrency; import std.traits; debug { import std.stdio; } /** * Exception thrown when errors occur while resolving a type in a dependency container. */ class ResolveException : Exception { this(string message, TypeInfo resolveType) { super(format("Exception while resolving type %s: %s", resolveType.toString(), message)); } this(Throwable cause, TypeInfo resolveType) { super(format("Exception while resolving type %s", resolveType.toString()), cause); } } /** * Exception thrown when errors occur while registering a type in a dependency container. */ class RegistrationException : Exception { this(string message, TypeInfo registrationType) { super(format("Exception while registering type %s: %s", registrationType.toString(), message)); } } /** * Options which influence the process of registering dependencies */ public enum RegistrationOption { none = 0, /** * Prevent a concrete type being registered on itself. With this option you will always need * to use the supertype as the type of the dependency. */ doNotAddConcreteTypeRegistration = 1 << 0, } /** * Options which influence the process of resolving dependencies */ public enum ResolveOption { none = 0, /** * Registers the type you're trying to resolve before returning it. * This essentially makes registration optional for resolving by concerete types. * Resolinvg will still fail when trying to resolve a dependency by supertype. */ registerBeforeResolving = 1 << 0, /** * Does not throw a resolve exception when a type is not registered but will * return null instead. If the type is an array, an empty array is returned instead. */ noResolveException = 1 << 1 } /** * Methods marked with this UDA within dependencies are called after that dependency * is constructed by the dependency container. * * Multiple methods can be marked and will all be called after construction. The order in which * methods are called is undetermined. Methods should have the signature void(void). */ struct PostConstruct {} /** * Methods marked with this UDA within dependencies are called before the container * loses the dependency's registration. * * This method is called when removeRegistration or clearAllRegistrations is called. * It will also be called when the container's destructor is called. */ struct PreDestroy {} /** * The dependency container maintains all dependencies registered with it. * * Dependencies registered by a container can be resolved as long as they are still registered with the container. * Upon resolving a dependency, an instance is fetched according to a specific scope which dictates how instances of * dependencies are created. Resolved dependencies will be autowired before being returned. * * In most cases you want to use a global singleton dependency container provided by getInstance() to manage all dependencies. * You can still create new instances of this class for exceptional situations. */ synchronized class DependencyContainer { private Registration[][TypeInfo] registrations; private Registration[] autowireStack; private RegistrationOption persistentRegistrationOptions; private ResolveOption persistentResolveOptions; ~this() { clearAllRegistrations(); } /** * Register a dependency by concrete class type. * * A dependency registered by concrete class type can only be resolved by concrete class type. * No qualifiers can be used when resolving dependencies which are registered by concrete type. * * The default registration scope is "single instance" scope. * * Returns: * A registration is returned which can be used to change the registration scope. * * Examples: * Register and resolve a class by concrete type: * --- * class Cat : Animal { ... } * container.register!Cat; * --- * * See_Also: singleInstance, newInstance, existingInstance */ public Registration register(ConcreteType)(RegistrationOption options = RegistrationOption.none) { return register!(ConcreteType, ConcreteType)(options); } /** * Register a dependency by super type. * * A dependency registered by super type can only be resolved by super type. A qualifier is typically * used to resolve dependencies registered by super type. * * The default registration scope is "single instance" scope. * * Examples: * Register and resolve by super type * --- * class Cat : Animal { ... } * container.register!(Animal, Cat); * --- * * See_Also: singleInstance, newInstance, existingInstance, RegistrationOption */ public Registration register(SuperType, ConcreteType : SuperType)(RegistrationOption options = RegistrationOption.none) if (!is(ConcreteType == struct)) { TypeInfo registeredType = typeid(SuperType); TypeInfo_Class concreteType = typeid(ConcreteType); debug(poodinisVerbose) { writeln(format("DEBUG: Register type %s (as %s)", concreteType.toString(), registeredType.toString())); } auto existingRegistration = getExistingRegistration(registeredType, concreteType); if (existingRegistration) { return existingRegistration; } auto instanceFactory = new ConstructorInjectingInstanceFactory!ConcreteType(this); auto newRegistration = new AutowiredRegistration!ConcreteType(registeredType, instanceFactory, this); newRegistration.singleInstance(); static if (!is(SuperType == ConcreteType)) { if (!hasOption(options, persistentRegistrationOptions, RegistrationOption.doNotAddConcreteTypeRegistration)) { auto concreteTypeRegistration = register!ConcreteType; concreteTypeRegistration.linkTo(newRegistration); } } registrations[registeredType] ~= cast(shared(Registration)) newRegistration; return newRegistration; } private bool hasOption(OptionType)(OptionType options, OptionType persistentOptions, OptionType option) { return ((options | persistentOptions) & option) != 0; } private OptionType buildFlags(OptionType)(OptionType[] options) { OptionType flags; foreach (option; options) { flags |= option; } return flags; } private Registration getExistingRegistration(TypeInfo registrationType, TypeInfo qualifierType) { auto existingCandidates = registrationType in registrations; if (existingCandidates) { return getRegistration(cast(Registration[]) *existingCandidates, qualifierType); } return null; } private Registration getRegistration(Registration[] candidates, TypeInfo concreteType) { foreach(existingRegistration ; candidates) { if (existingRegistration.instanceType == concreteType) { return existingRegistration; } } return null; } /** * Resolve dependencies. * * Dependencies can only resolved using this method if they are registered by concrete type or the only * concrete type registered by super type. * * Resolved dependencies are automatically autowired before being returned. * * Returns: * An instance is returned which is created according to the registration scope with which they are registered. * * Throws: * ResolveException when type is not registered. * * Examples: * Resolve dependencies registered by super type and concrete type: * --- * class Cat : Animal { ... } * class Dog : Animal { ... } * * container.register!(Animal, Cat); * container.register!Dog; * * container.resolve!Animal; * container.resolve!Dog; * --- * You cannot resolve a dependency when it is registered by multiple super types: * --- * class Cat : Animal { ... } * class Dog : Animal { ... } * * container.register!(Animal, Cat); * container.register!(Animal, Dog); * * container.resolve!Animal; // Error: multiple candidates for type "Animal" * container.resolve!Dog; // Error: No type is registered by concrete type "Dog", only by super type "Animal" * --- * You need to use the resolve method which allows you to specify a qualifier. */ public RegistrationType resolve(RegistrationType)(ResolveOption resolveOptions = ResolveOption.none) if (!is(RegistrationType == struct)) { return resolve!(RegistrationType, RegistrationType)(resolveOptions); } /** * Resolve dependencies using a qualifier. * * Dependencies can only resolved using this method if they are registered by super type. * * Resolved dependencies are automatically autowired before being returned. * * Returns: * An instance is returned which is created according to the registration scope with which they are registered. * * Throws: * ResolveException when type is not registered or there are multiple candidates available for type. * * Examples: * Resolve dependencies registered by super type: * --- * class Cat : Animal { ... } * class Dog : Animal { ... } * * container.register!(Animal, Cat); * container.register!(Animal, Dog); * * container.resolve!(Animal, Cat); * container.resolve!(Animal, Dog); * --- */ public QualifierType resolve(RegistrationType, QualifierType : RegistrationType)(ResolveOption resolveOptions = ResolveOption.none) if (!is(QualifierType == struct)) { TypeInfo resolveType = typeid(RegistrationType); TypeInfo qualifierType = typeid(QualifierType); debug(poodinisVerbose) { writeln("DEBUG: Resolving type " ~ resolveType.toString() ~ " with qualifier " ~ qualifierType.toString()); } static if (__traits(compiles, new QualifierType())) { if (hasOption(resolveOptions, persistentResolveOptions, ResolveOption.registerBeforeResolving)) { register!(RegistrationType, QualifierType)(); } } auto candidates = resolveType in registrations; if (!candidates) { if (hasOption(resolveOptions, persistentResolveOptions, ResolveOption.noResolveException)) { return null; } throw new ResolveException("Type not registered.", resolveType); } Registration registration = getQualifiedRegistration(resolveType, qualifierType, cast(Registration[]) *candidates); try { QualifierType newInstance = resolveAutowiredInstance!QualifierType(registration); callPostConstructors(newInstance); return newInstance; } catch (ValueInjectionException e) { throw new ResolveException(e, resolveType); } } private QualifierType resolveAutowiredInstance(QualifierType)(Registration registration) { QualifierType instance; if (!(cast(Registration[]) autowireStack).canFind(registration)) { autowireStack ~= cast(shared(Registration)) registration; instance = cast(QualifierType) registration.getInstance(new AutowireInstantiationContext()); autowireStack = autowireStack[0 .. $-1]; } else { auto autowireContext = new AutowireInstantiationContext(); autowireContext.autowireInstance = false; instance = cast(QualifierType) registration.getInstance(autowireContext); } return instance; } /** * Resolve all dependencies registered to a super type. * * Returns: * An array of autowired instances is returned. The order is undetermined. * * Examples: * --- * class Cat : Animal { ... } * class Dog : Animal { ... } * * container.register!(Animal, Cat); * container.register!(Animal, Dog); * * Animal[] animals = container.resolveAll!Animal; * --- */ public RegistrationType[] resolveAll(RegistrationType)(ResolveOption resolveOptions = ResolveOption.none) { RegistrationType[] instances; TypeInfo resolveType = typeid(RegistrationType); auto qualifiedRegistrations = resolveType in registrations; if (!qualifiedRegistrations) { if (hasOption(resolveOptions, persistentResolveOptions, ResolveOption.noResolveException)) { return []; } throw new ResolveException("Type not registered.", resolveType); } foreach(registration ; cast(Registration[]) *qualifiedRegistrations) { instances ~= resolveAutowiredInstance!RegistrationType(registration); } return instances; } private Registration getQualifiedRegistration(TypeInfo resolveType, TypeInfo qualifierType, Registration[] candidates) { if (resolveType == qualifierType) { if (candidates.length > 1) { string candidateList = candidates.toConcreteTypeListString(); throw new ResolveException("Multiple qualified candidates available: " ~ candidateList ~ ". Please use a qualifier.", resolveType); } return candidates[0]; } return getRegistration(candidates, qualifierType); } private void callPostConstructors(Type)(Type instance) { foreach (memberName; __traits(allMembers, Type)) { static if (__traits(compiles, __traits(getProtection, __traits(getMember, instance, memberName))) && __traits(getProtection, __traits(getMember, instance, memberName)) == "public" && isFunction!(__traits(getMember, instance, memberName)) && hasUDA!(__traits(getMember, instance, memberName), PostConstruct)) { __traits(getMember, instance, memberName)(); } } } /** * Clears all dependency registrations managed by this container. */ public void clearAllRegistrations() { foreach(registrationsOfType; registrations) { callPreDestructorsOfRegistrations(registrationsOfType); } registrations.destroy(); } /** * Removes a registered dependency by type. * * A dependency can be removed either by super type or concrete type, depending on how they are registered. * * Examples: * --- * container.removeRegistration!Animal; * --- */ public void removeRegistration(RegistrationType)() { auto registrationsOfType = *(typeid(RegistrationType) in registrations); callPreDestructorsOfRegistrations(registrationsOfType); registrations.remove(typeid(RegistrationType)); } private void callPreDestructorsOfRegistrations(shared(Registration[]) registrations) { foreach(registration; registrations) { Registration unsharedRegistration = cast(Registration) registration; if (unsharedRegistration.preDestructor !is null) { unsharedRegistration.preDestructor()(); } } } /** * Apply persistent registration options which will be used everytime register() is called. */ public void setPersistentRegistrationOptions(RegistrationOption options) { persistentRegistrationOptions = options; } /** * Unsets all applied persistent registration options */ public void unsetPersistentRegistrationOptions() { persistentRegistrationOptions = RegistrationOption.none; } /** * Apply persistent resolve options which will be used everytime resolve() is called. */ public void setPersistentResolveOptions(ResolveOption options) { persistentResolveOptions = options; } /** * Unsets all applied persistent resolve options */ public void unsetPersistentResolveOptions() { persistentResolveOptions = ResolveOption.none; } }
D
INSTANCE Info_Mod_Lefty_Hi (C_INFO) { npc = Mod_1294_SLD_Lefty_MT; nr = 1; condition = Info_Mod_Lefty_Hi_Condition; information = Info_Mod_Lefty_Hi_Info; permanent = 0; important = 1; }; FUNC INT Info_Mod_Lefty_Hi_Condition() { if (hero.guild == GIL_MIL) { return 1; }; }; FUNC VOID Info_Mod_Lefty_Hi_Info() { AI_Output(self, hero, "Info_Mod_Lefty_Hi_07_00"); //Hey, du musst neu im Lager sein. AI_Output(hero, self, "Info_Mod_Lefty_Hi_15_01"); //In gewisser Weise schon ... AI_Output(self, hero, "Info_Mod_Lefty_Hi_07_02"); //Wenn du es zu was bringen willst, musst du dich nützlich machen, zeigen, dass du was auf dem Kasten hast. Ich habe da schon eine Aufgabe für dich. AI_Output(hero, self, "Info_Mod_Lefty_Hi_15_03"); //Ja, worum geht es? AI_Output(self, hero, "Info_Mod_Lefty_Hi_07_04"); //Vor einiger Zeit kam so ein Typ zu uns ins Lager. Die Bauern haben den gegen uns aufgestachelt und er hat uns übel zugerichtet. AI_Output(self, hero, "Info_Mod_Lefty_Hi_07_05"); //Der hat mich so am Kopf erwischt ... ich kann mich jetzt kaum noch erinnern, wie sein Gesicht genau aussah. AI_Output(hero, self, "Info_Mod_Lefty_Hi_15_06"); //Soso, kommt mir irgendwie bekannt vor. AI_Output(self, hero, "Info_Mod_Lefty_Hi_07_07"); //Hey, der Typ war auch ... ähh ... über zwei Meter groß, sage ich dir, genau. Voll der Bär. Gegen den sah ein Ork aus, wie ein Knabe ... AI_Output(self, hero, "Info_Mod_Lefty_Hi_07_08"); //Ich habe zuletzt lange mit ihm gefochten, aber dann hat er mich doch noch erwischt. AI_Output(hero, self, "Info_Mod_Lefty_Hi_15_09"); //(belächelnd) Über zwei Meter? Klingt ja Furcht einflößend. AI_Output(self, hero, "Info_Mod_Lefty_Hi_07_10"); //Jedenfalls sind die Bauern seitdem sehr aufsässig. Jemand müsste ihnen mal wieder zeigen, wer das sagen hat. AI_Output(self, hero, "Info_Mod_Lefty_Hi_07_11"); //Das wäre die Gelegenheit für dich zu zeigen, dass du austeilen kannst. Info_ClearChoices (Info_Mod_Lefty_Hi); Info_AddChoice (Info_Mod_Lefty_Hi, "Was, wehrlose Bauern? Da musst du dir echt jemand anderen suchen.", Info_Mod_Lefty_Hi_B); Info_AddChoice (Info_Mod_Lefty_Hi, "Klar, die paar Bauern haue ich im nu zusammen.", Info_Mod_Lefty_Hi_A); }; FUNC VOID Info_Mod_Lefty_Hi_B() { AI_Output(hero, self, "Info_Mod_Lefty_Hi_B_15_00"); //Was, wehrlose Bauern? Da musst du dir echt jemand anderen suchen. AI_Output(self, hero, "Info_Mod_Lefty_Hi_B_07_01"); //Flasche. Dann muss das halt jemand anders übernehmen. Mod_LeftysBauern = 1; Info_ClearChoices (Info_Mod_Lefty_Hi); }; FUNC VOID Info_Mod_Lefty_Hi_A() { AI_Output(hero, self, "Info_Mod_Lefty_Hi_A_15_00"); //Klar, die paar Bauern haue ich im nu zusammen. AI_Output(self, hero, "Info_Mod_Lefty_Hi_A_07_01"); //Sehr gut. Verkloppe mindestens fünf Bauern ... und diesen Horatio solltest du dir auch auf jeden Fall vornehmen. Der scheint so eine Art Anführer von denen zu sein. Mod_LeftysBauern = 2; Log_CreateTopic (TOPIC_MOD_SLD_LEFTYBAUERN, LOG_MISSION); B_SetTopicStatus (TOPIC_MOD_SLD_LEFTYBAUERN, LOG_RUNNING); B_LogEntry (TOPIC_MOD_SLD_LEFTYBAUERN, "Ich soll für Lefty fünf Bauern und Horatio verprügeln."); Info_ClearChoices (Info_Mod_Lefty_Hi); }; INSTANCE Info_Mod_Lefty_BauernVerbatscht (C_INFO) { npc = Mod_1294_SLD_Lefty_MT; nr = 1; condition = Info_Mod_Lefty_BauernVerbatscht_Condition; information = Info_Mod_Lefty_BauernVerbatscht_Info; permanent = 0; important = 1; }; FUNC INT Info_Mod_Lefty_BauernVerbatscht_Condition() { if (Mod_LeftysBauern == 3) { return 1; }; }; FUNC VOID Info_Mod_Lefty_BauernVerbatscht_Info() { AI_Output(self, hero, "Info_Mod_Lefty_BauernVerbatscht_07_00"); //Ha, sehr gut, das wird den Bauern zeigen, wer hier das Sagen hat. Geh gleich zum Reislord, er wird dich dafür belohnen. AI_Output(self, hero, "Info_Mod_Lefty_BauernVerbatscht_07_01"); //Typen wie dich können wir hier im Lager gut gebrauchen. B_LogEntry (TOPIC_MOD_SLD_LEFTYBAUERN, "Lefty war zufrieden. Ich soll mir beim Reislord meine Belohnung holen."); B_GivePlayerXP (200); }; INSTANCE Info_Mod_Lefty_RufusWeg (C_INFO) { npc = Mod_1294_SLD_Lefty_MT; nr = 1; condition = Info_Mod_Lefty_RufusWeg_Condition; information = Info_Mod_Lefty_RufusWeg_Info; permanent = 0; important = 1; }; FUNC INT Info_Mod_Lefty_RufusWeg_Condition() { if (Mod_LeftysBauern == 5) { return 1; }; }; FUNC VOID Info_Mod_Lefty_RufusWeg_Info() { AI_Output(self, hero, "Info_Mod_Lefty_RufusWeg_07_00"); //Verdammt, dieser dumme Bauer Rufus hat die Kurve gekratzt. Der Reislord ist außer sich. So was bringt die anderen Bauern nur auf dumme Gedanken. AI_Output(self, hero, "Info_Mod_Lefty_RufusWeg_07_01"); //Wer den Flüchtenden wieder einfangen würde, bekäme bestimmt eine gute Belohnung. AI_Output(self, hero, "Info_Mod_Lefty_RufusWeg_07_02"); //(etwas stiller zu sich selbst) Obwohl der Reislord auch bestimmt nichts dagegen hätte, wenn man Rufus den Garaus machen würde. Log_CreateTopic (TOPIC_MOD_SLD_RUFUS, LOG_MISSION); B_SetTopicStatus (TOPIC_MOD_SLD_RUFUS, LOG_RUNNING); B_LogEntry (TOPIC_MOD_SLD_RUFUS, "Der Bauer Rufus ist abgehauen. Wer ihn wieder zurückholen würde, könnte mit einer Belohnung beim Reislord rechnen."); }; INSTANCE Info_Mod_Lefty_RufusDa (C_INFO) { npc = Mod_1294_SLD_Lefty_MT; nr = 1; condition = Info_Mod_Lefty_RufusDa_Condition; information = Info_Mod_Lefty_RufusDa_Info; permanent = 0; important = 1; }; FUNC INT Info_Mod_Lefty_RufusDa_Condition() { if (Mod_SLD_Rufus == 3) && (!Npc_IsDead(Mod_1082_BAU_Rufus_MT)) { return 1; }; }; FUNC VOID Info_Mod_Lefty_RufusDa_Info() { AI_Output(self, hero, "Info_Mod_Lefty_RufusDa_07_00"); //Du hast Rufus tatsächlich gefunden und zurückgebracht. Der kann jetzt was erleben ... if (hero.guild == GIL_MIL) { AI_Output(self, hero, "Info_Mod_Lefty_RufusDa_07_01"); //Egal, damit hast du wieder einige Punkte gesammelt. Geh gleich zum Reislord. } else { AI_Output(self, hero, "Info_Mod_Lefty_RufusDa_07_02"); //Egal, damit hast du was gut. Geh gleich zum Reislord. }; B_LogEntry (TOPIC_MOD_SLD_RUFUS, "Ich soll jetzt zum Reislord gehen."); Mod_SLD_Rufus = 6; }; INSTANCE Info_Mod_Lefty_RufusTot (C_INFO) { npc = Mod_1294_SLD_Lefty_MT; nr = 1; condition = Info_Mod_Lefty_RufusTot_Condition; information = Info_Mod_Lefty_RufusTot_Info; permanent = 0; important = 1; }; FUNC INT Info_Mod_Lefty_RufusTot_Condition() { if (Npc_IsDead(Mod_1082_BAU_Rufus_MT)) && (Npc_KnowsInfo(hero, Info_Mod_Lefty_RufusWeg)) { return 1; }; }; FUNC VOID Info_Mod_Lefty_RufusTot_Info() { AI_Output(self, hero, "Info_Mod_Lefty_RufusTot_07_00"); //Du warst doch außerhalb des Lagers. Hast du zufällig Rufus gesehen? AI_Output(hero, self, "Info_Mod_Lefty_RufusTot_15_01"); //Ja. In seinem Blut. AI_Output(self, hero, "Info_Mod_Lefty_RufusTot_07_02"); //Du willst doch nicht damit sagen ... AI_Output(hero, self, "Info_Mod_Lefty_RufusTot_15_03"); //Doch. AI_Output(self, hero, "Info_Mod_Lefty_RufusTot_07_04"); //Geh zum Reislord. Das wird ihn interessieren. B_LogEntry (TOPIC_MOD_SLD_RUFUS, "Ich soll zum Reislord und ihm von Rufus’ Schicksal berichten."); }; INSTANCE Info_Mod_Lefty_OJGBoss (C_INFO) { npc = Mod_1294_SLD_Lefty_MT; nr = 1; condition = Info_Mod_Lefty_OJGBoss_Condition; information = Info_Mod_Lefty_OJGBoss_Info; permanent = 0; important = 1; }; FUNC INT Info_Mod_Lefty_OJGBoss_Condition() { if (Mod_LeeOJGBoss < Wld_GetDay()-3) && (Npc_KnowsInfo(hero, Info_Mod_Lee_HabPfeife)) { return 1; }; }; FUNC VOID Info_Mod_Lefty_OJGBoss_Info() { AI_Output(self, hero, "Info_Mod_Lefty_OJGBoss_07_00"); //(etwas ehrfürchtig) Hey, ähhm, du bist doch der neue Anführer der Orkjäger. AI_Output(hero, self, "Info_Mod_Lefty_OJGBoss_15_01"); //Ja, und weiter? AI_Output(self, hero, "Info_Mod_Lefty_OJGBoss_07_02"); //(verunsichert) Nichts, nichts ... nur ... der Reislord hat ein Geschenk für dich ... um dir, ähh, unseren Respekt zu zollen. }; INSTANCE Info_Mod_Lefty_Pickpocket (C_INFO) { npc = Mod_1294_SLD_Lefty_MT; nr = 1; condition = Info_Mod_Lefty_Pickpocket_Condition; information = Info_Mod_Lefty_Pickpocket_Info; permanent = 1; important = 0; description = Pickpocket_60; }; FUNC INT Info_Mod_Lefty_Pickpocket_Condition() { C_Beklauen (53, ItFo_Water, 6); }; FUNC VOID Info_Mod_Lefty_Pickpocket_Info() { Info_ClearChoices (Info_Mod_Lefty_Pickpocket); Info_AddChoice (Info_Mod_Lefty_Pickpocket, DIALOG_BACK, Info_Mod_Lefty_Pickpocket_BACK); Info_AddChoice (Info_Mod_Lefty_Pickpocket, DIALOG_PICKPOCKET, Info_Mod_Lefty_Pickpocket_DoIt); }; FUNC VOID Info_Mod_Lefty_Pickpocket_BACK() { Info_ClearChoices (Info_Mod_Lefty_Pickpocket); }; FUNC VOID Info_Mod_Lefty_Pickpocket_DoIt() { if (B_Beklauen() == TRUE) { Info_ClearChoices (Info_Mod_Lefty_Pickpocket); } else { Info_ClearChoices (Info_Mod_Lefty_Pickpocket); Info_AddChoice (Info_Mod_Lefty_Pickpocket, DIALOG_PP_BESCHIMPFEN, Info_Mod_Lefty_Pickpocket_Beschimpfen); Info_AddChoice (Info_Mod_Lefty_Pickpocket, DIALOG_PP_BESTECHUNG, Info_Mod_Lefty_Pickpocket_Bestechung); Info_AddChoice (Info_Mod_Lefty_Pickpocket, DIALOG_PP_HERAUSREDEN, Info_Mod_Lefty_Pickpocket_Herausreden); }; }; FUNC VOID Info_Mod_Lefty_Pickpocket_Beschimpfen() { B_Say (hero, self, "$PICKPOCKET_BESCHIMPFEN"); B_Say (self, hero, "$DIRTYTHIEF"); Info_ClearChoices (Info_Mod_Lefty_Pickpocket); AI_StopProcessInfos (self); B_Attack (self, hero, AR_Theft, 1); }; FUNC VOID Info_Mod_Lefty_Pickpocket_Bestechung() { B_Say (hero, self, "$PICKPOCKET_BESTECHUNG"); var int rnd; rnd = r_max(99); if (rnd < 25) || ((rnd >= 25) && (rnd < 50) && (Npc_HasItems(hero, ItMi_Gold) < 50)) || ((rnd >= 50) && (rnd < 75) && (Npc_HasItems(hero, ItMi_Gold) < 100)) || ((rnd >= 75) && (rnd < 100) && (Npc_HasItems(hero, ItMi_Gold) < 200)) { B_Say (self, hero, "$DIRTYTHIEF"); Info_ClearChoices (Info_Mod_Lefty_Pickpocket); AI_StopProcessInfos (self); B_Attack (self, hero, AR_Theft, 1); } else { if (rnd >= 75) { B_GiveInvItems (hero, self, ItMi_Gold, 200); } else if (rnd >= 50) { B_GiveInvItems (hero, self, ItMi_Gold, 100); } else if (rnd >= 25) { B_GiveInvItems (hero, self, ItMi_Gold, 50); }; B_Say (self, hero, "$PICKPOCKET_BESTECHUNG_01"); Info_ClearChoices (Info_Mod_Lefty_Pickpocket); AI_StopProcessInfos (self); }; }; FUNC VOID Info_Mod_Lefty_Pickpocket_Herausreden() { B_Say (hero, self, "$PICKPOCKET_HERAUSREDEN"); if (r_max(99) < Mod_Verhandlungsgeschick) { B_Say (self, hero, "$PICKPOCKET_HERAUSREDEN_01"); Info_ClearChoices (Info_Mod_Lefty_Pickpocket); } else { B_Say (self, hero, "$PICKPOCKET_HERAUSREDEN_02"); }; }; INSTANCE Info_Mod_Lefty_EXIT (C_INFO) { npc = Mod_1294_SLD_Lefty_MT; nr = 1; condition = Info_Mod_Lefty_EXIT_Condition; information = Info_Mod_Lefty_EXIT_Info; permanent = 1; important = 0; description = DIALOG_ENDE; }; FUNC INT Info_Mod_Lefty_EXIT_Condition() { return 1; }; FUNC VOID Info_Mod_Lefty_EXIT_Info() { AI_StopProcessInfos (self); };
D
/******************************************************************************* Neo protocol support for DlsClient Copyright: Copyright (c) 2016-2017 dunnhumby Germany GmbH. All rights reserved. License: Boost Software License Version 1.0. See LICENSE.txt for details. *******************************************************************************/ module dlsproto.client.mixins.NeoSupport; import ocean.core.Tuple; /*********************************************************************** Template to strip the notifier from the variadic arguments. Params: TypeToErase = type to erase from options options = Tuple to erase the members matching TypeToErase Returns: options without any member with type equal to TypeToErase TODO: this should be moved to RequestOptions module in swarm ***********************************************************************/ template eraseFromArgs (TypeToErase, options ...) { static if (options.length > 0) { static if (is(typeof(options[0]) == TypeToErase)) { alias options[1..$] eraseFromArgs; } else { alias Tuple!(options[0], eraseFromArgs!(TypeToErase, options[1..$])) eraseFromArgs; } } else { alias Tuple!() eraseFromArgs; } } /******************************************************************************* Template wrapping access to all "neo" features. Mixin this class into the DlsClient, and construct and use `neo` object for this. ********************************************************************************/ template NeoSupport () { import dlsproto.client.internal.SharedResources; import swarm.neo.client.request_options.RequestOptions; import core.stdc.time; import ocean.core.Verify; import ocean.core.VersionCheck; public import dlsproto.common.GetRange; /*************************************************************************** Class wrapping access to all "neo" features. (When the old protocol is removed, the contents of this class will be moved into the top level of the client class.) Usage example: see the documented unittest, in UsageExamples ***************************************************************************/ public class Neo { import swarm.neo.client.mixins.ClientCore; // Required otherwise the legacy RequestContext is picked with the new // symbol resolution algorithm public import swarm.neo.client.request_options.RequestContext : RequestContext; import swarm.neo.client.mixins.Controllers; import core.stdc.time; /*********************************************************************** Public imports of the request API modules, for the convenience of user code. ***********************************************************************/ public import Put = dlsproto.client.request.Put; public import GetRange = dlsproto.client.request.GetRange; /*********************************************************************** Public aliases of the request API parameters struct, for the convenience of user code. ***********************************************************************/ public alias GetRange.Filter Filter; /*********************************************************************** Private imports of the request implementation modules. ***********************************************************************/ private struct Internals { public import dlsproto.client.request.internal.Put; public import dlsproto.client.request.internal.GetRange; } /*********************************************************************** Mixin core client internals (see swarm.neo.client.mixins.ClientCore). ***********************************************************************/ mixin ClientCore!(); /*********************************************************************** Mixin `Controller` and `Suspendable` helper class templates (see swarm.neo.client.mixins.Controllers). ***********************************************************************/ mixin Controllers!(); /*********************************************************************** Test instantiating the `Controller` and `Suspendable` class templates. ***********************************************************************/ unittest { alias Controller!(GetRange.IController) GetRangeController; alias Suspendable!(GetRange.IController) GetRangeSuspendable; } /*********************************************************************** DLS request stats class. New an instance of this class to access per-request stats. ***********************************************************************/ public alias RequestStatsTemplate!("Put", "GetRange") RequestStats; /*********************************************************************** Assigns a Put request, pushing a value to a storage channel. Params: channel = name of the channel to put to timestamp = timestamp of the record to put value = value to put (will be copied internally) notifier = notifier delegate options ... = optional request settings, see below Returns: id of newly assigned request Throws: NoMoreRequests if the pool of active requests is full, or Exception if there are no nodes registered. Optional parameters allowed for this request are (may be specified in any order): * RequestContext: user-specified data (integer, pointer, Object) associated with this request. Passed to the notifier. ***********************************************************************/ public RequestId put (C, Options...)( cstring channel, time_t timestamp, C value, scope Put.Notifier notifier, Options options ) { static assert(is(C: const(void)[]),"value must be implicitly castable to" ~ " const(void)[]"); RequestContext context; scope parse_context = (RequestContext context_) { context = context_; }; setupOptionalArgs!(options.length)(options, parse_context); auto params = const(Internals.Put.UserSpecifiedParams)( const(Put.Args)(channel, timestamp, value), notifier ); auto id = this.assign!(Internals.Put)(params); return id; } /*********************************************************************** Assigns a GetRange request, getting the values from the specified channel and range. Params: channel = name of the channel to put to low = lower bouond high = higher bound notifier = notifier delegate options ... = optional request settings, see below Returns: id of newly assigned request Throws: NoMoreRequests if the pool of active requests is full Optional parameters allowed for this request are (may be specified in any order): * RequestContext: user-specified data (integer, pointer, Object) associated with this request. Passed to the notifier. * GetRange.Filter: GetRange.Filter struct instructing node to filter results on PCRE or string matching filter ***********************************************************************/ public RequestId getRange (Options...) ( cstring channel, time_t low, time_t high, scope GetRange.Notifier notifier, Options options ) { cstring filter_string; Filter.FilterMode filter_mode; RequestContext context; scope parse_context = (RequestContext context_) { context = context_; }; scope parse_filter = (GetRange.Filter filter) { filter_string = filter.filter_string; filter_mode = filter.filter_mode; }; setupOptionalArgs!(options.length)(options, parse_filter, parse_context ); auto params = const(Internals.GetRange.UserSpecifiedParams)( const(GetRange.Args)(channel, low, high, filter_string, filter_mode, context), notifier ); auto id = this.assign!(Internals.GetRange)(params); return id; } /*********************************************************************** Gets the type of the wrapper struct of the request associated with the specified controller interface. Params: I = type of controller interface Evaluates to: the type of the request wrapper struct which contains an implementation of the interface I ***********************************************************************/ private template Request ( I ) { static if ( is(I == GetRange.IController ) ) { alias Internals.GetRange Request; } else { static assert(false, I.stringof ~ " does not match any request " ~ "controller"); } } /*********************************************************************** Gets access to a controller for the specified request. If the request is still active, the controller is passed to the provided delegate for use. Important usage notes: 1. The controller is newed on the stack. This means that user code should never store references to it -- it must only be used within the scope of the delegate. 2. As the id which identifies the request is only known at run- time, it is not possible to statically enforce that the specified ControllerInterface type matches the request. This is asserted at run-time, though (see RequestSet.getRequestController()). Params: ControllerInterface = type of the controller interface (should be inferred by the compiler) id = id of request to get a controller for (the return value of the method which assigned your request) dg = delegate which is called with the controller, if the request is still active Returns: false if the specified request no longer exists; true if the controller delegate was called ***********************************************************************/ public bool control ( ControllerInterface ) ( RequestId id, scope void delegate ( ControllerInterface ) dg ) { alias Request!(ControllerInterface) R; return this.controlImpl!(R)(id, dg); } /*********************************************************************** Test instantiating the `control` function template. ***********************************************************************/ unittest { alias control!(GetRange.IController) getRangeControl; } } /*************************************************************************** Class wrapping access to all task-blocking "neo" features. (This functionality is separated from the main neo functionality as it implements methods with the same names and arguments (e.g. a callback- based Put request).) Usage example: see the documented unittest, in UsageExamples module ***************************************************************************/ private class TaskBlocking { import ocean.core.Array : copy; import ocean.task.Task; import swarm.neo.client.mixins.TaskBlockingCore; import swarm.neo.client.request_options.RequestContext; /*********************************************************************** Mixin core client task-blocking internals (see swarm.neo.client.mixins.TaskBlockingCore. ***********************************************************************/ mixin TaskBlockingCore!(); /*********************************************************************** Struct returned after a Put request has finished. ***********************************************************************/ private static struct PutResult { /******************************************************************* Set to true if the record was put into the DLS or false if this was not possible (i.e. the request was attempted on all nodes and failed on all). *******************************************************************/ bool succeeded; } /*********************************************************************** Assigns a Put request to the channel and blocks the current Task until the request is completed. Params: channel = name of the channel to put into key = key of the record to put value = value to put (will be copied internally) options... = optional request settings, see below Returns: PutResult struct, indicating the result of the request Throws: NoMoreRequests if the pool of active requests is full, or Exception if there are no nodes registered. Optional parameters allowed for this request are (may be specified in any order): * RequestContext: user-specified data (integer, pointer, Object) associated with this request. Passed to the notifier. * Neo.Put.PutNofifier: notifier delegate, not required for feedback on basic success/failure, but may be desired for more detailed error logging. ***********************************************************************/ public PutResult put(C, Options...) ( cstring channel, time_t key, C value, Options options) { static assert(is(C: const(void)[]),"value must be implicitly castable to" ~ " void[]"); auto task = Task.getThis(); verify(task !is null, "This method may only be called from inside a Task"); enum FinishedStatus { None, Succeeded, Failed } Neo.Put.Notifier user_notifier; FinishedStatus state; scope parse_notifier = (Neo.Put.Notifier notifier) { user_notifier = notifier; }; setupOptionalArgs!(options.length)(options, // explicit `delegate` is needed here, // because in D2 this is a function, since it doesn't // use outer context delegate (Neo.RequestContext context) { // Unused here. Passed through to Neo.put() }, parse_notifier ); scope notifier = ( Neo.Put.Notification info, const(Neo.Put.Args) args ) { if ( user_notifier ) user_notifier(info, args); with ( info.Active ) switch ( info.active ) { case success: state = state.Succeeded; if ( task.suspended ) task.resume(); break; case failure: state = state.Failed; if ( task.suspended ) task.resume(); break; case node_disconnected: case node_error: case unsupported: break; default: assert(false); } }; this.outer.neo.put(channel, key, value, notifier, eraseFromArgs!(Neo.Put.Notifier, options)); if ( state == state.None ) // if request not completed, suspend task.suspend(); verify(state != state.None); PutResult res; res.succeeded = state == state.Succeeded; return res; } /*********************************************************************** Struct to wrap the result of task-blocking GetRange and to provide opApply(). Node that the Task-blocking GetRange consciously provides a simplistic, clean API, without any of the more advanced features of the request (e.g. suspending). If you need these features, please use the callback-based version of the request. ***********************************************************************/ public struct GetRangeResult { import ocean.core.array.Mutation: copy; /// User task to resume/suspend private Task task; /// Timestamp of the current record private time_t record_key; /// Value of the current record private void[]* record_value; /// Possible states of the request private enum State { /// The request is running Running, /// The user has stopped this request by breaking from foreach /// (the request may still be running for some time, but all /// records will be ignored. Stopped, /// The request has finished on all nodes Finished } // Indicator of the request's state. private State state; /// User notifier to call private Neo.GetRange.Notifier user_notifier; /// Channel to iterate over private cstring channel; /// Lower timestamp boundary private time_t low; /// Higher timestamp boundary private time_t high; /// Filter provided by user private Neo.GetRange.Filter filter; /// Neo DlsClient instance private Neo neo; /// error indicator public bool error; /// Request id (used internally) private DlsClient.Neo.RequestId rq_id; /******************************************************************* Notifier used to set the local values and resume task Params: info = information and payload about the event user has been notified about args = arguments passed by the user when starting request *******************************************************************/ private void notifier ( DlsClient.Neo.GetRange.Notification info, const(DlsClient.Neo.GetRange.Args) args ) { if (this.user_notifier) { this.user_notifier(info, args); } with ( info.Active ) switch ( info.active ) { case received: // Ignore all received value on user break if (this.state == State.Stopped) break; // Store the received value this.record_key = info.received.key; copy(*this.record_value, info.received.value); assumeSafeAppend(*this.record_value); if (this.task.suspended()) { this.task.resume(); } break; case stopped: case finished: // Even if the user has requested stopping, // but finished arrived, we will just finish and exit this.state = State.Finished; this.task.resume(); break; case node_disconnected: case node_error: case unsupported: // Ignore all errors on user break if (this.state == State.Stopped) break; this.error = true; break; default: assert(false); } } /******************************************************************* Task-blocking opApply iteration over GetRange *******************************************************************/ public int opApply (scope int delegate(ref time_t key, ref void[] value) dg) { int ret; this.rq_id = this.neo.getRange(this.channel, this.low, this.high, &this.notifier, this.filter); while (this.state != State.Finished) { Task.getThis().suspend(); // no more records if (this.state == State.Finished || this.state == State.Stopped || this.error) break; ret = dg(this.record_key, *this.record_value); if (ret) { this.state = State.Stopped; this.neo.control(this.rq_id, ( DlsClient.Neo.GetRange.IController get_range ) { get_range.stop(); }); // Wait for the request to finish Task.getThis().suspend(); break; } } return ret; } } /*********************************************************************** Assigns a task blocking GetRange request, getting the values from the specified channel and range. This method only provides nothing but the most basic usage (no request context, no way to control the request (stop/resume/suspend)), so if that is needed, please use non-task blocking getRange. Params: channel = name of the channel to get the records from record_buffer = reusable buffer to store the current record's values into low = lower bouond high = higher bound notifier = notifier delegate options ... = optional request settings, see below Returns: GetRangeResult structure, whose opApply should be used Throws: NoMoreRequests if the pool of active requests is full Optional parameters allowed for this request are (may be specified in any order): * GetRange.Filter: GetRange.Filter struct instructing node to filter results on PCRE or string matching filter * Neo.GetRange.Nofifier: notifier delegate, not required for feedback on basic success/failure, but may be desired for more detailed error logging. ***********************************************************************/ public GetRangeResult getRange (C, Options...) ( C channel, ref void[] record_buffer, time_t low, time_t high, Options options ) { static assert(is(C: const(void)[]),"value must be implicitly castable to" ~ " const(void)[]"); auto task = Task.getThis(); verify(task !is null, "This method may only be called from inside a Task"); GetRangeResult res; res.task = task; res.neo = this.outer.neo; res.record_value = &record_buffer; res.channel = channel; res.low = low; res.high = high; scope parse_filter = (Neo.GetRange.Filter filter) { // Unused here. Passed through to Neo.getRange() res.filter = filter; }; scope parse_notifier = (Neo.GetRange.Notifier notifier) { res.user_notifier = notifier; }; setupOptionalArgs!(options.length)(options, parse_filter, parse_notifier ); return res; } } version ( unittest ) { import ocean.task.Scheduler; import ocean.task.Task; } unittest { // Test optional arguments static class PutWithOptionalArgsTask : Task { private DlsClient dls; this ( DlsClient dls ) { this.dls = dls; } private void putNotifier ( DlsClient.Neo.Put.Notification info, const(DlsClient.Neo.Put.Args) args ) { } override public void run ( ) { auto result = this.dls.blocking.put("channel".dup, 0x1234, "value_to_put".dup, &this.putNotifier, Neo.RequestContext(2)); result = this.dls.blocking.put("channel".dup, 0x1234, "value_to_put".dup, Neo.RequestContext(2)); result = this.dls.blocking.put("channel".dup, 0x1234, "value_to_put".dup); } } } /*************************************************************************** Object containing all neo task-blocking functionality. ***************************************************************************/ public TaskBlocking blocking; /*************************************************************************** Object containing all neo functionality. ***************************************************************************/ public Neo neo; /*************************************************************************** Helper function to initialise neo components. Params: auth_name = client name for authorisation auth_key = client key (password) for authorisation. This should be a properly generated random number which only the client and the nodes know. See `swarm/README_client_neo.rst` for suggestions. The key must be of the length defined in swarm.neo.authentication.HmacDef (128 bytes) conn_notifier = delegate which is called when a connection attempt succeeds or fails (including when a connection is re-established). Of type: void delegate ( IPAddress node_address, Exception e ) ***************************************************************************/ private void neoInit ( cstring auth_name, ubyte[] auth_key, scope Neo.ConnectionNotifier conn_notifier ) { this.neo = new Neo(auth_name, auth_key, Neo.Settings(conn_notifier, new SharedResources(this.epoll))); this.blocking = new TaskBlocking; } /*************************************************************************** Helper function to initialise neo components. Automatically calls addNodes() with the node definition files specified in the Config instance. Params: config = swarm.neo.client.mixins.ClientCore.Config instance. (The config class is designed to be read from an application's config.ini file via ocean.util.config.ConfigFiller). conn_notifier = delegate which is called when a connection attempt succeeds or fails (including when a connection is re-established). Of type: void delegate ( IPAddress node_address, Exception e ) ***************************************************************************/ private void neoInit ( Neo.Config config, scope Neo.ConnectionNotifier conn_notifier ) { this.neo = new Neo(config, Neo.Settings(conn_notifier, new SharedResources(this.epoll))); this.blocking = new TaskBlocking; } }
D
# FIXED wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/blefi/wifi/wifi.c wifi/wifi.obj: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/stdlib.h wifi/wifi.obj: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/linkage.h wifi/wifi.obj: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/string.h wifi/wifi.obj: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/stdbool.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/blefi/include/datatypes.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/common/uart_if.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/simplelink.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/../user.h wifi/wifi.obj: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/string.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/../cc_pal.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/oslib/osi.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/../source/objInclusion.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/simplelink.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/trace.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/fs.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/socket.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/netapp.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/wlan.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/device.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/netcfg.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/wlan_rx_filters.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/../source/spawn.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/netcfg.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/inc/hw_ints.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/inc/hw_types.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/inc/hw_memmap.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/inc/hw_common_reg.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/driverlib/interrupt.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/driverlib/utils.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/driverlib/rom.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/driverlib/rom_map.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/driverlib/rom_patch.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/driverlib/prcm.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/driverlib/pin.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/blefi/blefi_gpio_if.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/common/common.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/driverlib/gpio.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/blefi/wifi/include/device_status.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/blefi/wifi/include/smartconfig.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/blefi/pinmux.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/wlan.h wifi/wifi.obj: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/blefi/cc3200.h C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/blefi/wifi/wifi.c: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/stdlib.h: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/linkage.h: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/string.h: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/stdbool.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/blefi/include/datatypes.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/common/uart_if.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/simplelink.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/../user.h: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include/string.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/../cc_pal.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/oslib/osi.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/../source/objInclusion.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/simplelink.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/trace.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/fs.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/socket.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/netapp.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/wlan.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/device.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/netcfg.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/wlan_rx_filters.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/../source/spawn.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/netcfg.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/inc/hw_ints.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/inc/hw_types.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/inc/hw_memmap.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/inc/hw_common_reg.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/driverlib/interrupt.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/driverlib/utils.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/driverlib/rom.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/driverlib/rom_map.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/driverlib/rom_patch.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/driverlib/prcm.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/driverlib/pin.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/blefi/blefi_gpio_if.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/common/common.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/driverlib/gpio.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/blefi/wifi/include/device_status.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/blefi/wifi/include/smartconfig.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/blefi/pinmux.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/simplelink/include/wlan.h: C:/ti/BleToWifiGateway_1.0.0_20_oct_16/src/example/blefi/cc3200.h:
D
/Users/liujianhao/code/rust/simple_web_app/simple_web_app/target/rls/debug/deps/parking_lot-85336a1d7e0d4bce.rmeta: /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/lib.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/condvar.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/elision.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/mutex.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/once.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/raw_mutex.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/raw_rwlock.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/remutex.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/rwlock.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/util.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/deadlock.rs /Users/liujianhao/code/rust/simple_web_app/simple_web_app/target/rls/debug/deps/parking_lot-85336a1d7e0d4bce.d: /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/lib.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/condvar.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/elision.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/mutex.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/once.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/raw_mutex.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/raw_rwlock.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/remutex.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/rwlock.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/util.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/deadlock.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/lib.rs: /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/condvar.rs: /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/elision.rs: /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/mutex.rs: /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/once.rs: /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/raw_mutex.rs: /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/raw_rwlock.rs: /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/remutex.rs: /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/rwlock.rs: /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/util.rs: /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/parking_lot-0.9.0/src/deadlock.rs:
D
/* Boost Software License - Version 1.0 - August 17th, 2003 Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following: The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ module minexewgames.di.annotations; import minexewgames.di.diag; import std.conv; import std.traits; class Autocreated { static void annotatedMemberInjection(InstanceManager, Class, T) (Class instance, string memberName, T* field) { diagprint("@Autocreated field " ~ to!string(typeid(T)) ~ " " ~ to!string(typeid(Class)) ~ "." ~ memberName); *field = InstanceManager.InstanceCreator.createInstance!T(); } } class Autowired { static void annotatedMemberInjection(InstanceManager, Class, T) (Class instance, string memberName, T* field) { diagprint("@Autowired field " ~ to!string(typeid(T)) ~ " " ~ to!string(typeid(Class)) ~ "." ~ memberName); *field = InstanceManager.get!T(); } /*static void annotatedMemberInjection(InstanceManager, Class, T) (Class instance, string memberName, T delegate() creator) { infoprint("@Autowired creator " ~ to!string(typeid(T)) ~ " " ~ to!string(typeid(Class)) ~ "." ~ memberName); InstanceManager.inject(creator, false); } static void annotatedMemberInjection(InstanceManager, Class, T) (Class instance, string memberName, T function() creator) { infoprint("@Autowired creator " ~ to!string(typeid(T)) ~ " " ~ to!string(typeid(Class)) ~ "." ~ memberName); InstanceManager.inject(creator, false); }*/ } enum Initializer;
D
/home/Max/Documents/Classes/intro-to-compilers/rust-compiler/target/debug/build/serde-55883b3e75cdb344/build_script_build-55883b3e75cdb344: /home/Max/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.90/build.rs /home/Max/Documents/Classes/intro-to-compilers/rust-compiler/target/debug/build/serde-55883b3e75cdb344/build_script_build-55883b3e75cdb344.d: /home/Max/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.90/build.rs /home/Max/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.90/build.rs:
D
/* * Copyright (c) 2004-2008 Derelict Developers * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the names 'Derelict', 'DerelictGL', nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ module derelict.opengl.extension.ext.texture_sRGB; private { import derelict.opengl.gltypes; import derelict.opengl.gl; import derelict.util.wrapper; } private bool enabled = false; struct EXTTextureSRGB { static bool load(char[] extString) { if(extString.findStr("GL_EXT_framebuffer_sRGB") == -1) return false; enabled = true; return true; } static bool isEnabled() { return enabled; } } version(DerelictGL_NoExtensionLoaders) { } else { static this() { DerelictGL.registerExtensionLoader(&EXTTextureSRGB.load); } } enum : GLenum { GL_SRGB_EXT = 0x8C40, GL_SRGB8_EXT = 0x8C41, GL_SRGB_ALPHA_EXT = 0x8C42, GL_SRGB8_ALPHA8_EXT = 0x8C43, GL_SLUMINANCE_ALPHA_EXT = 0x8C44, GL_SLUMINANCE8_ALPHA8_EXT = 0x8C45, GL_SLUMINANCE_EXT = 0x8C46, GL_SLUMINANCE8_EXT = 0x8C47, GL_COMPRESSED_SRGB_EXT = 0x8C48, GL_COMPRESSED_SRGB_ALPHA_EXT = 0x8C49, GL_COMPRESSED_SLUMINANCE_EXT = 0x8C4A, GL_COMPRESSED_SLUMINANCE_ALPHA_EXT = 0x8C4B, GL_COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8C4D, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F, }
D
a geological process in which one edge of a crustal plate is forced sideways and downward into the mantle below another plate
D
module org.eclipse.swt.all; public import org.eclipse.swt.SWT; public import org.eclipse.swt.SWTError; public import org.eclipse.swt.SWTException; public import org.eclipse.swt.accessibility.all; public import org.eclipse.swt.custom.all; public import org.eclipse.swt.dnd.all; public import org.eclipse.swt.events.all; public import org.eclipse.swt.graphics.all; public import org.eclipse.swt.layout.all; public import org.eclipse.swt.ole.all; //public import org.eclipse.swt.opengl.all; // dependent on existing bindings public import org.eclipse.swt.printing.all; public import org.eclipse.swt.program.all; public import org.eclipse.swt.widgets.all;
D
/Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/SQLite.build/Row/SQLiteData.swift.o : /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Row/SQLiteData.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteGeneric.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Utilities/Deprecated.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteBind.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Database/SQLiteStorage.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteCreateTable.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteTable.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteAlterTable.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteDataTypeStaticRepresentable.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteQueryExpressionRepresentable.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Row/SQLiteDataConvertible.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Row/SQLiteDataType.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Database/SQLiteDatabase.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Database/DatabaseIdentifier+SQLite.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteBoolLiteral.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteDefaultLiteral.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Row/SQLiteColumn.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteCollation.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Database/SQLiteConnection.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteFunction.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteAlterTableBuilder.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Codable/SQLiteDataDecoder.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Codable/SQLiteRowDecoder.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Codable/SQLiteDataEncoder.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Utilities/SQLiteError.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Utilities/Exports.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Database/SQLiteStatement.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteDropIndex.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLitePrimaryKey.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteQuery.swift /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/XPC.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/ObjectiveC.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Dispatch.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Darwin.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Foundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/CoreFoundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/CoreGraphics.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Swift.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/IOKit.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/SwiftOnoneSupport.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Combine.framework/Modules/Combine.swiftmodule/x86_64-apple-macos.swiftinterface /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/SQL.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/DatabaseKit.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio-zlib-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/SQLite.build/Row/SQLiteData~partial.swiftmodule : /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Row/SQLiteData.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteGeneric.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Utilities/Deprecated.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteBind.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Database/SQLiteStorage.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteCreateTable.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteTable.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteAlterTable.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteDataTypeStaticRepresentable.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteQueryExpressionRepresentable.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Row/SQLiteDataConvertible.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Row/SQLiteDataType.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Database/SQLiteDatabase.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Database/DatabaseIdentifier+SQLite.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteBoolLiteral.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteDefaultLiteral.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Row/SQLiteColumn.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteCollation.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Database/SQLiteConnection.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteFunction.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteAlterTableBuilder.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Codable/SQLiteDataDecoder.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Codable/SQLiteRowDecoder.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Codable/SQLiteDataEncoder.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Utilities/SQLiteError.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Utilities/Exports.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Database/SQLiteStatement.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteDropIndex.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLitePrimaryKey.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteQuery.swift /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/XPC.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/ObjectiveC.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Dispatch.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Darwin.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Foundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/CoreFoundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/CoreGraphics.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Swift.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/IOKit.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/SwiftOnoneSupport.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Combine.framework/Modules/Combine.swiftmodule/x86_64-apple-macos.swiftinterface /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/SQL.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/DatabaseKit.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio-zlib-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/SQLite.build/Row/SQLiteData~partial.swiftdoc : /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Row/SQLiteData.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteGeneric.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Utilities/Deprecated.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteBind.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Database/SQLiteStorage.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteCreateTable.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteTable.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteAlterTable.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteDataTypeStaticRepresentable.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteQueryExpressionRepresentable.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Row/SQLiteDataConvertible.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Row/SQLiteDataType.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Database/SQLiteDatabase.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Database/DatabaseIdentifier+SQLite.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteBoolLiteral.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteDefaultLiteral.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Row/SQLiteColumn.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteCollation.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Database/SQLiteConnection.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteFunction.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteAlterTableBuilder.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Codable/SQLiteDataDecoder.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Codable/SQLiteRowDecoder.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Codable/SQLiteDataEncoder.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Utilities/SQLiteError.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Utilities/Exports.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/Database/SQLiteStatement.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteDropIndex.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLitePrimaryKey.swift /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/sqlite/Sources/SQLite/SQL/SQLiteQuery.swift /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/XPC.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/ObjectiveC.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Dispatch.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Darwin.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Foundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/CoreFoundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/CoreGraphics.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/Swift.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/IOKit.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/SwiftOnoneSupport.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Combine.framework/Modules/Combine.swiftmodule/x86_64-apple-macos.swiftinterface /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/SQL.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/DatabaseKit.swiftmodule /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/weirujian/Desktop/WeiRuJian/Vapor/AuthServer/.build/checkouts/swift-nio-zlib-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
/Users/macosx/Desktop/TestNetWorkLayer/build/Pods.build/Debug-iphonesimulator/Quick.build/Objects-normal/x86_64/String+C99ExtendedIdentifier.o : /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/DSL/World+DSL.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/DSL/DSL.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/ExampleMetadata.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/World.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Example.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/URL+FileName.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Hooks/HooksPhase.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Callsite.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/QuickTestSuite.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Configuration/Configuration.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Configuration/QuickConfiguration.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/ExampleGroup.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/String+C99ExtendedIdentifier.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Filter.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Behavior.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Hooks/Closures.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Hooks/ExampleHooks.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Hooks/SuiteHooks.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/ErrorUtility.swift /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/ObjectiveC.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/CoreImage.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/QuartzCore.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/Dispatch.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/Metal.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/Darwin.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/Foundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/CoreFoundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/CoreGraphics.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/Swift.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/UIKit.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/SwiftOnoneSupport.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/Combine.framework/Modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.h /Users/macosx/Desktop/TestNetWorkLayer/Pods/Target\ Support\ Files/Quick/Quick-umbrella.h /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/QuickObjectiveC/QuickSpec.h /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/QuickObjectiveC/Quick.h /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.h /Users/macosx/Desktop/TestNetWorkLayer/build/Pods.build/Debug-iphonesimulator/Quick.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework/Modules/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework/Headers/XCTest.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/macosx/Desktop/TestNetWorkLayer/build/Pods.build/Debug-iphonesimulator/Quick.build/Objects-normal/x86_64/String+C99ExtendedIdentifier~partial.swiftmodule : /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/DSL/World+DSL.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/DSL/DSL.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/ExampleMetadata.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/World.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Example.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/URL+FileName.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Hooks/HooksPhase.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Callsite.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/QuickTestSuite.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Configuration/Configuration.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Configuration/QuickConfiguration.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/ExampleGroup.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/String+C99ExtendedIdentifier.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Filter.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Behavior.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Hooks/Closures.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Hooks/ExampleHooks.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Hooks/SuiteHooks.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/ErrorUtility.swift /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/ObjectiveC.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/CoreImage.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/QuartzCore.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/Dispatch.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/Metal.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/Darwin.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/Foundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/CoreFoundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/CoreGraphics.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/Swift.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/UIKit.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/SwiftOnoneSupport.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/Combine.framework/Modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.h /Users/macosx/Desktop/TestNetWorkLayer/Pods/Target\ Support\ Files/Quick/Quick-umbrella.h /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/QuickObjectiveC/QuickSpec.h /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/QuickObjectiveC/Quick.h /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.h /Users/macosx/Desktop/TestNetWorkLayer/build/Pods.build/Debug-iphonesimulator/Quick.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework/Modules/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework/Headers/XCTest.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes /Users/macosx/Desktop/TestNetWorkLayer/build/Pods.build/Debug-iphonesimulator/Quick.build/Objects-normal/x86_64/String+C99ExtendedIdentifier~partial.swiftdoc : /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/DSL/World+DSL.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/DSL/DSL.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/ExampleMetadata.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/World.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Example.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/URL+FileName.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Hooks/HooksPhase.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Callsite.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/QuickTestSuite.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Configuration/Configuration.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Configuration/QuickConfiguration.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/ExampleGroup.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/String+C99ExtendedIdentifier.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Filter.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Behavior.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Hooks/Closures.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Hooks/ExampleHooks.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/Hooks/SuiteHooks.swift /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/Quick/ErrorUtility.swift /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/ObjectiveC.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/CoreImage.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/QuartzCore.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/Dispatch.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/Metal.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/Darwin.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/Foundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/CoreFoundation.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/CoreGraphics.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/Swift.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/UIKit.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/lib/swift/SwiftOnoneSupport.swiftmodule/x86_64.swiftinterface /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/Combine.framework/Modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftinterface /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.h /Users/macosx/Desktop/TestNetWorkLayer/Pods/Target\ Support\ Files/Quick/Quick-umbrella.h /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/QuickObjectiveC/QuickSpec.h /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/QuickObjectiveC/Quick.h /Users/macosx/Desktop/TestNetWorkLayer/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.h /Users/macosx/Desktop/TestNetWorkLayer/build/Pods.build/Debug-iphonesimulator/Quick.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework/Modules/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework/Headers/XCTest.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
D
/** * The osthread module provides low-level, OS-dependent code * for thread creation and management. * * Copyright: Copyright Sean Kelly 2005 - 2012. * License: Distributed under the * $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0). * (See accompanying file LICENSE) * Authors: Sean Kelly, Walter Bright, Alex Rønne Petersen, Martin Nowak * Source: $(DRUNTIMESRC core/thread/osthread.d) */ module core.thread.osthread; import core.thread.threadbase; import core.thread.context; import core.thread.types; import core.atomic; import core.memory : GC; import core.time; import core.exception : onOutOfMemoryError; import core.internal.traits : externDFunc; /////////////////////////////////////////////////////////////////////////////// // Platform Detection and Memory Allocation /////////////////////////////////////////////////////////////////////////////// version (OSX) version = Darwin; else version (iOS) version = Darwin; else version (TVOS) version = Darwin; else version (WatchOS) version = Darwin; version (D_InlineAsm_X86) { version (Windows) version = AsmX86_Windows; else version (Posix) version = AsmX86_Posix; } else version (D_InlineAsm_X86_64) { version (Windows) { version = AsmX86_64_Windows; } else version (Posix) { version = AsmX86_64_Posix; } } version (Posix) { version (AsmX86_Windows) {} else version (AsmX86_Posix) {} else version (AsmX86_64_Windows) {} else version (AsmX86_64_Posix) {} else version (AsmExternal) {} else { // NOTE: The ucontext implementation requires architecture specific // data definitions to operate so testing for it must be done // by checking for the existence of ucontext_t rather than by // a version identifier. Please note that this is considered // an obsolescent feature according to the POSIX spec, so a // custom solution is still preferred. import core.sys.posix.ucontext; } } version (Windows) { import core.stdc.stdint : uintptr_t; // for _beginthreadex decl below import core.stdc.stdlib; // for malloc, atexit import core.sys.windows.basetsd /+: HANDLE+/; import core.sys.windows.threadaux /+: getThreadStackBottom, impersonate_thread, OpenThreadHandle+/; import core.sys.windows.winbase /+: CloseHandle, CREATE_SUSPENDED, DuplicateHandle, GetCurrentThread, GetCurrentThreadId, GetCurrentProcess, GetExitCodeThread, GetSystemInfo, GetThreadContext, GetThreadPriority, INFINITE, ResumeThread, SetThreadPriority, Sleep, STILL_ACTIVE, SuspendThread, SwitchToThread, SYSTEM_INFO, THREAD_PRIORITY_IDLE, THREAD_PRIORITY_NORMAL, THREAD_PRIORITY_TIME_CRITICAL, WAIT_OBJECT_0, WaitForSingleObject+/; import core.sys.windows.windef /+: TRUE+/; import core.sys.windows.winnt /+: CONTEXT, CONTEXT_CONTROL, CONTEXT_INTEGER+/; private extern (Windows) alias btex_fptr = uint function(void*); private extern (C) uintptr_t _beginthreadex(void*, uint, btex_fptr, void*, uint, uint*) nothrow @nogc; } else version (Posix) { import core.stdc.errno; import core.sys.posix.semaphore; import core.sys.posix.stdlib; // for malloc, valloc, free, atexit import core.sys.posix.pthread; import core.sys.posix.signal; import core.sys.posix.time; version (Darwin) { import core.sys.darwin.mach.thread_act; import core.sys.darwin.pthread : pthread_mach_thread_np; } } version (Solaris) { import core.sys.solaris.sys.priocntl; import core.sys.solaris.sys.types; import core.sys.posix.sys.wait : idtype_t; } version (GNU) { import gcc.builtins; } /** * Hook for whatever EH implementation is used to save/restore some data * per stack. * * Params: * newContext = The return value of the prior call to this function * where the stack was last swapped out, or null when a fiber stack * is switched in for the first time. */ private extern(C) void* _d_eh_swapContext(void* newContext) nothrow @nogc; version (DigitalMars) { version (Windows) { extern(D) void* swapContext(void* newContext) nothrow @nogc { return _d_eh_swapContext(newContext); } } else { extern(C) void* _d_eh_swapContextDwarf(void* newContext) nothrow @nogc; extern(D) void* swapContext(void* newContext) nothrow @nogc { /* Detect at runtime which scheme is being used. * Eventually, determine it statically. */ static int which = 0; final switch (which) { case 0: { assert(newContext == null); auto p = _d_eh_swapContext(newContext); auto pdwarf = _d_eh_swapContextDwarf(newContext); if (p) { which = 1; return p; } else if (pdwarf) { which = 2; return pdwarf; } return null; } case 1: return _d_eh_swapContext(newContext); case 2: return _d_eh_swapContextDwarf(newContext); } } } } else { extern(D) void* swapContext(void* newContext) nothrow @nogc { return _d_eh_swapContext(newContext); } } /////////////////////////////////////////////////////////////////////////////// // Thread /////////////////////////////////////////////////////////////////////////////// /** * This class encapsulates all threading functionality for the D * programming language. As thread manipulation is a required facility * for garbage collection, all user threads should derive from this * class, and instances of this class should never be explicitly deleted. * A new thread may be created using either derivation or composition, as * in the following example. */ class Thread : ThreadBase { // // Standard thread data // version (Windows) { private HANDLE m_hndl; } version (Posix) { private shared bool m_isRunning; } version (Darwin) { private mach_port_t m_tmach; } version (Solaris) { private __gshared bool m_isRTClass; } // // Standard types // version (Windows) { alias TLSKey = uint; } else version (Posix) { alias TLSKey = pthread_key_t; } /////////////////////////////////////////////////////////////////////////// // Initialization /////////////////////////////////////////////////////////////////////////// /** * Initializes a thread object which is associated with a static * D function. * * Params: * fn = The thread function. * sz = The stack size for this thread. * * In: * fn must not be null. */ this( void function() fn, size_t sz = 0 ) @safe pure nothrow @nogc { super(fn, sz); } /** * Initializes a thread object which is associated with a dynamic * D function. * * Params: * dg = The thread function. * sz = The stack size for this thread. * * In: * dg must not be null. */ this( void delegate() dg, size_t sz = 0 ) @safe pure nothrow @nogc { super(dg, sz); } package this( size_t sz = 0 ) @safe pure nothrow @nogc { super(sz); } /** * Cleans up any remaining resources used by this object. */ ~this() nothrow @nogc { if (super.destructBeforeDtor()) return; version (Windows) { m_addr = m_addr.init; CloseHandle( m_hndl ); m_hndl = m_hndl.init; } else version (Posix) { if (m_addr != m_addr.init) pthread_detach( m_addr ); m_addr = m_addr.init; } version (Darwin) { m_tmach = m_tmach.init; } } // // Thread entry point. Invokes the function or delegate passed on // construction (if any). // private final void run() { super.run(); } /** * Provides a reference to the calling thread. * * Returns: * The thread object representing the calling thread. The result of * deleting this object is undefined. If the current thread is not * attached to the runtime, a null reference is returned. */ static Thread getThis() @safe nothrow @nogc { return ThreadBase.getThis().toThread; } /////////////////////////////////////////////////////////////////////////// // Thread Context and GC Scanning Support /////////////////////////////////////////////////////////////////////////// version (Windows) { version (X86) { uint[8] m_reg; // edi,esi,ebp,esp,ebx,edx,ecx,eax } else version (X86_64) { ulong[16] m_reg; // rdi,rsi,rbp,rsp,rbx,rdx,rcx,rax // r8,r9,r10,r11,r12,r13,r14,r15 } else { static assert(false, "Architecture not supported." ); } } else version (Darwin) { version (X86) { uint[8] m_reg; // edi,esi,ebp,esp,ebx,edx,ecx,eax } else version (X86_64) { ulong[16] m_reg; // rdi,rsi,rbp,rsp,rbx,rdx,rcx,rax // r8,r9,r10,r11,r12,r13,r14,r15 } else version (AArch64) { ulong[33] m_reg; // x0-x31, pc } else version (ARM) { uint[16] m_reg; // r0-r15 } else version (PPC) { // Make the assumption that we only care about non-fp and non-vr regs. // ??? : it seems plausible that a valid address can be copied into a VR. uint[32] m_reg; // r0-31 } else version (PPC64) { // As above. ulong[32] m_reg; // r0-31 } else { static assert(false, "Architecture not supported." ); } } /////////////////////////////////////////////////////////////////////////// // General Actions /////////////////////////////////////////////////////////////////////////// /** * Starts the thread and invokes the function or delegate passed upon * construction. * * In: * This routine may only be called once per thread instance. * * Throws: * ThreadException if the thread fails to start. */ final Thread start() nothrow in { assert( !next && !prev ); } do { auto wasThreaded = multiThreadedFlag; multiThreadedFlag = true; scope( failure ) { if ( !wasThreaded ) multiThreadedFlag = false; } version (Windows) {} else version (Posix) { size_t stksz = adjustStackSize( m_sz ); pthread_attr_t attr; if ( pthread_attr_init( &attr ) ) onThreadError( "Error initializing thread attributes" ); if ( stksz && pthread_attr_setstacksize( &attr, stksz ) ) onThreadError( "Error initializing thread stack size" ); } version (Windows) { // NOTE: If a thread is just executing DllMain() // while another thread is started here, it holds an OS internal // lock that serializes DllMain with CreateThread. As the code // might request a synchronization on slock (e.g. in thread_findByAddr()), // we cannot hold that lock while creating the thread without // creating a deadlock // // Solution: Create the thread in suspended state and then // add and resume it with slock acquired assert(m_sz <= uint.max, "m_sz must be less than or equal to uint.max"); m_hndl = cast(HANDLE) _beginthreadex( null, cast(uint) m_sz, &thread_entryPoint, cast(void*) this, CREATE_SUSPENDED, &m_addr ); if ( cast(size_t) m_hndl == 0 ) onThreadError( "Error creating thread" ); } slock.lock_nothrow(); scope(exit) slock.unlock_nothrow(); { ++nAboutToStart; pAboutToStart = cast(ThreadBase*)realloc(pAboutToStart, Thread.sizeof * nAboutToStart); pAboutToStart[nAboutToStart - 1] = this; version (Windows) { if ( ResumeThread( m_hndl ) == -1 ) onThreadError( "Error resuming thread" ); } else version (Posix) { // NOTE: This is also set to true by thread_entryPoint, but set it // here as well so the calling thread will see the isRunning // state immediately. atomicStore!(MemoryOrder.raw)(m_isRunning, true); scope( failure ) atomicStore!(MemoryOrder.raw)(m_isRunning, false); version (Shared) { auto libs = externDFunc!("rt.sections_elf_shared.pinLoadedLibraries", void* function() @nogc nothrow)(); auto ps = cast(void**).malloc(2 * size_t.sizeof); if (ps is null) onOutOfMemoryError(); ps[0] = cast(void*)this; ps[1] = cast(void*)libs; if ( pthread_create( &m_addr, &attr, &thread_entryPoint, ps ) != 0 ) { externDFunc!("rt.sections_elf_shared.unpinLoadedLibraries", void function(void*) @nogc nothrow)(libs); .free(ps); onThreadError( "Error creating thread" ); } } else { if ( pthread_create( &m_addr, &attr, &thread_entryPoint, cast(void*) this ) != 0 ) onThreadError( "Error creating thread" ); } if ( pthread_attr_destroy( &attr ) != 0 ) onThreadError( "Error destroying thread attributes" ); } version (Darwin) { m_tmach = pthread_mach_thread_np( m_addr ); if ( m_tmach == m_tmach.init ) onThreadError( "Error creating thread" ); } return this; } } /** * Waits for this thread to complete. If the thread terminated as the * result of an unhandled exception, this exception will be rethrown. * * Params: * rethrow = Rethrow any unhandled exception which may have caused this * thread to terminate. * * Throws: * ThreadException if the operation fails. * Any exception not handled by the joined thread. * * Returns: * Any exception not handled by this thread if rethrow = false, null * otherwise. */ override final Throwable join( bool rethrow = true ) { version (Windows) { if ( m_addr != m_addr.init && WaitForSingleObject( m_hndl, INFINITE ) != WAIT_OBJECT_0 ) throw new ThreadException( "Unable to join thread" ); // NOTE: m_addr must be cleared before m_hndl is closed to avoid // a race condition with isRunning. The operation is done // with atomicStore to prevent compiler reordering. atomicStore!(MemoryOrder.raw)(*cast(shared)&m_addr, m_addr.init); CloseHandle( m_hndl ); m_hndl = m_hndl.init; } else version (Posix) { if ( m_addr != m_addr.init && pthread_join( m_addr, null ) != 0 ) throw new ThreadException( "Unable to join thread" ); // NOTE: pthread_join acts as a substitute for pthread_detach, // which is normally called by the dtor. Setting m_addr // to zero ensures that pthread_detach will not be called // on object destruction. m_addr = m_addr.init; } if ( m_unhandled ) { if ( rethrow ) throw m_unhandled; return m_unhandled; } return null; } /////////////////////////////////////////////////////////////////////////// // Thread Priority Actions /////////////////////////////////////////////////////////////////////////// version (Windows) { @property static int PRIORITY_MIN() @nogc nothrow pure @safe { return THREAD_PRIORITY_IDLE; } @property static const(int) PRIORITY_MAX() @nogc nothrow pure @safe { return THREAD_PRIORITY_TIME_CRITICAL; } @property static int PRIORITY_DEFAULT() @nogc nothrow pure @safe { return THREAD_PRIORITY_NORMAL; } } else { private struct Priority { int PRIORITY_MIN = int.min; int PRIORITY_DEFAULT = int.min; int PRIORITY_MAX = int.min; } /* Lazily loads one of the members stored in a hidden global variable of type `Priority`. Upon the first access of either member, the entire `Priority` structure is initialized. Multiple initializations from different threads calling this function are tolerated. `which` must be one of `PRIORITY_MIN`, `PRIORITY_DEFAULT`, `PRIORITY_MAX`. */ private static shared Priority cache; private static int loadGlobal(string which)() { auto local = atomicLoad(mixin("cache." ~ which)); if (local != local.min) return local; // There will be benign races cache = loadPriorities; return atomicLoad(mixin("cache." ~ which)); } /* Loads all priorities and returns them as a `Priority` structure. This function is thread-neutral. */ private static Priority loadPriorities() @nogc nothrow @trusted { Priority result; version (Solaris) { pcparms_t pcParms; pcinfo_t pcInfo; pcParms.pc_cid = PC_CLNULL; if (priocntl(idtype_t.P_PID, P_MYID, PC_GETPARMS, &pcParms) == -1) assert( 0, "Unable to get scheduling class" ); pcInfo.pc_cid = pcParms.pc_cid; // PC_GETCLINFO ignores the first two args, use dummy values if (priocntl(idtype_t.P_PID, 0, PC_GETCLINFO, &pcInfo) == -1) assert( 0, "Unable to get scheduling class info" ); pri_t* clparms = cast(pri_t*)&pcParms.pc_clparms; pri_t* clinfo = cast(pri_t*)&pcInfo.pc_clinfo; result.PRIORITY_MAX = clparms[0]; if (pcInfo.pc_clname == "RT") { m_isRTClass = true; // For RT class, just assume it can't be changed result.PRIORITY_MIN = clparms[0]; result.PRIORITY_DEFAULT = clparms[0]; } else { m_isRTClass = false; // For all other scheduling classes, there are // two key values -- uprilim and maxupri. // maxupri is the maximum possible priority defined // for the scheduling class, and valid priorities // range are in [-maxupri, maxupri]. // // However, uprilim is an upper limit that the // current thread can set for the current scheduling // class, which can be less than maxupri. As such, // use this value for priorityMax since this is // the effective maximum. // maxupri result.PRIORITY_MIN = -cast(int)(clinfo[0]); // by definition result.PRIORITY_DEFAULT = 0; } } else version (Posix) { int policy; sched_param param; pthread_getschedparam( pthread_self(), &policy, &param ) == 0 || assert(0, "Internal error in pthread_getschedparam"); result.PRIORITY_MIN = sched_get_priority_min( policy ); result.PRIORITY_MIN != -1 || assert(0, "Internal error in sched_get_priority_min"); result.PRIORITY_DEFAULT = param.sched_priority; result.PRIORITY_MAX = sched_get_priority_max( policy ); result.PRIORITY_MAX != -1 || assert(0, "Internal error in sched_get_priority_max"); } else { static assert(0, "Your code here."); } return result; } /** * The minimum scheduling priority that may be set for a thread. On * systems where multiple scheduling policies are defined, this value * represents the minimum valid priority for the scheduling policy of * the process. */ @property static int PRIORITY_MIN() @nogc nothrow pure @trusted { return (cast(int function() @nogc nothrow pure @safe) &loadGlobal!"PRIORITY_MIN")(); } /** * The maximum scheduling priority that may be set for a thread. On * systems where multiple scheduling policies are defined, this value * represents the maximum valid priority for the scheduling policy of * the process. */ @property static const(int) PRIORITY_MAX() @nogc nothrow pure @trusted { return (cast(int function() @nogc nothrow pure @safe) &loadGlobal!"PRIORITY_MAX")(); } /** * The default scheduling priority that is set for a thread. On * systems where multiple scheduling policies are defined, this value * represents the default priority for the scheduling policy of * the process. */ @property static int PRIORITY_DEFAULT() @nogc nothrow pure @trusted { return (cast(int function() @nogc nothrow pure @safe) &loadGlobal!"PRIORITY_DEFAULT")(); } } version (NetBSD) { //NetBSD does not support priority for default policy // and it is not possible change policy without root access int fakePriority = int.max; } /** * Gets the scheduling priority for the associated thread. * * Note: Getting the priority of a thread that already terminated * might return the default priority. * * Returns: * The scheduling priority of this thread. */ final @property int priority() { version (Windows) { return GetThreadPriority( m_hndl ); } else version (NetBSD) { return fakePriority==int.max? PRIORITY_DEFAULT : fakePriority; } else version (Posix) { int policy; sched_param param; if (auto err = pthread_getschedparam(m_addr, &policy, &param)) { // ignore error if thread is not running => Bugzilla 8960 if (!atomicLoad(m_isRunning)) return PRIORITY_DEFAULT; throw new ThreadException("Unable to get thread priority"); } return param.sched_priority; } } /** * Sets the scheduling priority for the associated thread. * * Note: Setting the priority of a thread that already terminated * might have no effect. * * Params: * val = The new scheduling priority of this thread. */ final @property void priority( int val ) in { assert(val >= PRIORITY_MIN); assert(val <= PRIORITY_MAX); } do { version (Windows) { if ( !SetThreadPriority( m_hndl, val ) ) throw new ThreadException( "Unable to set thread priority" ); } else version (Solaris) { // the pthread_setschedprio(3c) and pthread_setschedparam functions // are broken for the default (TS / time sharing) scheduling class. // instead, we use priocntl(2) which gives us the desired behavior. // We hardcode the min and max priorities to the current value // so this is a no-op for RT threads. if (m_isRTClass) return; pcparms_t pcparm; pcparm.pc_cid = PC_CLNULL; if (priocntl(idtype_t.P_LWPID, P_MYID, PC_GETPARMS, &pcparm) == -1) throw new ThreadException( "Unable to get scheduling class" ); pri_t* clparms = cast(pri_t*)&pcparm.pc_clparms; // clparms is filled in by the PC_GETPARMS call, only necessary // to adjust the element that contains the thread priority clparms[1] = cast(pri_t) val; if (priocntl(idtype_t.P_LWPID, P_MYID, PC_SETPARMS, &pcparm) == -1) throw new ThreadException( "Unable to set scheduling class" ); } else version (NetBSD) { fakePriority = val; } else version (Posix) { static if (__traits(compiles, pthread_setschedprio)) { if (auto err = pthread_setschedprio(m_addr, val)) { // ignore error if thread is not running => Bugzilla 8960 if (!atomicLoad(m_isRunning)) return; throw new ThreadException("Unable to set thread priority"); } } else { // NOTE: pthread_setschedprio is not implemented on Darwin, FreeBSD, OpenBSD, // or DragonFlyBSD, so use the more complicated get/set sequence below. int policy; sched_param param; if (auto err = pthread_getschedparam(m_addr, &policy, &param)) { // ignore error if thread is not running => Bugzilla 8960 if (!atomicLoad(m_isRunning)) return; throw new ThreadException("Unable to set thread priority"); } param.sched_priority = val; if (auto err = pthread_setschedparam(m_addr, policy, &param)) { // ignore error if thread is not running => Bugzilla 8960 if (!atomicLoad(m_isRunning)) return; throw new ThreadException("Unable to set thread priority"); } } } } unittest { auto thr = Thread.getThis(); immutable prio = thr.priority; scope (exit) thr.priority = prio; assert(prio == PRIORITY_DEFAULT); assert(prio >= PRIORITY_MIN && prio <= PRIORITY_MAX); thr.priority = PRIORITY_MIN; assert(thr.priority == PRIORITY_MIN); thr.priority = PRIORITY_MAX; assert(thr.priority == PRIORITY_MAX); } unittest // Bugzilla 8960 { import core.sync.semaphore; auto thr = new Thread({}); thr.start(); Thread.sleep(1.msecs); // wait a little so the thread likely has finished thr.priority = PRIORITY_MAX; // setting priority doesn't cause error auto prio = thr.priority; // getting priority doesn't cause error assert(prio >= PRIORITY_MIN && prio <= PRIORITY_MAX); } /** * Tests whether this thread is running. * * Returns: * true if the thread is running, false if not. */ override final @property bool isRunning() nothrow @nogc { if (!super.isRunning()) return false; version (Windows) { uint ecode = 0; GetExitCodeThread( m_hndl, &ecode ); return ecode == STILL_ACTIVE; } else version (Posix) { return atomicLoad(m_isRunning); } } /////////////////////////////////////////////////////////////////////////// // Actions on Calling Thread /////////////////////////////////////////////////////////////////////////// /** * Suspends the calling thread for at least the supplied period. This may * result in multiple OS calls if period is greater than the maximum sleep * duration supported by the operating system. * * Params: * val = The minimum duration the calling thread should be suspended. * * In: * period must be non-negative. * * Example: * ------------------------------------------------------------------------ * * Thread.sleep( dur!("msecs")( 50 ) ); // sleep for 50 milliseconds * Thread.sleep( dur!("seconds")( 5 ) ); // sleep for 5 seconds * * ------------------------------------------------------------------------ */ static void sleep( Duration val ) @nogc nothrow in { assert( !val.isNegative ); } do { version (Windows) { auto maxSleepMillis = dur!("msecs")( uint.max - 1 ); // avoid a non-zero time to be round down to 0 if ( val > dur!"msecs"( 0 ) && val < dur!"msecs"( 1 ) ) val = dur!"msecs"( 1 ); // NOTE: In instances where all other threads in the process have a // lower priority than the current thread, the current thread // will not yield with a sleep time of zero. However, unlike // yield(), the user is not asking for a yield to occur but // only for execution to suspend for the requested interval. // Therefore, expected performance may not be met if a yield // is forced upon the user. while ( val > maxSleepMillis ) { Sleep( cast(uint) maxSleepMillis.total!"msecs" ); val -= maxSleepMillis; } Sleep( cast(uint) val.total!"msecs" ); } else version (Posix) { timespec tin = void; timespec tout = void; val.split!("seconds", "nsecs")(tin.tv_sec, tin.tv_nsec); if ( val.total!"seconds" > tin.tv_sec.max ) tin.tv_sec = tin.tv_sec.max; while ( true ) { if ( !nanosleep( &tin, &tout ) ) return; if ( errno != EINTR ) assert(0, "Unable to sleep for the specified duration"); tin = tout; } } } /** * Forces a context switch to occur away from the calling thread. */ static void yield() @nogc nothrow { version (Windows) SwitchToThread(); else version (Posix) sched_yield(); } } private Thread toThread(return scope ThreadBase t) @trusted nothrow @nogc pure { return cast(Thread) cast(void*) t; } private extern(D) static void thread_yield() @nogc nothrow { Thread.yield(); } /// unittest { class DerivedThread : Thread { this() { super(&run); } private: void run() { // Derived thread running. } } void threadFunc() { // Composed thread running. } // create and start instances of each type auto derived = new DerivedThread().start(); auto composed = new Thread(&threadFunc).start(); new Thread({ // Codes to run in the newly created thread. }).start(); } unittest { int x = 0; new Thread( { x++; }).start().join(); assert( x == 1 ); } unittest { enum MSG = "Test message."; string caughtMsg; try { new Thread( function() { throw new Exception( MSG ); }).start().join(); assert( false, "Expected rethrown exception." ); } catch ( Throwable t ) { assert( t.msg == MSG ); } } unittest { // use >PAGESIZE to avoid stack overflow (e.g. in an syscall) auto thr = new Thread(function{}, 4096 + 1).start(); thr.join(); } unittest { import core.memory : GC; auto t1 = new Thread({ foreach (_; 0 .. 20) ThreadBase.getAll; }).start; auto t2 = new Thread({ foreach (_; 0 .. 20) GC.collect; }).start; t1.join(); t2.join(); } unittest { import core.sync.semaphore; auto sem = new Semaphore(); auto t = new Thread( { sem.notify(); Thread.sleep(100.msecs); }).start(); sem.wait(); // thread cannot be detached while being started thread_detachInstance(t); foreach (t2; Thread) assert(t !is t2); t.join(); } unittest { // NOTE: This entire test is based on the assumption that no // memory is allocated after the child thread is // started. If an allocation happens, a collection could // trigger, which would cause the synchronization below // to cause a deadlock. // NOTE: DO NOT USE LOCKS IN CRITICAL REGIONS IN NORMAL CODE. import core.sync.semaphore; auto sema = new Semaphore(), semb = new Semaphore(); auto thr = new Thread( { thread_enterCriticalRegion(); assert(thread_inCriticalRegion()); sema.notify(); semb.wait(); assert(thread_inCriticalRegion()); thread_exitCriticalRegion(); assert(!thread_inCriticalRegion()); sema.notify(); semb.wait(); assert(!thread_inCriticalRegion()); }); thr.start(); sema.wait(); synchronized (ThreadBase.criticalRegionLock) assert(thr.m_isInCriticalRegion); semb.notify(); sema.wait(); synchronized (ThreadBase.criticalRegionLock) assert(!thr.m_isInCriticalRegion); semb.notify(); thr.join(); } // https://issues.dlang.org/show_bug.cgi?id=22124 unittest { Thread thread = new Thread({}); auto fun(Thread t, int x) { t.__ctor({x = 3;}); return t; } static assert(!__traits(compiles, () @nogc => fun(thread, 3) )); } unittest { import core.sync.semaphore; shared bool inCriticalRegion; auto sema = new Semaphore(), semb = new Semaphore(); auto thr = new Thread( { thread_enterCriticalRegion(); inCriticalRegion = true; sema.notify(); semb.wait(); Thread.sleep(dur!"msecs"(1)); inCriticalRegion = false; thread_exitCriticalRegion(); }); thr.start(); sema.wait(); assert(inCriticalRegion); semb.notify(); thread_suspendAll(); assert(!inCriticalRegion); thread_resumeAll(); } /////////////////////////////////////////////////////////////////////////////// // GC Support Routines /////////////////////////////////////////////////////////////////////////////// version (CoreDdoc) { /** * Instruct the thread module, when initialized, to use a different set of * signals besides SIGRTMIN and SIGRTMIN + 1 for suspension and resumption of threads. * This function should be called at most once, prior to thread_init(). * This function is Posix-only. */ extern (C) void thread_setGCSignals(int suspendSignalNo, int resumeSignalNo) nothrow @nogc { } } else version (Posix) { extern (C) void thread_setGCSignals(int suspendSignalNo, int resumeSignalNo) nothrow @nogc in { assert(suspendSignalNo != 0); assert(resumeSignalNo != 0); } out { assert(suspendSignalNumber != 0); assert(resumeSignalNumber != 0); } do { suspendSignalNumber = suspendSignalNo; resumeSignalNumber = resumeSignalNo; } } version (Posix) { private __gshared int suspendSignalNumber; private __gshared int resumeSignalNumber; } private extern (D) ThreadBase attachThread(ThreadBase _thisThread) @nogc nothrow { Thread thisThread = _thisThread.toThread(); StackContext* thisContext = &thisThread.m_main; assert( thisContext == thisThread.m_curr ); version (Windows) { thisThread.m_addr = GetCurrentThreadId(); thisThread.m_hndl = GetCurrentThreadHandle(); thisContext.bstack = getStackBottom(); thisContext.tstack = thisContext.bstack; } else version (Posix) { thisThread.m_addr = pthread_self(); thisContext.bstack = getStackBottom(); thisContext.tstack = thisContext.bstack; atomicStore!(MemoryOrder.raw)(thisThread.toThread.m_isRunning, true); } thisThread.m_isDaemon = true; thisThread.tlsGCdataInit(); Thread.setThis( thisThread ); version (Darwin) { thisThread.m_tmach = pthread_mach_thread_np( thisThread.m_addr ); assert( thisThread.m_tmach != thisThread.m_tmach.init ); } Thread.add( thisThread, false ); Thread.add( thisContext ); if ( Thread.sm_main !is null ) multiThreadedFlag = true; return thisThread; } /** * Registers the calling thread for use with the D Runtime. If this routine * is called for a thread which is already registered, no action is performed. * * NOTE: This routine does not run thread-local static constructors when called. * If full functionality as a D thread is desired, the following function * must be called after thread_attachThis: * * extern (C) void rt_moduleTlsCtor(); * * See_Also: * $(REF thread_detachThis, core,thread,threadbase) */ extern(C) Thread thread_attachThis() { return thread_attachThis_tpl!Thread(); } version (Windows) { // NOTE: These calls are not safe on Posix systems that use signals to // perform garbage collection. The suspendHandler uses getThis() // to get the thread handle so getThis() must be a simple call. // Mutexes can't safely be acquired inside signal handlers, and // even if they could, the mutex needed (Thread.slock) is held by // thread_suspendAll(). So in short, these routines will remain // Windows-specific. If they are truly needed elsewhere, the // suspendHandler will need a way to call a version of getThis() // that only does the TLS lookup without the fancy fallback stuff. /// ditto extern (C) Thread thread_attachByAddr( ThreadID addr ) { return thread_attachByAddrB( addr, getThreadStackBottom( addr ) ); } /// ditto extern (C) Thread thread_attachByAddrB( ThreadID addr, void* bstack ) { GC.disable(); scope(exit) GC.enable(); if (auto t = thread_findByAddr(addr).toThread) return t; Thread thisThread = new Thread(); StackContext* thisContext = &thisThread.m_main; assert( thisContext == thisThread.m_curr ); thisThread.m_addr = addr; thisContext.bstack = bstack; thisContext.tstack = thisContext.bstack; thisThread.m_isDaemon = true; if ( addr == GetCurrentThreadId() ) { thisThread.m_hndl = GetCurrentThreadHandle(); thisThread.tlsGCdataInit(); Thread.setThis( thisThread ); } else { thisThread.m_hndl = OpenThreadHandle( addr ); impersonate_thread(addr, { thisThread.tlsGCdataInit(); Thread.setThis( thisThread ); }); } Thread.add( thisThread, false ); Thread.add( thisContext ); if ( Thread.sm_main !is null ) multiThreadedFlag = true; return thisThread; } } // Calls the given delegate, passing the current thread's stack pointer to it. package extern(D) void callWithStackShell(scope callWithStackShellDg fn) nothrow in (fn) { // The purpose of the 'shell' is to ensure all the registers get // put on the stack so they'll be scanned. We only need to push // the callee-save registers. void *sp = void; version (GNU) { __builtin_unwind_init(); sp = &sp; } else version (AsmX86_Posix) { size_t[3] regs = void; asm pure nothrow @nogc { mov [regs + 0 * 4], EBX; mov [regs + 1 * 4], ESI; mov [regs + 2 * 4], EDI; mov sp[EBP], ESP; } } else version (AsmX86_Windows) { size_t[3] regs = void; asm pure nothrow @nogc { mov [regs + 0 * 4], EBX; mov [regs + 1 * 4], ESI; mov [regs + 2 * 4], EDI; mov sp[EBP], ESP; } } else version (AsmX86_64_Posix) { size_t[5] regs = void; asm pure nothrow @nogc { mov [regs + 0 * 8], RBX; mov [regs + 1 * 8], R12; mov [regs + 2 * 8], R13; mov [regs + 3 * 8], R14; mov [regs + 4 * 8], R15; mov sp[RBP], RSP; } } else version (AsmX86_64_Windows) { size_t[7] regs = void; asm pure nothrow @nogc { mov [regs + 0 * 8], RBX; mov [regs + 1 * 8], RSI; mov [regs + 2 * 8], RDI; mov [regs + 3 * 8], R12; mov [regs + 4 * 8], R13; mov [regs + 5 * 8], R14; mov [regs + 6 * 8], R15; mov sp[RBP], RSP; } } else { static assert(false, "Architecture not supported."); } fn(sp); } version (Windows) private extern (D) void scanWindowsOnly(scope ScanAllThreadsTypeFn scan, ThreadBase _t) nothrow { auto t = _t.toThread; scan( ScanType.stack, t.m_reg.ptr, t.m_reg.ptr + t.m_reg.length ); } /** * Returns the process ID of the calling process, which is guaranteed to be * unique on the system. This call is always successful. * * Example: * --- * writefln("Current process id: %s", getpid()); * --- */ version (Posix) { import core.sys.posix.unistd; alias getpid = core.sys.posix.unistd.getpid; } else version (Windows) { alias getpid = core.sys.windows.winbase.GetCurrentProcessId; } extern (C) @nogc nothrow { version (CRuntime_Glibc) version = PThread_Getattr_NP; version (CRuntime_Bionic) version = PThread_Getattr_NP; version (CRuntime_Musl) version = PThread_Getattr_NP; version (CRuntime_UClibc) version = PThread_Getattr_NP; version (FreeBSD) version = PThread_Attr_Get_NP; version (NetBSD) version = PThread_Attr_Get_NP; version (DragonFlyBSD) version = PThread_Attr_Get_NP; version (PThread_Getattr_NP) int pthread_getattr_np(pthread_t thread, pthread_attr_t* attr); version (PThread_Attr_Get_NP) int pthread_attr_get_np(pthread_t thread, pthread_attr_t* attr); version (Solaris) int thr_stksegment(stack_t* stk); version (OpenBSD) int pthread_stackseg_np(pthread_t thread, stack_t* sinfo); } package extern(D) void* getStackTop() nothrow @nogc { version (D_InlineAsm_X86) asm pure nothrow @nogc { naked; mov EAX, ESP; ret; } else version (D_InlineAsm_X86_64) asm pure nothrow @nogc { naked; mov RAX, RSP; ret; } else version (GNU) return __builtin_frame_address(0); else static assert(false, "Architecture not supported."); } package extern(D) void* getStackBottom() nothrow @nogc { version (Windows) { version (D_InlineAsm_X86) asm pure nothrow @nogc { naked; mov EAX, FS:4; ret; } else version (D_InlineAsm_X86_64) asm pure nothrow @nogc { naked; mov RAX, 8; mov RAX, GS:[RAX]; ret; } else static assert(false, "Architecture not supported."); } else version (Darwin) { import core.sys.darwin.pthread; return pthread_get_stackaddr_np(pthread_self()); } else version (PThread_Getattr_NP) { pthread_attr_t attr; void* addr; size_t size; pthread_attr_init(&attr); pthread_getattr_np(pthread_self(), &attr); pthread_attr_getstack(&attr, &addr, &size); pthread_attr_destroy(&attr); static if (isStackGrowingDown) addr += size; return addr; } else version (PThread_Attr_Get_NP) { pthread_attr_t attr; void* addr; size_t size; pthread_attr_init(&attr); pthread_attr_get_np(pthread_self(), &attr); pthread_attr_getstack(&attr, &addr, &size); pthread_attr_destroy(&attr); static if (isStackGrowingDown) addr += size; return addr; } else version (OpenBSD) { stack_t stk; pthread_stackseg_np(pthread_self(), &stk); return stk.ss_sp; } else version (Solaris) { stack_t stk; thr_stksegment(&stk); return stk.ss_sp; } else static assert(false, "Platform not supported."); } /** * Suspend the specified thread and load stack and register information for * use by thread_scanAll. If the supplied thread is the calling thread, * stack and register information will be loaded but the thread will not * be suspended. If the suspend operation fails and the thread is not * running then it will be removed from the global thread list, otherwise * an exception will be thrown. * * Params: * t = The thread to suspend. * * Throws: * ThreadError if the suspend operation fails for a running thread. * Returns: * Whether the thread is now suspended (true) or terminated (false). */ private extern (D) bool suspend( Thread t ) nothrow @nogc { Duration waittime = dur!"usecs"(10); Lagain: if (!t.isRunning) { Thread.remove(t); return false; } else if (t.m_isInCriticalRegion) { Thread.criticalRegionLock.unlock_nothrow(); Thread.sleep(waittime); if (waittime < dur!"msecs"(10)) waittime *= 2; Thread.criticalRegionLock.lock_nothrow(); goto Lagain; } version (Windows) { if ( t.m_addr != GetCurrentThreadId() && SuspendThread( t.m_hndl ) == 0xFFFFFFFF ) { if ( !t.isRunning ) { Thread.remove( t ); return false; } onThreadError( "Unable to suspend thread" ); } CONTEXT context = void; context.ContextFlags = CONTEXT_INTEGER | CONTEXT_CONTROL; if ( !GetThreadContext( t.m_hndl, &context ) ) onThreadError( "Unable to load thread context" ); version (X86) { if ( !t.m_lock ) t.m_curr.tstack = cast(void*) context.Esp; // eax,ebx,ecx,edx,edi,esi,ebp,esp t.m_reg[0] = context.Eax; t.m_reg[1] = context.Ebx; t.m_reg[2] = context.Ecx; t.m_reg[3] = context.Edx; t.m_reg[4] = context.Edi; t.m_reg[5] = context.Esi; t.m_reg[6] = context.Ebp; t.m_reg[7] = context.Esp; } else version (X86_64) { if ( !t.m_lock ) t.m_curr.tstack = cast(void*) context.Rsp; // rax,rbx,rcx,rdx,rdi,rsi,rbp,rsp t.m_reg[0] = context.Rax; t.m_reg[1] = context.Rbx; t.m_reg[2] = context.Rcx; t.m_reg[3] = context.Rdx; t.m_reg[4] = context.Rdi; t.m_reg[5] = context.Rsi; t.m_reg[6] = context.Rbp; t.m_reg[7] = context.Rsp; // r8,r9,r10,r11,r12,r13,r14,r15 t.m_reg[8] = context.R8; t.m_reg[9] = context.R9; t.m_reg[10] = context.R10; t.m_reg[11] = context.R11; t.m_reg[12] = context.R12; t.m_reg[13] = context.R13; t.m_reg[14] = context.R14; t.m_reg[15] = context.R15; } else { static assert(false, "Architecture not supported." ); } } else version (Darwin) { if ( t.m_addr != pthread_self() && thread_suspend( t.m_tmach ) != KERN_SUCCESS ) { if ( !t.isRunning ) { Thread.remove( t ); return false; } onThreadError( "Unable to suspend thread" ); } version (X86) { x86_thread_state32_t state = void; mach_msg_type_number_t count = x86_THREAD_STATE32_COUNT; if ( thread_get_state( t.m_tmach, x86_THREAD_STATE32, &state, &count ) != KERN_SUCCESS ) onThreadError( "Unable to load thread state" ); if ( !t.m_lock ) t.m_curr.tstack = cast(void*) state.esp; // eax,ebx,ecx,edx,edi,esi,ebp,esp t.m_reg[0] = state.eax; t.m_reg[1] = state.ebx; t.m_reg[2] = state.ecx; t.m_reg[3] = state.edx; t.m_reg[4] = state.edi; t.m_reg[5] = state.esi; t.m_reg[6] = state.ebp; t.m_reg[7] = state.esp; } else version (X86_64) { x86_thread_state64_t state = void; mach_msg_type_number_t count = x86_THREAD_STATE64_COUNT; if ( thread_get_state( t.m_tmach, x86_THREAD_STATE64, &state, &count ) != KERN_SUCCESS ) onThreadError( "Unable to load thread state" ); if ( !t.m_lock ) t.m_curr.tstack = cast(void*) state.rsp; // rax,rbx,rcx,rdx,rdi,rsi,rbp,rsp t.m_reg[0] = state.rax; t.m_reg[1] = state.rbx; t.m_reg[2] = state.rcx; t.m_reg[3] = state.rdx; t.m_reg[4] = state.rdi; t.m_reg[5] = state.rsi; t.m_reg[6] = state.rbp; t.m_reg[7] = state.rsp; // r8,r9,r10,r11,r12,r13,r14,r15 t.m_reg[8] = state.r8; t.m_reg[9] = state.r9; t.m_reg[10] = state.r10; t.m_reg[11] = state.r11; t.m_reg[12] = state.r12; t.m_reg[13] = state.r13; t.m_reg[14] = state.r14; t.m_reg[15] = state.r15; } else version (AArch64) { arm_thread_state64_t state = void; mach_msg_type_number_t count = ARM_THREAD_STATE64_COUNT; if (thread_get_state(t.m_tmach, ARM_THREAD_STATE64, &state, &count) != KERN_SUCCESS) onThreadError("Unable to load thread state"); // TODO: ThreadException here recurses forever! Does it //still using onThreadError? //printf("state count %d (expect %d)\n", count ,ARM_THREAD_STATE64_COUNT); if (!t.m_lock) t.m_curr.tstack = cast(void*) state.sp; t.m_reg[0..29] = state.x; // x0-x28 t.m_reg[29] = state.fp; // x29 t.m_reg[30] = state.lr; // x30 t.m_reg[31] = state.sp; // x31 t.m_reg[32] = state.pc; } else version (ARM) { arm_thread_state32_t state = void; mach_msg_type_number_t count = ARM_THREAD_STATE32_COUNT; // Thought this would be ARM_THREAD_STATE32, but that fails. // Mystery if (thread_get_state(t.m_tmach, ARM_THREAD_STATE, &state, &count) != KERN_SUCCESS) onThreadError("Unable to load thread state"); // TODO: in past, ThreadException here recurses forever! Does it //still using onThreadError? //printf("state count %d (expect %d)\n", count ,ARM_THREAD_STATE32_COUNT); if (!t.m_lock) t.m_curr.tstack = cast(void*) state.sp; t.m_reg[0..13] = state.r; // r0 - r13 t.m_reg[13] = state.sp; t.m_reg[14] = state.lr; t.m_reg[15] = state.pc; } else version (PPC) { ppc_thread_state_t state = void; mach_msg_type_number_t count = PPC_THREAD_STATE_COUNT; if (thread_get_state(t.m_tmach, PPC_THREAD_STATE, &state, &count) != KERN_SUCCESS) onThreadError("Unable to load thread state"); if (!t.m_lock) t.m_curr.tstack = cast(void*) state.r[1]; t.m_reg[] = state.r[]; } else version (PPC64) { ppc_thread_state64_t state = void; mach_msg_type_number_t count = PPC_THREAD_STATE64_COUNT; if (thread_get_state(t.m_tmach, PPC_THREAD_STATE64, &state, &count) != KERN_SUCCESS) onThreadError("Unable to load thread state"); if (!t.m_lock) t.m_curr.tstack = cast(void*) state.r[1]; t.m_reg[] = state.r[]; } else { static assert(false, "Architecture not supported." ); } } else version (Posix) { if ( t.m_addr != pthread_self() ) { if ( pthread_kill( t.m_addr, suspendSignalNumber ) != 0 ) { if ( !t.isRunning ) { Thread.remove( t ); return false; } onThreadError( "Unable to suspend thread" ); } } else if ( !t.m_lock ) { t.m_curr.tstack = getStackTop(); } } return true; } /** * Suspend all threads but the calling thread for "stop the world" garbage * collection runs. This function may be called multiple times, and must * be followed by a matching number of calls to thread_resumeAll before * processing is resumed. * * Throws: * ThreadError if the suspend operation fails for a running thread. */ extern (C) void thread_suspendAll() nothrow { // NOTE: We've got an odd chicken & egg problem here, because while the GC // is required to call thread_init before calling any other thread // routines, thread_init may allocate memory which could in turn // trigger a collection. Thus, thread_suspendAll, thread_scanAll, // and thread_resumeAll must be callable before thread_init // completes, with the assumption that no other GC memory has yet // been allocated by the system, and thus there is no risk of losing // data if the global thread list is empty. The check of // Thread.sm_tbeg below is done to ensure thread_init has completed, // and therefore that calling Thread.getThis will not result in an // error. For the short time when Thread.sm_tbeg is null, there is // no reason not to simply call the multithreaded code below, with // the expectation that the foreach loop will never be entered. if ( !multiThreadedFlag && Thread.sm_tbeg ) { if ( ++suspendDepth == 1 ) suspend( Thread.getThis() ); return; } Thread.slock.lock_nothrow(); { if ( ++suspendDepth > 1 ) return; Thread.criticalRegionLock.lock_nothrow(); scope (exit) Thread.criticalRegionLock.unlock_nothrow(); size_t cnt; bool suspendedSelf; Thread t = ThreadBase.sm_tbeg.toThread; while (t) { auto tn = t.next.toThread; if (suspend(t)) { if (t is ThreadBase.getThis()) suspendedSelf = true; ++cnt; } t = tn; } version (Darwin) {} else version (Posix) { // Subtract own thread if we called suspend() on ourselves. // For example, suspendedSelf would be false if the current // thread ran thread_detachThis(). assert(cnt >= 1); if (suspendedSelf) --cnt; // wait for semaphore notifications for (; cnt; --cnt) { while (sem_wait(&suspendCount) != 0) { if (errno != EINTR) onThreadError("Unable to wait for semaphore"); errno = 0; } } } } } /** * Resume the specified thread and unload stack and register information. * If the supplied thread is the calling thread, stack and register * information will be unloaded but the thread will not be resumed. If * the resume operation fails and the thread is not running then it will * be removed from the global thread list, otherwise an exception will be * thrown. * * Params: * t = The thread to resume. * * Throws: * ThreadError if the resume fails for a running thread. */ private extern (D) void resume(ThreadBase _t) nothrow @nogc { Thread t = _t.toThread; version (Windows) { if ( t.m_addr != GetCurrentThreadId() && ResumeThread( t.m_hndl ) == 0xFFFFFFFF ) { if ( !t.isRunning ) { Thread.remove( t ); return; } onThreadError( "Unable to resume thread" ); } if ( !t.m_lock ) t.m_curr.tstack = t.m_curr.bstack; t.m_reg[0 .. $] = 0; } else version (Darwin) { if ( t.m_addr != pthread_self() && thread_resume( t.m_tmach ) != KERN_SUCCESS ) { if ( !t.isRunning ) { Thread.remove( t ); return; } onThreadError( "Unable to resume thread" ); } if ( !t.m_lock ) t.m_curr.tstack = t.m_curr.bstack; t.m_reg[0 .. $] = 0; } else version (Posix) { if ( t.m_addr != pthread_self() ) { if ( pthread_kill( t.m_addr, resumeSignalNumber ) != 0 ) { if ( !t.isRunning ) { Thread.remove( t ); return; } onThreadError( "Unable to resume thread" ); } } else if ( !t.m_lock ) { t.m_curr.tstack = t.m_curr.bstack; } } } /** * Initializes the thread module. This function must be called by the * garbage collector on startup and before any other thread routines * are called. */ extern (C) void thread_init() @nogc nothrow { // NOTE: If thread_init itself performs any allocations then the thread // routines reserved for garbage collector use may be called while // thread_init is being processed. However, since no memory should // exist to be scanned at this point, it is sufficient for these // functions to detect the condition and return immediately. initLowlevelThreads(); Thread.initLocks(); version (Darwin) { // thread id different in forked child process static extern(C) void initChildAfterFork() { auto thisThread = Thread.getThis(); thisThread.m_addr = pthread_self(); assert( thisThread.m_addr != thisThread.m_addr.init ); thisThread.m_tmach = pthread_mach_thread_np( thisThread.m_addr ); assert( thisThread.m_tmach != thisThread.m_tmach.init ); } pthread_atfork(null, null, &initChildAfterFork); } else version (Posix) { version (OpenBSD) { // OpenBSD does not support SIGRTMIN or SIGRTMAX // Use SIGUSR1 for SIGRTMIN, SIGUSR2 for SIGRTMIN + 1 // And use 32 for SIGRTMAX (32 is the max signal number on OpenBSD) enum SIGRTMIN = SIGUSR1; enum SIGRTMAX = 32; } if ( suspendSignalNumber == 0 ) { suspendSignalNumber = SIGRTMIN; } if ( resumeSignalNumber == 0 ) { resumeSignalNumber = SIGRTMIN + 1; assert(resumeSignalNumber <= SIGRTMAX); } int status; sigaction_t suspend = void; sigaction_t resume = void; // This is a quick way to zero-initialize the structs without using // memset or creating a link dependency on their static initializer. (cast(byte*) &suspend)[0 .. sigaction_t.sizeof] = 0; (cast(byte*) &resume)[0 .. sigaction_t.sizeof] = 0; // NOTE: SA_RESTART indicates that system calls should restart if they // are interrupted by a signal, but this is not available on all // Posix systems, even those that support multithreading. static if ( __traits( compiles, SA_RESTART ) ) suspend.sa_flags = SA_RESTART; suspend.sa_handler = &thread_suspendHandler; // NOTE: We want to ignore all signals while in this handler, so fill // sa_mask to indicate this. status = sigfillset( &suspend.sa_mask ); assert( status == 0 ); // NOTE: Since resumeSignalNumber should only be issued for threads within the // suspend handler, we don't want this signal to trigger a // restart. resume.sa_flags = 0; resume.sa_handler = &thread_resumeHandler; // NOTE: We want to ignore all signals while in this handler, so fill // sa_mask to indicate this. status = sigfillset( &resume.sa_mask ); assert( status == 0 ); status = sigaction( suspendSignalNumber, &suspend, null ); assert( status == 0 ); status = sigaction( resumeSignalNumber, &resume, null ); assert( status == 0 ); status = sem_init( &suspendCount, 0, 0 ); assert( status == 0 ); } _mainThreadStore[] = __traits(initSymbol, Thread)[]; Thread.sm_main = attachThread((cast(Thread)_mainThreadStore.ptr).__ctor()); } private alias MainThreadStore = void[__traits(classInstanceSize, Thread)]; package __gshared align(__traits(classInstanceAlignment, Thread)) MainThreadStore _mainThreadStore; /** * Terminates the thread module. No other thread routine may be called * afterwards. */ extern (C) void thread_term() @nogc nothrow { thread_term_tpl!(Thread)(_mainThreadStore); } /////////////////////////////////////////////////////////////////////////////// // Thread Entry Point and Signal Handlers /////////////////////////////////////////////////////////////////////////////// version (Windows) { private { // // Entry point for Windows threads // extern (Windows) uint thread_entryPoint( void* arg ) nothrow { Thread obj = cast(Thread) arg; assert( obj ); obj.initDataStorage(); Thread.setThis(obj); Thread.add(obj); scope (exit) { Thread.remove(obj); obj.destroyDataStorage(); } Thread.add(&obj.m_main); // NOTE: No GC allocations may occur until the stack pointers have // been set and Thread.getThis returns a valid reference to // this thread object (this latter condition is not strictly // necessary on Windows but it should be followed for the // sake of consistency). // TODO: Consider putting an auto exception object here (using // alloca) forOutOfMemoryError plus something to track // whether an exception is in-flight? void append( Throwable t ) { obj.m_unhandled = Throwable.chainTogether(obj.m_unhandled, t); } version (D_InlineAsm_X86) { asm nothrow @nogc { fninit; } } try { rt_moduleTlsCtor(); try { obj.run(); } catch ( Throwable t ) { append( t ); } rt_moduleTlsDtor(); } catch ( Throwable t ) { append( t ); } return 0; } HANDLE GetCurrentThreadHandle() nothrow @nogc { const uint DUPLICATE_SAME_ACCESS = 0x00000002; HANDLE curr = GetCurrentThread(), proc = GetCurrentProcess(), hndl; DuplicateHandle( proc, curr, proc, &hndl, 0, TRUE, DUPLICATE_SAME_ACCESS ); return hndl; } } } else version (Posix) { private { import core.stdc.errno; import core.sys.posix.semaphore; import core.sys.posix.stdlib; // for malloc, valloc, free, atexit import core.sys.posix.pthread; import core.sys.posix.signal; import core.sys.posix.time; version (Darwin) { import core.sys.darwin.mach.thread_act; import core.sys.darwin.pthread : pthread_mach_thread_np; } // // Entry point for POSIX threads // extern (C) void* thread_entryPoint( void* arg ) nothrow { version (Shared) { Thread obj = cast(Thread)(cast(void**)arg)[0]; auto loadedLibraries = (cast(void**)arg)[1]; .free(arg); } else { Thread obj = cast(Thread)arg; } assert( obj ); // loadedLibraries need to be inherited from parent thread // before initilizing GC for TLS (rt_tlsgc_init) version (Shared) { externDFunc!("rt.sections_elf_shared.inheritLoadedLibraries", void function(void*) @nogc nothrow)(loadedLibraries); } obj.initDataStorage(); atomicStore!(MemoryOrder.raw)(obj.m_isRunning, true); Thread.setThis(obj); // allocates lazy TLS (see Issue 11981) Thread.add(obj); // can only receive signals from here on scope (exit) { Thread.remove(obj); atomicStore!(MemoryOrder.raw)(obj.m_isRunning, false); obj.destroyDataStorage(); } Thread.add(&obj.m_main); static extern (C) void thread_cleanupHandler( void* arg ) nothrow @nogc { Thread obj = cast(Thread) arg; assert( obj ); // NOTE: If the thread terminated abnormally, just set it as // not running and let thread_suspendAll remove it from // the thread list. This is safer and is consistent // with the Windows thread code. atomicStore!(MemoryOrder.raw)(obj.m_isRunning,false); } // NOTE: Using void to skip the initialization here relies on // knowledge of how pthread_cleanup is implemented. It may // not be appropriate for all platforms. However, it does // avoid the need to link the pthread module. If any // implementation actually requires default initialization // then pthread_cleanup should be restructured to maintain // the current lack of a link dependency. static if ( __traits( compiles, pthread_cleanup ) ) { pthread_cleanup cleanup = void; cleanup.push( &thread_cleanupHandler, cast(void*) obj ); } else static if ( __traits( compiles, pthread_cleanup_push ) ) { pthread_cleanup_push( &thread_cleanupHandler, cast(void*) obj ); } else { static assert( false, "Platform not supported." ); } // NOTE: No GC allocations may occur until the stack pointers have // been set and Thread.getThis returns a valid reference to // this thread object (this latter condition is not strictly // necessary on Windows but it should be followed for the // sake of consistency). // TODO: Consider putting an auto exception object here (using // alloca) forOutOfMemoryError plus something to track // whether an exception is in-flight? void append( Throwable t ) { obj.m_unhandled = Throwable.chainTogether(obj.m_unhandled, t); } try { rt_moduleTlsCtor(); try { obj.run(); } catch ( Throwable t ) { append( t ); } rt_moduleTlsDtor(); version (Shared) { externDFunc!("rt.sections_elf_shared.cleanupLoadedLibraries", void function() @nogc nothrow)(); } } catch ( Throwable t ) { append( t ); } // NOTE: Normal cleanup is handled by scope(exit). static if ( __traits( compiles, pthread_cleanup ) ) { cleanup.pop( 0 ); } else static if ( __traits( compiles, pthread_cleanup_push ) ) { pthread_cleanup_pop( 0 ); } return null; } // // Used to track the number of suspended threads // __gshared sem_t suspendCount; extern (C) void thread_suspendHandler( int sig ) nothrow in { assert( sig == suspendSignalNumber ); } do { void op(void* sp) nothrow { // NOTE: Since registers are being pushed and popped from the // stack, any other stack data used by this function should // be gone before the stack cleanup code is called below. Thread obj = Thread.getThis(); assert(obj !is null); if ( !obj.m_lock ) { obj.m_curr.tstack = getStackTop(); } sigset_t sigres = void; int status; status = sigfillset( &sigres ); assert( status == 0 ); status = sigdelset( &sigres, resumeSignalNumber ); assert( status == 0 ); status = sem_post( &suspendCount ); assert( status == 0 ); sigsuspend( &sigres ); if ( !obj.m_lock ) { obj.m_curr.tstack = obj.m_curr.bstack; } } callWithStackShell(&op); } extern (C) void thread_resumeHandler( int sig ) nothrow in { assert( sig == resumeSignalNumber ); } do { } } } else { // NOTE: This is the only place threading versions are checked. If a new // version is added, the module code will need to be searched for // places where version-specific code may be required. This can be // easily accomlished by searching for 'Windows' or 'Posix'. static assert( false, "Unknown threading implementation." ); } // // exposed by compiler runtime // extern (C) void rt_moduleTlsCtor(); extern (C) void rt_moduleTlsDtor(); // regression test for Issue 13416 version (FreeBSD) unittest { static void loop() { pthread_attr_t attr; pthread_attr_init(&attr); auto thr = pthread_self(); foreach (i; 0 .. 50) pthread_attr_get_np(thr, &attr); pthread_attr_destroy(&attr); } auto thr = new Thread(&loop).start(); foreach (i; 0 .. 50) { thread_suspendAll(); thread_resumeAll(); } thr.join(); } version (DragonFlyBSD) unittest { static void loop() { pthread_attr_t attr; pthread_attr_init(&attr); auto thr = pthread_self(); foreach (i; 0 .. 50) pthread_attr_get_np(thr, &attr); pthread_attr_destroy(&attr); } auto thr = new Thread(&loop).start(); foreach (i; 0 .. 50) { thread_suspendAll(); thread_resumeAll(); } thr.join(); } /////////////////////////////////////////////////////////////////////////////// // lowlovel threading support /////////////////////////////////////////////////////////////////////////////// private { version (Windows): // If the runtime is dynamically loaded as a DLL, there is a problem with // threads still running when the DLL is supposed to be unloaded: // // - with the VC runtime starting with VS2015 (i.e. using the Universal CRT) // a thread created with _beginthreadex increments the DLL reference count // and decrements it when done, so that the DLL is no longer unloaded unless // all the threads have terminated. With the DLL reference count held up // by a thread that is only stopped by a signal from a static destructor or // the termination of the runtime will cause the DLL to never be unloaded. // // - with the DigitalMars runtime and VC runtime up to VS2013, the thread // continues to run, but crashes once the DLL is unloaded from memory as // the code memory is no longer accessible. Stopping the threads is not possible // from within the runtime termination as it is invoked from // DllMain(DLL_PROCESS_DETACH) holding a lock that prevents threads from // terminating. // // Solution: start a watchdog thread that keeps the DLL reference count above 0 and // checks it periodically. If it is equal to 1 (plus the number of started threads), no // external references to the DLL exist anymore, threads can be stopped // and runtime termination and DLL unload can be invoked via FreeLibraryAndExitThread. // Note: runtime termination is then performed by a different thread than at startup. // // Note: if the DLL is never unloaded, process termination kills all threads // and signals their handles before unconditionally calling DllMain(DLL_PROCESS_DETACH). import core.sys.windows.winbase : FreeLibraryAndExitThread, GetModuleHandleExW, GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT; import core.sys.windows.windef : HMODULE; import core.sys.windows.dll : dll_getRefCount; version (CRuntime_Microsoft) extern(C) extern __gshared ubyte msvcUsesUCRT; // from rt/msvc.d /// set during termination of a DLL on Windows, i.e. while executing DllMain(DLL_PROCESS_DETACH) public __gshared bool thread_DLLProcessDetaching; __gshared HMODULE ll_dllModule; __gshared ThreadID ll_dllMonitorThread; int ll_countLowLevelThreadsWithDLLUnloadCallback() nothrow { lowlevelLock.lock_nothrow(); scope(exit) lowlevelLock.unlock_nothrow(); int cnt = 0; foreach (i; 0 .. ll_nThreads) if (ll_pThreads[i].cbDllUnload) cnt++; return cnt; } bool ll_dllHasExternalReferences() nothrow { version (CRuntime_DigitalMars) enum internalReferences = 1; // only the watchdog thread else int internalReferences = msvcUsesUCRT ? 1 + ll_countLowLevelThreadsWithDLLUnloadCallback() : 1; int refcnt = dll_getRefCount(ll_dllModule); return refcnt > internalReferences; } private void monitorDLLRefCnt() nothrow { // this thread keeps the DLL alive until all external references are gone while (ll_dllHasExternalReferences()) { Thread.sleep(100.msecs); } // the current thread will be terminated below ll_removeThread(GetCurrentThreadId()); for (;;) { ThreadID tid; void delegate() nothrow cbDllUnload; { lowlevelLock.lock_nothrow(); scope(exit) lowlevelLock.unlock_nothrow(); foreach (i; 0 .. ll_nThreads) if (ll_pThreads[i].cbDllUnload) { cbDllUnload = ll_pThreads[i].cbDllUnload; tid = ll_pThreads[0].tid; } } if (!cbDllUnload) break; cbDllUnload(); assert(!findLowLevelThread(tid)); } FreeLibraryAndExitThread(ll_dllModule, 0); } int ll_getDLLRefCount() nothrow @nogc { if (!ll_dllModule && !GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, cast(const(wchar)*) &ll_getDLLRefCount, &ll_dllModule)) return -1; return dll_getRefCount(ll_dllModule); } bool ll_startDLLUnloadThread() nothrow @nogc { int refcnt = ll_getDLLRefCount(); if (refcnt < 0) return false; // not a dynamically loaded DLL if (ll_dllMonitorThread !is ThreadID.init) return true; // if a thread is created from a DLL, the MS runtime (starting with VC2015) increments the DLL reference count // to avoid the DLL being unloaded while the thread is still running. Mimick this behavior here for all // runtimes not doing this version (CRuntime_DigitalMars) enum needRef = true; else bool needRef = !msvcUsesUCRT; if (needRef) { HMODULE hmod; GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, cast(const(wchar)*) &ll_getDLLRefCount, &hmod); } ll_dllMonitorThread = createLowLevelThread(() { monitorDLLRefCnt(); }); return ll_dllMonitorThread != ThreadID.init; } } /** * Create a thread not under control of the runtime, i.e. TLS module constructors are * not run and the GC does not suspend it during a collection. * * Params: * dg = delegate to execute in the created thread. * stacksize = size of the stack of the created thread. The default of 0 will select the * platform-specific default size. * cbDllUnload = Windows only: if running in a dynamically loaded DLL, this delegate will be called * if the DLL is supposed to be unloaded, but the thread is still running. * The thread must be terminated via `joinLowLevelThread` by the callback. * * Returns: the platform specific thread ID of the new thread. If an error occurs, `ThreadID.init` * is returned. */ ThreadID createLowLevelThread(void delegate() nothrow dg, uint stacksize = 0, void delegate() nothrow cbDllUnload = null) nothrow @nogc { void delegate() nothrow* context = cast(void delegate() nothrow*)malloc(dg.sizeof); *context = dg; ThreadID tid; version (Windows) { // the thread won't start until after the DLL is unloaded if (thread_DLLProcessDetaching) return ThreadID.init; static extern (Windows) uint thread_lowlevelEntry(void* ctx) nothrow { auto dg = *cast(void delegate() nothrow*)ctx; free(ctx); dg(); ll_removeThread(GetCurrentThreadId()); return 0; } // see Thread.start() for why thread is created in suspended state HANDLE hThread = cast(HANDLE) _beginthreadex(null, stacksize, &thread_lowlevelEntry, context, CREATE_SUSPENDED, &tid); if (!hThread) return ThreadID.init; } lowlevelLock.lock_nothrow(); scope(exit) lowlevelLock.unlock_nothrow(); ll_nThreads++; ll_pThreads = cast(ll_ThreadData*)realloc(ll_pThreads, ll_ThreadData.sizeof * ll_nThreads); version (Windows) { ll_pThreads[ll_nThreads - 1].tid = tid; ll_pThreads[ll_nThreads - 1].cbDllUnload = cbDllUnload; if (ResumeThread(hThread) == -1) onThreadError("Error resuming thread"); CloseHandle(hThread); if (cbDllUnload) ll_startDLLUnloadThread(); } else version (Posix) { static extern (C) void* thread_lowlevelEntry(void* ctx) nothrow { auto dg = *cast(void delegate() nothrow*)ctx; free(ctx); dg(); ll_removeThread(pthread_self()); return null; } size_t stksz = adjustStackSize(stacksize); pthread_attr_t attr; int rc; if ((rc = pthread_attr_init(&attr)) != 0) return ThreadID.init; if (stksz && (rc = pthread_attr_setstacksize(&attr, stksz)) != 0) return ThreadID.init; if ((rc = pthread_create(&tid, &attr, &thread_lowlevelEntry, context)) != 0) return ThreadID.init; if ((rc = pthread_attr_destroy(&attr)) != 0) return ThreadID.init; ll_pThreads[ll_nThreads - 1].tid = tid; } return tid; } /** * Wait for a thread created with `createLowLevelThread` to terminate. * * Note: In a Windows DLL, if this function is called via DllMain with * argument DLL_PROCESS_DETACH, the thread is terminated forcefully * without proper cleanup as a deadlock would happen otherwise. * * Params: * tid = the thread ID returned by `createLowLevelThread`. */ void joinLowLevelThread(ThreadID tid) nothrow @nogc { version (Windows) { HANDLE handle = OpenThreadHandle(tid); if (!handle) return; if (thread_DLLProcessDetaching) { // When being called from DllMain/DLL_DETACH_PROCESS, threads cannot stop // due to the loader lock being held by the current thread. // On the other hand, the thread must not continue to run as it will crash // if the DLL is unloaded. The best guess is to terminate it immediately. TerminateThread(handle, 1); WaitForSingleObject(handle, 10); // give it some time to terminate, but don't wait indefinitely } else WaitForSingleObject(handle, INFINITE); CloseHandle(handle); } else version (Posix) { if (pthread_join(tid, null) != 0) onThreadError("Unable to join thread"); } } nothrow @nogc unittest { struct TaskWithContect { shared int n = 0; void run() nothrow { n.atomicOp!"+="(1); } } TaskWithContect task; ThreadID[8] tids; for (int i = 0; i < tids.length; i++) { tids[i] = createLowLevelThread(&task.run); assert(tids[i] != ThreadID.init); } for (int i = 0; i < tids.length; i++) joinLowLevelThread(tids[i]); assert(task.n == tids.length); } version (Posix) private size_t adjustStackSize(size_t sz) nothrow @nogc { if (sz == 0) return 0; // stack size must be at least PTHREAD_STACK_MIN for most platforms. if (PTHREAD_STACK_MIN > sz) sz = PTHREAD_STACK_MIN; version (CRuntime_Glibc) { // On glibc, TLS uses the top of the stack, so add its size to the requested size sz += externDFunc!("rt.sections_elf_shared.sizeOfTLS", size_t function() @nogc nothrow)(); } // stack size must be a multiple of PAGESIZE sz = ((sz + PAGESIZE - 1) & ~(PAGESIZE - 1)); return sz; }
D
module soundtab.ui.instredit; import dlangui.platforms.common.platform; import dlangui.core.logger; import dlangui.core.i18n; import dlangui.core.stdaction; import dlangui.widgets.widget; import dlangui.widgets.layouts; import dlangui.widgets.controls; import dlangui.widgets.toolbars; import dlangui.widgets.scrollbar; import dlangui.dialogs.dialog; import dlangui.dialogs.filedlg; import soundtab.ui.actions; import soundtab.audio.audiosource; import soundtab.audio.loader; import soundtab.audio.mp3player; class HRuler : Widget { float _startPos = 0; float _totalDuration = 0; float _visibleDuration = 0; this() { super("hruler"); layoutWidth = FILL_PARENT; backgroundColor(0x202020); textColor(0xC0C0C0); fontSize = 10; } /** Measure widget according to desired width and height constraints. (Step 1 of two phase layout). */ override void measure(int parentWidth, int parentHeight) { int fh = font.height; measuredContent(parentWidth, parentHeight, 0, fh + 8); } void setPosition(float startPos, float totalDuration, float visibleDuration) { _startPos = startPos; _totalDuration = totalDuration; _visibleDuration = visibleDuration; invalidate(); } /// Draw widget at its position to buffer override void onDraw(DrawBuf buf) { import std.format; import std.math : round; import std.utf : toUTF32; if (visibility != Visibility.Visible) return; super.onDraw(buf); _needDraw = false; auto saver = ClipRectSaver(buf, _pos, alpha); int longDy = _pos.height - font.height - 2; int shortDy = longDy * 40 / 100; int ytext = _pos.bottom - font.height - 2; if (_visibleDuration > 0.00001 && _totalDuration > 0.00001 && _pos.width > 10) { double secondsPerPixel = _visibleDuration / _pos.width; double scale = 0.00001; for (; scale < 10000; scale = scale * 10) { if (scale / secondsPerPixel >= 50) break; } double t = (cast(int)round(_startPos / scale)) * scale - scale; for(; t < _startPos + _visibleDuration + scale; t += scale) { if (t < 0) continue; int x = cast(int)(_pos.left + (t - _startPos) / secondsPerPixel); buf.fillRect(Rect(x, _pos.top, x + 1, _pos.top + longDy), 0xB0B0A0); for (int xx = 1; xx < 10; xx++) { double tt = t + xx * scale / 10; int xxx = cast(int)(_pos.left + (tt - _startPos) / secondsPerPixel); buf.fillRect(Rect(xxx, _pos.top, xxx + 1, _pos.top + shortDy), 0xB0B0A0); } int seconds = cast(int)t; int minutes = seconds / 60; seconds = seconds % 60; string txt; if (scale >= 1) txt = "%d:%02d".format(minutes,seconds); else if (scale >= 0.1) { int frac = cast(int)round(((t - seconds) * 10)); txt = "%d:%02d.%01d".format(minutes,seconds,frac); } else if (scale >= 0.01) { int frac = cast(int)round(((t - seconds) * 100)); txt = "%d:%02d.%02d".format(minutes,seconds,frac); } else if (scale >= 0.001) { int frac = cast(int)round(((t - seconds) * 1000)); txt = "%d:%02d.%03d".format(minutes,seconds,frac); } else { int frac = cast(int)round(((t - seconds) * 10000)); txt = "%d:%02d.%04d".format(minutes,seconds,frac); } dstring dtxt = txt.toUTF32; int w = font.textSize(dtxt).x; font.drawText(buf, x - w / 2, ytext, dtxt, 0x808080); } } } } struct MinMax { float minvalue = 0; float maxvalue = 0; @property float amplitude() { float n1 = minvalue < 0 ? -minvalue : minvalue; float n2 = maxvalue < 0 ? -maxvalue : maxvalue; return n1 > n2 ? n1 : n2; } } class WaveFileWidget : WidgetGroupDefaultDrawing { protected Mixer _mixer; protected Mp3Player _player; protected WaveFile _file; protected ScrollBar _hScroll; protected HRuler _hruler; protected Rect _clientRect; protected int _hscale = 1; protected float _vscale = 1; protected int _scrollPos = 0; protected int _cursorPos = 0; protected int _selStart = 0; protected int _selEnd = 0; protected MinMax[] _zoomCache; protected int _zoomCacheScale; protected ulong _playTimer; this(Mixer mixer) { _mixer = mixer; _player = new Mp3Player(); _mixer.addSource(_player); _hruler = new HRuler(); _hScroll = new ScrollBar("wavehscroll", Orientation.Horizontal); _hScroll.layoutWidth = FILL_PARENT; //styleId = "EDIT_BOX"; backgroundImageId = "editbox_background_dark"; addChild(_hruler); addChild(_hScroll); _hScroll.scrollEvent = &onScrollEvent; focusable = true; clickable = true; padding = Rect(3,3,3,3); margins = Rect(2,2,2,2); acceleratorMap.add([ ACTION_VIEW_HZOOM_1, ACTION_VIEW_HZOOM_IN, ACTION_VIEW_HZOOM_OUT, ACTION_VIEW_HZOOM_MAX, ACTION_VIEW_HZOOM_SEL, ACTION_VIEW_VZOOM_1, ACTION_VIEW_VZOOM_IN, ACTION_VIEW_VZOOM_OUT, ACTION_VIEW_VZOOM_MAX, ACTION_INSTRUMENT_OPEN_SOUND_FILE, ACTION_INSTRUMENT_PLAY_PAUSE, ACTION_INSTRUMENT_PLAY_PAUSE_SELECTION]); } ~this() { if (_mixer) { _player.paused = true; _mixer.removeSource(_player); destroy(_player); } } @property WaveFile file() { return _file; } @property void file(WaveFile f) { if (_player) { _player.paused = true; _player.setWave(f, false); } _file = f; _selStart = _selEnd = 0; _cursorPos = 0; _scrollPos = 0; _zoomCache = null; zoomFull(); if (window) window.update(); } @property Mp3Player player() { return _player; } /// get data to display - override to show some other data than wave (e.g. to show excitation) float[] getDisplayData() { if (!_file) return null; return _file.data; } /// override to allow extra views int getExtraViewsHeight(int parentHeight) { return 0; } /// override to allow extra views void layoutExtraViews(Rect rc) { } /// override to allow extra views void drawExtraViews(DrawBuf buf) {} void updateZoomCache() { if (!_file || _zoomCacheScale == _hscale || _hscale <= 16) return; int len = (_file.frames + _hscale - 1) / _hscale; _zoomCache = new MinMax[len]; for (int i = 0; i < len; i++) { _zoomCache[i] = getDisplayValuesNoCache(i); } _zoomCacheScale = _hscale; } void updateView() { updateScrollBar(); invalidate(); } void zoomFull() { _scrollPos = 0; _hscale = 1; _vscale = 1; if (_file) { _hscale = _file.frames / (_clientRect.width ? _clientRect.width : 1); _vscale = visibleYRange().amplitude; if (_vscale > 0) _vscale = 1 / _vscale; else _vscale = 1; } updateView(); invalidate(); } MinMax visibleYRange() { MinMax res; for (int i = 0; i < _clientRect.width; i++) { MinMax m = getDisplayValues(i); if (res.minvalue > m.minvalue) res.minvalue = m.minvalue; if (res.maxvalue < m.maxvalue) res.maxvalue = m.maxvalue; } return res; } /// process key event, return true if event is processed. override bool onKeyEvent(KeyEvent event) { if (event.action == KeyAction.KeyDown) { switch(event.keyCode) { case KeyCode.HOME: _scrollPos = 0; updateView(); return true; case KeyCode.END: _scrollPos = _file ? _file.frames / _hscale - _clientRect.width : 0; updateView(); return true; case KeyCode.RIGHT: _scrollPos += _clientRect.width / 5; updateView(); return true; case KeyCode.LEFT: _scrollPos -= _clientRect.width / 5; updateView(); return true; default: break; } } if (_hScroll.onKeyEvent(event)) return true; return super.onKeyEvent(event); } void openSampleFile(string filename) { WaveFile f = loadSoundFile(filename); if (f) { file = f; } } void openSampleFile() { import std.file; FileDialog dlg = new FileDialog(UIString("Open Sample MP3 file"d), window, null); dlg.addFilter(FileFilterEntry(UIString("Sound files (*.mp3;*.wav)"d), "*.mp3;*.wav")); dlg.dialogResult = delegate(Dialog dlg, const Action result) { if (result.id == ACTION_OPEN.id) { string filename = result.stringParam; if (filename.exists && filename.isFile) { openSampleFile(filename); } } }; dlg.show(); } /// override to handle specific actions override bool handleAction(const Action a) { switch(a.id) { case Actions.ViewHZoomIn: _hscale = _hscale * 2 / 3; updateView(); return true; case Actions.ViewHZoomOut: _hscale = _hscale < 3 ? _hscale + 1 : _hscale * 3 / 2; updateView(); return true; case Actions.ViewHZoom1: _hscale = 1; updateView(); return true; case Actions.ViewHZoomMax: zoomFull(); return true; case Actions.ViewVZoomMax: _vscale = 1; updateView(); return true; case Actions.ViewHZoomSel: int sellen = _selEnd - _selStart; if (sellen > 16) { _hscale = (sellen + _clientRect.width - 1) / _clientRect.width; if (_hscale < 1) _hscale = 1; _scrollPos = _selStart / _hscale; updateView(); } return true; case Actions.ViewVZoom1: _vscale = visibleYRange().amplitude; if (_vscale > 0) _vscale = 1 / _vscale; else _vscale = 1; updateView(); return true; case Actions.ViewVZoomIn: _vscale *= 1.3; updateView(); return true; case Actions.ViewVZoomOut: _vscale /= 1.3; updateView(); return true; case Actions.InstrumentEditorPlayPause: // play/pause Log.d("play/pause"); if (_player) { if (!_playTimer) _playTimer = setTimer(50); if (_player.paused) { if (_cursorPos >= _file.frames - 100) _cursorPos = 0; setPlayPosition(); _player.paused = false; } else { _player.paused = true; getPlayPosition(); _player.removeLoop(); } } return true; case Actions.InstrumentEditorPlayPauseSelection: // play/pause selection Log.d("play/pause selection"); if (_player) { if (!_playTimer) _playTimer = setTimer(50); if (_player.paused) { if (_selEnd > _selStart || _cursorPos >= _selEnd) _cursorPos = _selStart; setPlayPosition(); _player.setLoop(_file.frameToTime(_selStart), _file.frameToTime(_selEnd)); _player.paused = false; } else { _player.paused = true; getPlayPosition(); _player.removeLoop(); } } return true; case Actions.InstrumentOpenSoundFile: openSampleFile(); return true; default: break; } return super.handleAction(a); } WaveFile getSelectionUpsampled() { int sellen = _selEnd - _selStart; if (sellen > 16) { return _file.upsample4x(_selStart, _selEnd); } return null; } WaveFile getSelectionWave() { int sellen = _selEnd - _selStart; if (sellen > 16) { return _file.getRange(_selStart, _selEnd, true); } return null; } void ensureCursorVisible() { if (!_file) return; int p = _cursorPos / _hscale; if (p < _scrollPos) { _scrollPos = p; updateView(); } else if (p > _scrollPos + _clientRect.width * 9 / 10) { _scrollPos = p - _clientRect.width / 10; updateView(); } } /// player position to screen void getPlayPosition() { if (!_file) return; PlayPosition p = _player.position; int frame = _file.timeToFrame(p.currentPosition); _cursorPos = frame; ensureCursorVisible(); invalidate(); window.update(); } /// set cursor position to player position void setPlayPosition() { if (!_file) return; _player.position = _file.frameToTime(_cursorPos); } override bool onTimer(ulong id) { if (id == _playTimer) { if (!_player.paused) getPlayPosition(); return true; } else { return super.onTimer(id); } } void limitPosition(ref int position) { int maxx = _file ? _file.frames - 1 : 0; if (position > maxx) position = maxx; if (position < 0) position = 0; } void updateScrollBar() { if (!_clientRect.width) return; limitPosition(_cursorPos); limitPosition(_selStart); limitPosition(_selEnd); if (_hscale < 1) _hscale = 1; if (_vscale > 5000.0f) _vscale = 5000.0f; int maxScale = _file ? (_file.frames / (_clientRect.width ? _clientRect.width : 1)) : 1; if (_hscale > maxScale) _hscale = maxScale; if (_hscale < 1) _hscale = 1; float amp = visibleYRange.amplitude; if (amp < 0.0001) amp = 0.0001f; float minvscale = 1 / amp * 0.1; float maxvscale = 1 / amp * 10; if (minvscale > 1) minvscale = 1; if (_vscale < minvscale) _vscale = minvscale; if (_vscale > maxvscale) _vscale = maxvscale; if (!_file) { _hScroll.maxValue = 0; _hScroll.pageSize = 1; _hScroll.position = 0; _hruler.setPosition(0, 0, 0); } else { int w = _clientRect.width; int fullw = _file.frames / _hscale; int visiblew = w; if (visiblew > fullw) visiblew = fullw; if (_scrollPos + visiblew > fullw) _scrollPos = fullw - visiblew; if (_scrollPos < 0) _scrollPos = 0; if (_hScroll.pageSize != visiblew) { _hScroll.pageSize = visiblew; _hScroll.requestLayout(); } if (_hScroll.maxValue != fullw) { _hScroll.maxValue = fullw; //fullw - visiblew; _hScroll.requestLayout(); } _hScroll.position = _scrollPos; _hruler.setPosition(_file.frameToTime(_scrollPos * _hscale), _file.frameToTime(fullw * _hscale), _file.frameToTime(visiblew * _hscale)); } } /// handle scroll event bool onScrollEvent(AbstractSlider source, ScrollEvent event) { _scrollPos = event.position; updateView(); return true; } /** Measure widget according to desired width and height constraints. (Step 1 of two phase layout). */ override void measure(int parentWidth, int parentHeight) { _hruler.measure(parentWidth, parentHeight); int hRulerHeight = _hruler.measuredHeight; int extraHeight = getExtraViewsHeight(parentHeight); _hScroll.measure(parentWidth, parentHeight); int hScrollHeight = _hScroll.measuredHeight; measuredContent(parentWidth, parentHeight, 0, 200 + hRulerHeight + hScrollHeight + extraHeight); } /// Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout). override void layout(Rect rc) { if (visibility == Visibility.Gone) { return; } _pos = rc; _needLayout = false; Rect m = margins; Rect p = padding; rc.left += margins.left + padding.left; rc.right -= margins.right + padding.right; rc.top += margins.top + padding.top; rc.bottom -= margins.bottom + padding.bottom; int hScrollHeight = _hScroll.measuredHeight; Rect hscrollRc = rc; hscrollRc.top = hscrollRc.bottom - hScrollHeight; _hScroll.layout(hscrollRc); int hRulerHeight = _hruler.measuredHeight; Rect hrulerRc = rc; hrulerRc.bottom = hscrollRc.top; hrulerRc.top = hrulerRc.bottom - hRulerHeight; _hruler.layout(hrulerRc); int extraHeight = getExtraViewsHeight(rc.height); if (extraHeight) { Rect extraRc = rc; extraRc.bottom = hrulerRc.top; extraRc.top = extraRc.bottom - extraHeight; layoutExtraViews(extraRc); } _clientRect = rc; _clientRect.bottom = hrulerRc.top - 1 - extraHeight; _clientRect.top += 1; updateView(); } MinMax getDisplayValuesNoCache(int offset) { MinMax res; if (!_file) return res; int p0 = cast(int)((offset) * _hscale); int p1 = cast(int)((offset + 1) * _hscale); float[] data = getDisplayData(); for (int i = p0; i < p1; i++) { if (i >= 0 && i < _file.frames) { float v = data.ptr[i * _file.channels]; if (i == p0) { res.minvalue = res.maxvalue = v; } else { if (res.minvalue > v) res.minvalue = v; if (res.maxvalue < v) res.maxvalue = v; } } } return res; } MinMax getDisplayValues(int offset) { offset += _scrollPos; if (_hscale > 16) { MinMax res; updateZoomCache(); if (offset < 0 || offset >= _zoomCache.length) return res; return _zoomCache.ptr[offset]; } return getDisplayValuesNoCache(offset); } bool getDisplayPos(int offset, ref int y0, ref int y1) { MinMax v = getDisplayValues(offset); int my = _clientRect.middley; int dy = _clientRect.height / 2; y0 = my - cast(int)((v.maxvalue * _vscale) * dy); y1 = my + 1 - cast(int)((v.minvalue * _vscale) * dy); if (y0 >= _clientRect.bottom || y1 <= _clientRect.top) return false; return true; } void setCursorPos(int x) { limitPosition(x); if (_cursorPos != x) { _cursorPos = x; invalidate(); if (!_player.paused) setPlayPosition(); } } void updateSelection(int x) { limitPosition(x); if (_cursorPos < x) { _selStart = _cursorPos; _selEnd = x; invalidate(); } else { _selStart = x; _selEnd = _cursorPos; invalidate(); } } void updateHScale(int newScale, int preserveX) { int maxScale = _file ? (_file.frames / (_clientRect.width ? _clientRect.width : 1)) : 1; if (newScale > maxScale) newScale = maxScale; if (newScale < 1) newScale = 1; int oldxpos = preserveX / _hscale - _scrollPos; _hscale = newScale; _scrollPos = preserveX / _hscale - oldxpos; updateView(); } /// process mouse event; return true if event is processed by widget. override bool onMouseEvent(MouseEvent event) { if (event.action == MouseAction.ButtonDown && !focused && canFocus) setFocus(); if (_clientRect.isPointInside(event.x, event.y)) { int x = (_scrollPos + (event.x - _clientRect.left)) * _hscale; if ((event.action == MouseAction.ButtonDown || event.action == MouseAction.Move) && (event.flags & MouseFlag.LButton)) { setCursorPos(x); return true; } if ((event.action == MouseAction.ButtonDown || event.action == MouseAction.Move) && (event.flags & MouseFlag.RButton)) { updateSelection(x); return true; } if (event.action == MouseAction.Wheel) { if (event.flags & MouseFlag.Control) { // vertical zoom handleAction(event.wheelDelta > 0 ? ACTION_VIEW_VZOOM_IN : ACTION_VIEW_VZOOM_OUT); } else { // horizontal zoom int newScale = _hscale * 2 / 3; if (event.wheelDelta < 0) { newScale = _hscale < 3 ? _hscale + 1 : _hscale * 3 / 2; } updateHScale(newScale, x); } return true; } return false; } return super.onMouseEvent(event); } /// Draw widget at its position to buffer override void onDraw(DrawBuf buf) { if (visibility != Visibility.Visible) return; super.onDraw(buf); _needDraw = false; { auto saver = ClipRectSaver(buf, _clientRect, alpha); // erase background buf.fillRect(_clientRect, 0x102010); int my = _clientRect.middley; int dy = _clientRect.height / 2; // draw wave if (_file) { int cursorx = _cursorPos / _hscale - _scrollPos; int selstartx = _selStart / _hscale - _scrollPos; int selendx = _selEnd / _hscale - _scrollPos; for (int i = 0; i < _clientRect.width; i++) { int x = _clientRect.left + i; int y0, y1; if (getDisplayPos(i, y0, y1)) { buf.fillRect(Rect(x, y0, x + 1, y1), 0x4020C020); if (_hscale <= 10) { int exty0 = y0; int exty1 = y1; int prevy0, prevy1; int nexty0, nexty1; if (getDisplayPos(i - 1, prevy0, prevy1)) { if (prevy0 < exty0) exty0 = (prevy0 + y0) / 2; if (prevy1 > exty1) exty1 = (prevy1 + y1) / 2; } if (getDisplayPos(i + 1, nexty0, nexty1)) { if (nexty0 < exty0) exty0 = (nexty0 + y0) / 2; if (nexty1 > exty1) exty1 = (nexty1 + y1) / 2; } if (exty0 < y0) buf.fillRect(Rect(x, exty0, x + 1, y0), 0xE040FF40); if (exty1 > y1) buf.fillRect(Rect(x, y1, x + 1, exty1), 0xE040FF40); } } if (x >= selstartx && x <= selendx) buf.fillRect(Rect(x, _clientRect.top, x + 1, _clientRect.bottom), 0xD00000FF); if (x == cursorx) buf.fillRect(Rect(x, _clientRect.top, x + 1, _clientRect.bottom), 0x40FFFFFF); } if (_file.marks.length) { for (int i = 0; i < _file.marks.length; i++) { int markSample = _file.timeToFrame(_file.marks[i]); int x = (markSample / _hscale) - _scrollPos + _clientRect.left; if (x >= _clientRect.left && x < _clientRect.right) { buf.fillRect(Rect(x, _clientRect.top, x + 1, _clientRect.bottom), 0xA0FF0000); } } } if (_file.negativeMarks.length) { for (int i = 0; i < _file.negativeMarks.length; i++) { int markSample = _file.timeToFrame(_file.negativeMarks[i]); int x = (markSample / _hscale) - _scrollPos + _clientRect.left; if (x >= _clientRect.left && x < _clientRect.right) { buf.fillRect(Rect(x, _clientRect.top, x + 1, _clientRect.bottom), 0xA00000FF); } } } } // draw y==0 buf.fillRect(Rect(_clientRect.left, my, _clientRect.right, my + 1), 0x80606030); } drawExtraViews(buf); } } class SourceWaveFileWidget : WaveFileWidget { this(Mixer mixer) { super(mixer); } } class LoopWaveWidget : WaveFileWidget { protected Rect _ampRect; protected Rect _freqRect; protected Rect _fftRect; protected bool _hasAmps; protected bool _hasFreqs; protected bool _hasFft; protected float _minAmp = 0; protected float _maxAmp = 0; protected float _maxFftAmp = 0; protected float _minFreq = 0; protected float _maxFreq = 0; this(Mixer mixer) { super(mixer); } /// get data to display - override to show some other data than wave (e.g. to show excitation) override float[] getDisplayData() { if (!_file) return null; if (_file.excitation) return _file.excitation; return _file.data; } @property override void file(WaveFile f) { super.file(f); if (_file && _file.amplitudes.length == _file.frames) { _minAmp = _maxAmp = _file.amplitudes[0]; foreach(v; _file.amplitudes) { if (_minAmp > v) _minAmp = v; if (_maxAmp < v) _maxAmp = v; } _hasAmps = _maxAmp > _minAmp; } if (_file && _file.frequencies.length == _file.frames) { _minFreq = _maxFreq = _file.frequencies[0]; foreach(v; _file.frequencies) { if (_minFreq > v) _minFreq = v; if (_maxFreq < v) _maxFreq = v; } _hasFreqs = _maxFreq > _minFreq; } if (_file && _file.periods.length > 0) { _maxFftAmp = 0; foreach (p; _file.periods) { foreach(amp; p.fftAmp) { if (_maxFftAmp < amp) _maxFftAmp = amp; } } _hasFft = _maxFftAmp > 0; } } immutable int LPC_HEIGHT = 12 * LPC_SIZE; /// override to allow extra views override int getExtraViewsHeight(int parentHeight) { int h = 0; if (_hasAmps) { h += 32; } if (_hasFreqs) { h += 32; } if (_hasFft) h += LPC_HEIGHT; return h; } /// override to allow extra views override void layoutExtraViews(Rect rc) { _fftRect = rc; if (_hasFft) { _fftRect.top = rc.bottom - LPC_HEIGHT; rc.bottom = _fftRect.top; } else { _fftRect.bottom = _fftRect.top; } _ampRect = rc; _freqRect = rc; if (_hasAmps && _hasFreqs) { _ampRect.bottom = _freqRect.top = rc.middley; } } protected void drawExtraArray(DrawBuf buf, Rect rc, float[] data, float minValue, float maxValue, string title, uint bgColor = 0, uint foreColor = 0x808080) { auto saver = ClipRectSaver(buf, rc, alpha); // erase background buf.fillRect(rc, bgColor); buf.fillRect(Rect(rc.left, rc.top, rc.right, rc.top + 1), 0x404040); for (int i = 0; i < rc.width; i++) { int index = (_scrollPos + i) * _hscale; int x = rc.left + i; if (index < data.length) { float value = data[index]; int y = cast(int)(rc.bottom - rc.height * (value - minValue) / (maxValue - minValue)); buf.fillRect(Rect(x, y, x + 1, rc.bottom), foreColor); } } import std.format; import std.utf; font.drawText(buf, rc.left + 2, rc.top + 2, "%s: min=%f max=%f".format(title, minValue, maxValue).toUTF32, 0xFFFFFF); } protected void drawFft(DrawBuf buf, ref PeriodInfo period, Rect rc) { import std.math : PI, sqrt, log2; for (int i = 0; i < 128; i++) { float amp = (period.fftAmp[i] / _maxFftAmp); // range is 0..1 amp = log2(amp + 1); // range is 0..1, but log scaled amp = log2(amp + 1); // range is 0..1, but log scaled amp = log2(amp + 1); // range is 0..1, but log scaled amp = log2(amp + 1); // range is 0..1, but log scaled amp = log2(amp + 1); // range is 0..1, but log scaled amp = log2(amp + 1); // range is 0..1, but log scaled float phase = (period.fftPhase[i] + PI) / (2 * PI); uint iamp = cast(int)(amp * 256); uint iphase = cast(int)(phase * 256); uint ampcolor = (iamp << 16) | (iamp << 8)| (iamp); uint phcolor = (iphase << 16) | (iphase << 8)| (iphase); buf.fillRect(Rect(rc.left, rc.top + i, rc.right, rc.top + i + 1), ampcolor); buf.fillRect(Rect(rc.left, rc.top + i + 128, rc.right, rc.top + i + 1 + 128), phcolor); } } protected void drawLspPart(DrawBuf buf, float[] lsp, Rect rc) { import std.math: PI; for (int i = 0; i < lsp.length; i++) { Rect rect = rc; float value = rc.height * lsp[i] / PI; int y = rc.top + cast(int)value; int delta = cast(int)((value - cast(int)value) * 256); rect.top = y; rect.bottom = y + 1; uint iamp = 255 - delta; uint ampcolor = (iamp << 16) | (iamp << 8)| (iamp); buf.fillRect(rect, ampcolor); rect.top++; rect.bottom++; iamp = delta; ampcolor = (iamp << 16) | (iamp << 8)| (iamp); buf.fillRect(rect, ampcolor); } } protected void drawLsp(DrawBuf buf, PeriodInfo[] periods, int periodIndex, Rect rc) { Rect rect = rc; float[LPC_SIZE] lsp; float[LPC_SIZE] prevLsp; float[LPC_SIZE] nextLsp; lsp[0..$] = periods[periodIndex].lsp[0..$]; prevLsp[0..$] = periods[periodIndex > 0 ? periodIndex - 1 : 0].lsp[0..$]; nextLsp[0..$] = periods[periodIndex + 1 < periods.length ? periodIndex + 1 : periodIndex].lsp[0..$]; for (int i = 0; i < LPC_SIZE; i++) { prevLsp[i] = (prevLsp[i] + 2*lsp[i]) / 3; nextLsp[i] = (nextLsp[i] + 2*lsp[i]) / 3; } drawLspPart(buf, prevLsp, Rect(rc.left, rc.top, rc.left + rc.width / 3, rc.bottom)); drawLspPart(buf, lsp, Rect(rc.left + rc.width/3, rc.top, rc.left + rc.width * 2 / 3, rc.bottom)); drawLspPart(buf, nextLsp, Rect(rc.left + rc.width*2/3, rc.top, rc.right, rc.bottom)); } /// override to allow extra views override void drawExtraViews(DrawBuf buf) { if (_hasAmps) { drawExtraArray(buf, _ampRect, _file.amplitudes, _minAmp, _maxAmp, "Amplitude", 0x202000, 0x604000); } if (_hasFreqs) { drawExtraArray(buf, _freqRect, _file.frequencies, _minFreq, _maxFreq, "Frequency", 0x002000, 0x0000C0); } if (_hasFft) { auto saver = ClipRectSaver(buf, _fftRect, alpha); buf.fillRect(_fftRect, 0x100000); for(int index = 0; index < _file.periods.length; index++) { int startFrame = _file.timeToFrame(_file.periods[index].startTime); int endFrame = _file.timeToFrame(_file.periods[index].endTime); int startx = startFrame / _hscale - _scrollPos + _fftRect.left; int endx = endFrame / _hscale - _scrollPos + _fftRect.left; if (startx < _fftRect.right && endx > _fftRect.left) { // frame is visible drawLsp(buf, _file.periods, index, Rect(startx, _fftRect.top, endx, _fftRect.bottom)); //drawFft(buf, period, Rect(startx, _fftRect.top, endx, _fftRect.bottom)); } } font.drawText(buf, _fftRect.left + 2, _fftRect.top + 2, "LSP", 0x20FFFF80); } } } class InstrEditorBody : VerticalLayout { SourceWaveFileWidget _wave; LoopWaveWidget _loop; protected Mixer _mixer; this(Mixer mixer) { super("instrEditBody"); _mixer = mixer; layoutWidth = FILL_PARENT; layoutHeight = FILL_PARENT; backgroundColor(0x000000); _wave = new SourceWaveFileWidget(_mixer); addChild(_wave); _loop = new LoopWaveWidget(_mixer); addChild(_loop); addChild(new VSpacer()); } ~this() { } /// override to handle specific actions override bool handleAction(const Action a) { switch(a.id) { case Actions.InstrumentCreateLoop: WaveFile tmp = _wave.getSelectionUpsampled(); WaveFile selWave = _wave.getSelectionWave(); if (tmp) { float baseFrequency = tmp.calcBaseFrequency(); int lowpassFilterSize = tmp.timeToFrame((1/baseFrequency) / 16) | 1; int highpassFilterSize = tmp.timeToFrame((1/baseFrequency) * 1.5) | 1; float[] lowpassFirFilter = blackmanWindow(lowpassFilterSize); float[] highpassFirFilter = blackmanWindow(highpassFilterSize); //makeLowpassBlackmanFirFilter(highpassFilterSize); WaveFile lowpass = tmp.firFilter(lowpassFirFilter); WaveFile highpass = lowpass.firFilterInverse(highpassFirFilter); int lowpassSign = lowpass.getMaxAmplitudeSign(); //float[] zeroPhasePositionsLowpass = lowpass.findZeroPhasePositions(lowpassSign); int highpassSign = highpass.getMaxAmplitudeSign(); float[] zeroCrossHighpass = highpass.findZeroCrossingPositions(highpassSign); //float[] zeroPhasePositionsHighpassPositive = highpass.findZeroPhasePositions(1); //float[] zeroPhasePositionsHighpassNegative = highpass.findZeroPhasePositions(-1); //smoothTimeMarksShifted(zeroPhasePositionsHighpassPositive, zeroPhasePositionsHighpassNegative); //smoothTimeMarksShifted(zeroPhasePositionsHighpassPositive, zeroPhasePositionsHighpassNegative); //smoothTimeMarksShifted(zeroPhasePositionsHighpassPositive, zeroPhasePositionsHighpassNegative); //smoothTimeMarks(zeroPhasePositionsHighpassPositive); //smoothTimeMarks(zeroPhasePositionsHighpassPositive); //smoothTimeMarks(zeroPhasePositionsHighpassNegative); //smoothTimeMarks(zeroPhasePositionsHighpassNegative); int normalSign = tmp.getMaxAmplitudeSign(); //float[] zeroPhasePositionsNormal = tmp.findZeroPhasePositions(normalSign); //Log.d("Zero phase positions for lowpass filtered data: ", zeroPhasePositionsLowpass); //Log.d("Zero phase positions for lowpass+highpass filtered data: ", zeroPhasePositionsHighpassPositive); //Log.d("Zero phase positions for non filtered data: ", zeroPhasePositionsNormal); //tmp.setMarks(zeroPhasePositionsHighpassPositive, zeroPhasePositionsHighpassNegative); //lowpass.setMarks(zeroPhasePositionsHighpassPositive, zeroPhasePositionsHighpassNegative); //highpass.setMarks(zeroPhasePositionsHighpassPositive, zeroPhasePositionsHighpassNegative); for (int i = 0; i < 10; i++) smoothTimeMarks(zeroCrossHighpass); highpass.setMarks(zeroCrossHighpass); highpass.fillPeriodsFromMarks(); highpass.fillAmplitudesFromPeriods(); highpass.normalizeAmplitude(); //highpass.correctMarksForNormalizedAmplitude(); //highpass.smoothMarks(); //highpass.smoothMarks(); highpass.generateFrequenciesFromMarks(); tmp.marks = highpass.marks; tmp.negativeMarks = highpass.negativeMarks; tmp.frequencies = highpass.frequencies; tmp.amplitudes = highpass.amplitudes; tmp.normalizeAmplitude; tmp.fillPeriodsFromMarks(); for (int i = 0; i < 20; i++) tmp.smoothLSP(); selWave.marks = highpass.marks; selWave.negativeMarks = highpass.negativeMarks; selWave.fillPeriodsFromMarks(); selWave.fillAmplitudesFromPeriods(); selWave.normalizeAmplitude(); //highpass.correctMarksForNormalizedAmplitude(); //highpass.smoothMarks(); //highpass.smoothMarks(); selWave.generateFrequenciesFromMarks(); selWave.normalizeAmplitude; selWave.fillPeriodsFromMarks(); for (int i = 0; i < 5; i++) selWave.smoothLSP(); //if (zeroPhasePositionsNormal.length > 1) { // tmp.removeDcOffset(zeroPhasePositionsHighpass[0], zeroPhasePositionsHighpass[$-1]); // tmp.generateFrequenciesFromMarks(); //} //_loop.file = lowpass; //_loop.file = highpass; tmp.excitation = null; //_loop.file = tmp; _loop.file = selWave; } return true; default: break; } return super.handleAction(a); } /// map key to action override Action findKeyAction(uint keyCode, uint flags) { Action action = _wave.findKeyAction(keyCode, flags); if (action) return action; return super.findKeyAction(keyCode, flags); } } class InstrumentEditorDialog : Dialog { protected ToolBarHost _toolbarHost; protected InstrEditorBody _body; protected Mixer _mixer; this(Window parentWindow, Mixer mixer, int initialWidth = 0, int initialHeight = 0) { _mixer = mixer; super(UIString("Instrument Editor"d), parentWindow, DialogFlag.Modal | DialogFlag.Resizable, initialWidth, initialHeight); } ToolBarHost createToolbars() { ToolBarHost tbhost = new ToolBarHost(); ToolBar tb = tbhost.getOrAddToolbar("toolbar1"); tb.addButtons(ACTION_INSTRUMENT_OPEN_SOUND_FILE, ACTION_SEPARATOR, ACTION_INSTRUMENT_PLAY_PAUSE, ACTION_INSTRUMENT_PLAY_PAUSE_SELECTION, ACTION_SEPARATOR, ACTION_INSTRUMENT_CREATE_LOOP, ACTION_SEPARATOR, ACTION_VIEW_HZOOM_1, ACTION_VIEW_HZOOM_IN, ACTION_VIEW_HZOOM_OUT, ACTION_VIEW_HZOOM_MAX, ACTION_VIEW_HZOOM_SEL, ACTION_SEPARATOR, ACTION_VIEW_VZOOM_1, ACTION_VIEW_VZOOM_IN, ACTION_VIEW_VZOOM_OUT, ACTION_VIEW_VZOOM_MAX ); acceleratorMap.add([ACTION_INSTRUMENT_OPEN_SOUND_FILE, ACTION_INSTRUMENT_PLAY_PAUSE, ACTION_INSTRUMENT_PLAY_PAUSE_SELECTION, ACTION_INSTRUMENT_CREATE_LOOP, ACTION_VIEW_HZOOM_1, ACTION_VIEW_HZOOM_IN, ACTION_VIEW_HZOOM_OUT, ACTION_VIEW_HZOOM_MAX, ACTION_VIEW_HZOOM_SEL, ACTION_VIEW_VZOOM_1, ACTION_VIEW_VZOOM_IN, ACTION_VIEW_VZOOM_OUT, ACTION_VIEW_VZOOM_MAX]); return tbhost; } InstrEditorBody createBody() { InstrEditorBody res = new InstrEditorBody(_mixer); return res; } /// map key to action override Action findKeyAction(uint keyCode, uint flags) { Action action = _toolbarHost.findKeyAction(keyCode, flags); if (action) return action; action = _body.findKeyAction(keyCode, flags); if (action) return action; return super.findKeyAction(keyCode, flags); } /// override to implement creation of dialog controls override void initialize() { Log.d("InstrumentEditorDialog.initialize"); _toolbarHost = createToolbars(); _body = createBody(); addChild(_toolbarHost); addChild(_body); } }
D
/** * Module for parsing switch statements. * * License: MIT (https://github.com/Royal Programming Language/bl/blob/master/LICENSE) * * Copyright 2019 © Royal Programming Language - All Rights Reserved. */ module parser.switchparser; import core.tokenizer; import core.errors; import core.debugging; import parser.meta; import parser.tools; import parser.expressionparser; import parser.scopeparser; /// A switch statement. class SwitchStatement { /// The expression of the switch. Expression switchExpression; /// The cases of the switch. CaseStatement[] cases; /// The default case of the switch. CaseStatement defaultCase; /// The final case of the switch. CaseStatement finalCase; } class CaseStatement { /// The values of the case. string[] values; /// Boolean determining whether the case value is a range. bool isRange; /// The scopes of the case. ScopeObject[] scopes; } /** * Parses a switch statement. * Params: * token = The token of the switch statement. * statement = The statement of the switch statement. * source = The source of the switch statement. * Returns: * Returns the switch statement if parsed correctly, null otherwise. */ SwitchStatement parseSwitchStatement(Token token, string source) { import std.array : array; import std.algorithm : map; return parseSwitchStatement(token, token.statement.map!(s => s.s).array, source); } /** * Parses a switch statement. * Params: * token = The token of the switch statement. * statement = The statement of the switch statement. * source = The source of the switch statement. * Returns: * Returns the switch statement if parsed correctly, null otherwise. */ SwitchStatement parseSwitchStatement(Token token, string[] statement, string source) { size_t line = token.retrieveLine; if (!statement || statement.length < 2) { line.printError(source, "Empty switch statement found."); return null; } if (statement[0] != Keyword.SWITCH) { line.printError(source, "Expected '%s' but found '%s'", cast(string)Keyword.SWITCH, statement[0]); return null; } auto expression = statement[1 .. $]; auto switchExpression = parseRightHandExpression(expression ~ ";", source, line, false, false); if (!switchExpression) { line.printError(source, "Invalid switch statement expression."); return null; } auto switchStatement = new SwitchStatement; switchStatement.switchExpression = switchExpression; foreach (child; token.tokens[1 .. $-1]) { if ((!child.statement || !child.statement.length) && (!child.tokens || !child.tokens.length)) { continue; } auto childLine = child.retrieveLine; if (!child.tokens || !child.tokens.length) { childLine.printError(source, "Empty case found: %s", child.statement); return null; } auto caseStatement = new CaseStatement; if (!child.statement || !child.statement.length) { childLine.printError(source, "Expected '%s' but found '%s'", cast(string)Keyword.CASE, child.statement[0]); return null; } else if (child.statement.length == 1) { if (child.statement[0] == Keyword.DEFAULT) { if (switchStatement.defaultCase) { childLine.printError(source, "A switch statement can only have one default scope."); return null; } switchStatement.defaultCase = caseStatement; } else if (child.statement[0] == Keyword.FINAL) { if (switchStatement.finalCase) { childLine.printError(source, "A switch statement can only have one final scope."); return null; } switchStatement.finalCase = caseStatement; } else { childLine.printError(source, "Expected '%s' or '%s' but found '%s'", cast(string)Keyword.DEFAULT, cast(string)Keyword.FINAL, child.statement[1]); return null; } } else if (child.statement[0] != Keyword.CASE) { childLine.printError(source, "Expected '%s' but found '%s'", cast(string)Keyword.CASE, child.statement[0]); return null; } else { if (child.statement.length == 4 && child.statement[2] != ".." && child.statement[2] != ",") { childLine.printError(source, "Expected '%s' or '%s' but found '%s'", ",", "..", child.statement[1]); return null; } if (child.statement.length == 4 && child.statement[2] == "..") { caseStatement.values = [child.statement[0].s, child.statement[1].s]; caseStatement.isRange = true; } else { string lastArg; auto paramIndex = 0; foreach (e; child.statement[1 .. $]) { string entry = e.s; if (entry == ",") { if (!lastArg || !lastArg.length) { childLine.printError(source, "Missing arguments for value: %s", paramIndex); return null; } else { caseStatement.values ~= lastArg; paramIndex++; lastArg = null; } } else if (lastArg) { childLine.printError(source, "Expected '%s' but found '%s'", ",", entry); return null; } else { lastArg = entry; } } if (!lastArg || !lastArg.length) { childLine.printError(source, "Missing arguments for value: %s", paramIndex); return null; } } } setGlobalScopeHandler("case", &handleCaseScope); auto scopeObjects = parseScopes(child, source, line, "case", "case"); removeGlobalScopeHandler("case"); if (scopeObjects && scopeObjects.length) { caseStatement.scopes = scopeObjects.dup; } } return switchStatement; } private: /** * Handles custom scope elements for a switch statement such as "break". * Params: * token = The token to handle. * line = The line of the token. * scopeObject = (ref) The current scope object. * Returns: * Returns true if the scope element was handled and parsed correctly. False otherwise, which will trigger a compiler error. */ bool handleCaseScope(Token token, size_t line, ref ScopeObject scopeObject) { if (!token.statement || token.statement.length < 2) { return false; } switch (token.statement[0].s) { case Keyword.BREAK: if (token.statement.length != 2) { return false; } scopeObject.scopeState = ScopeState.scopeBreak; return true; // TODO: Implement GOTO. // case Keyword.GOTO: // break; default: return false; } }
D
module imageformats.bmp; import std.bitmanip : littleEndianToNative, nativeToLittleEndian; import std.stdio : File, SEEK_SET; import std.math : abs; import std.typecons : scoped; import imageformats; private: immutable bmp_header = ['B', 'M']; public bool detect_bmp(Reader stream) { try { ubyte[18] tmp = void; // bmp header + size of dib header stream.readExact(tmp, tmp.length); size_t ds = littleEndianToNative!uint(tmp[14..18]); return (tmp[0..2] == bmp_header && (ds == 12 || ds == 40 || ds == 52 || ds == 56 || ds == 108 || ds == 124)); } catch (Throwable) { return false; } finally { stream.seek(0, SEEK_SET); } } /// public IFImage read_bmp(in char[] filename, long req_chans = 0) { auto reader = scoped!FileReader(filename); return read_bmp(reader, req_chans); } /// public IFImage read_bmp_from_mem(in ubyte[] source, long req_chans = 0) { auto reader = scoped!MemReader(source); return read_bmp(reader, req_chans); } /// public BMP_Header read_bmp_header(in char[] filename) { auto reader = scoped!FileReader(filename); return read_bmp_header(reader); } /// public BMP_Header read_bmp_header_from_mem(in ubyte[] source) { auto reader = scoped!MemReader(source); return read_bmp_header(reader); } /// public struct BMP_Header { uint file_size; uint pixel_data_offset; uint dib_size; int width; int height; ushort planes; int bits_pp; uint dib_version; DibV1 dib_v1; DibV2 dib_v2; uint dib_v3_alpha_mask; DibV4 dib_v4; DibV5 dib_v5; } /// Part of BMP header, not always present. public struct DibV1 { uint compression; uint idat_size; uint pixels_per_meter_x; uint pixels_per_meter_y; uint palette_length; uint important_color_count; } /// Part of BMP header, not always present. public struct DibV2 { uint red_mask; uint green_mask; uint blue_mask; } /// Part of BMP header, not always present. public struct DibV4 { uint color_space_type; ubyte[36] color_space_endpoints; uint gamma_red; uint gamma_green; uint gamma_blue; } /// Part of BMP header, not always present. public struct DibV5 { uint icc_profile_data; uint icc_profile_size; } /// public void read_bmp_info(in char[] filename, out int w, out int h, out int chans) { auto reader = scoped!FileReader(filename); return read_bmp_info(reader, w, h, chans); } /// public void read_bmp_info_from_mem(in ubyte[] source, out int w, out int h, out int chans) { auto reader = scoped!MemReader(source); return read_bmp_info(reader, w, h, chans); } /// public void write_bmp(in char[] file, long w, long h, in ubyte[] data, long tgt_chans = 0) { auto writer = scoped!FileWriter(file); write_bmp(writer, w, h, data, tgt_chans); } /// public ubyte[] write_bmp_to_mem(long w, long h, in ubyte[] data, long tgt_chans = 0) { auto writer = scoped!MemWriter(); write_bmp(writer, w, h, data, tgt_chans); return writer.result; } BMP_Header read_bmp_header(Reader stream) { ubyte[18] tmp = void; // bmp header + size of dib header stream.readExact(tmp[], tmp.length); if (tmp[0..2] != bmp_header) throw new ImageIOException("corrupt header"); uint dib_size = littleEndianToNative!uint(tmp[14..18]); uint dib_version; switch (dib_size) { case 12: dib_version = 0; break; case 40: dib_version = 1; break; case 52: dib_version = 2; break; case 56: dib_version = 3; break; case 108: dib_version = 4; break; case 124: dib_version = 5; break; default: throw new ImageIOException("unsupported dib version"); } auto dib_header = new ubyte[dib_size-4]; stream.readExact(dib_header[], dib_header.length); DibV1 dib_v1; DibV2 dib_v2; uint dib_v3_alpha_mask; DibV4 dib_v4; DibV5 dib_v5; if (1 <= dib_version) { DibV1 v1 = { compression : littleEndianToNative!uint(dib_header[12..16]), idat_size : littleEndianToNative!uint(dib_header[16..20]), pixels_per_meter_x : littleEndianToNative!uint(dib_header[20..24]), pixels_per_meter_y : littleEndianToNative!uint(dib_header[24..28]), palette_length : littleEndianToNative!uint(dib_header[28..32]), important_color_count : littleEndianToNative!uint(dib_header[32..36]), }; dib_v1 = v1; } if (2 <= dib_version) { DibV2 v2 = { red_mask : littleEndianToNative!uint(dib_header[36..40]), green_mask : littleEndianToNative!uint(dib_header[40..44]), blue_mask : littleEndianToNative!uint(dib_header[44..48]), }; dib_v2 = v2; } if (3 <= dib_version) { dib_v3_alpha_mask = littleEndianToNative!uint(dib_header[48..52]); } if (4 <= dib_version) { DibV4 v4 = { color_space_type : littleEndianToNative!uint(dib_header[52..56]), color_space_endpoints : dib_header[56..92], gamma_red : littleEndianToNative!uint(dib_header[92..96]), gamma_green : littleEndianToNative!uint(dib_header[96..100]), gamma_blue : littleEndianToNative!uint(dib_header[100..104]), }; dib_v4 = v4; } if (5 <= dib_version) { DibV5 v5 = { icc_profile_data : littleEndianToNative!uint(dib_header[108..112]), icc_profile_size : littleEndianToNative!uint(dib_header[112..116]), }; dib_v5 = v5; } int width, height; ushort planes; int bits_pp; if (0 == dib_version) { width = littleEndianToNative!ushort(dib_header[0..2]); height = littleEndianToNative!ushort(dib_header[2..4]); planes = littleEndianToNative!ushort(dib_header[4..6]); bits_pp = littleEndianToNative!ushort(dib_header[6..8]); } else { width = littleEndianToNative!int(dib_header[0..4]); height = littleEndianToNative!int(dib_header[4..8]); planes = littleEndianToNative!ushort(dib_header[8..10]); bits_pp = littleEndianToNative!ushort(dib_header[10..12]); } BMP_Header header = { file_size : littleEndianToNative!uint(tmp[2..6]), pixel_data_offset : littleEndianToNative!uint(tmp[10..14]), width : width, height : height, planes : planes, bits_pp : bits_pp, dib_version : dib_version, dib_v1 : dib_v1, dib_v2 : dib_v2, dib_v3_alpha_mask : dib_v3_alpha_mask, dib_v4 : dib_v4, dib_v5 : dib_v5, }; return header; } enum CMP_RGB = 0; enum CMP_BITS = 3; package IFImage read_bmp(Reader stream, long req_chans = 0) { if (req_chans < 0 || 4 < req_chans) throw new ImageIOException("unknown color format"); BMP_Header hdr = read_bmp_header(stream); if (hdr.width < 1 || hdr.height == 0) { throw new ImageIOException("invalid dimensions"); } if (hdr.pixel_data_offset < (14 + hdr.dib_size) || hdr.pixel_data_offset > 0xffffff /* arbitrary */) { throw new ImageIOException("invalid pixel data offset"); } if (hdr.planes != 1) { throw new ImageIOException("not supported"); } auto bytes_pp = 1; bool paletted = true; size_t palette_length = 256; bool rgb_masked = false; auto pe_bytes_pp = 3; if (1 <= hdr.dib_version) { if (256 < hdr.dib_v1.palette_length) throw new ImageIOException("ivnalid palette length"); if (hdr.bits_pp <= 8 && (hdr.dib_v1.palette_length == 0 || hdr.dib_v1.compression != CMP_RGB)) throw new ImageIOException("unsupported format"); if (hdr.dib_v1.compression != CMP_RGB && hdr.dib_v1.compression != CMP_BITS) throw new ImageIOException("unsupported compression"); switch (hdr.bits_pp) { case 8 : bytes_pp = 1; paletted = true; break; case 24 : bytes_pp = 3; paletted = false; break; case 32 : bytes_pp = 4; paletted = false; break; default: throw new ImageIOException("not supported"); } palette_length = hdr.dib_v1.palette_length; rgb_masked = hdr.dib_v1.compression == CMP_BITS; pe_bytes_pp = 4; } size_t mask_to_idx(uint mask) { switch (mask) { case 0xff00_0000: return 3; case 0x00ff_0000: return 2; case 0x0000_ff00: return 1; case 0x0000_00ff: return 0; default: throw new ImageIOException("unsupported mask"); } } size_t redi = 2; size_t greeni = 1; size_t bluei = 0; if (rgb_masked) { if (hdr.dib_version < 2) throw new ImageIOException("invalid format"); redi = mask_to_idx(hdr.dib_v2.red_mask); greeni = mask_to_idx(hdr.dib_v2.green_mask); bluei = mask_to_idx(hdr.dib_v2.blue_mask); } bool alpha_masked = false; size_t alphai = 0; if (bytes_pp == 4 && 3 <= hdr.dib_version && hdr.dib_v3_alpha_mask != 0) { alpha_masked = true; alphai = mask_to_idx(hdr.dib_v3_alpha_mask); } ubyte[] depaletted_line = null; ubyte[] palette = null; if (paletted) { depaletted_line = new ubyte[hdr.width * pe_bytes_pp]; palette = new ubyte[palette_length * pe_bytes_pp]; stream.readExact(palette[], palette.length); } stream.seek(hdr.pixel_data_offset, SEEK_SET); immutable tgt_chans = (0 < req_chans) ? req_chans : (alpha_masked) ? _ColFmt.RGBA : _ColFmt.RGB; const src_fmt = (!paletted || pe_bytes_pp == 4) ? _ColFmt.BGRA : _ColFmt.BGR; const LineConv!ubyte convert = get_converter!ubyte(src_fmt, tgt_chans); immutable size_t src_linesize = hdr.width * bytes_pp; // without padding immutable size_t src_pad = 3 - ((src_linesize-1) % 4); immutable ptrdiff_t tgt_linesize = (hdr.width * cast(int) tgt_chans); immutable ptrdiff_t tgt_stride = (hdr.height < 0) ? tgt_linesize : -tgt_linesize; ptrdiff_t ti = (hdr.height < 0) ? 0 : (hdr.height-1) * tgt_linesize; auto src_line_buf = new ubyte[src_linesize + src_pad]; auto bgra_line_buf = (paletted) ? null : new ubyte[hdr.width * 4]; auto result = new ubyte[hdr.width * abs(hdr.height) * cast(int) tgt_chans]; foreach (_; 0 .. abs(hdr.height)) { stream.readExact(src_line_buf[], src_line_buf.length); auto src_line = src_line_buf[0..src_linesize]; if (paletted) { size_t ps = pe_bytes_pp; size_t di = 0; foreach (idx; src_line[]) { if (idx > palette_length) throw new ImageIOException("invalid palette index"); size_t i = idx * ps; depaletted_line[di .. di+ps] = palette[i .. i+ps]; if (ps == 4) { depaletted_line[di+3] = 255; } di += ps; } convert(depaletted_line[], result[ti .. (ti+tgt_linesize)]); } else { for (size_t si, di; si < src_line.length; si+=bytes_pp, di+=4) { bgra_line_buf[di + 0] = src_line[si + bluei]; bgra_line_buf[di + 1] = src_line[si + greeni]; bgra_line_buf[di + 2] = src_line[si + redi]; bgra_line_buf[di + 3] = (alpha_masked) ? src_line[si + alphai] : 255; } convert(bgra_line_buf[], result[ti .. (ti+tgt_linesize)]); } ti += tgt_stride; } IFImage ret = { w : hdr.width, h : abs(hdr.height), c : cast(ColFmt) tgt_chans, pixels : result, }; return ret; } package void read_bmp_info(Reader stream, out int w, out int h, out int chans) { BMP_Header hdr = read_bmp_header(stream); w = abs(hdr.width); h = abs(hdr.height); chans = (hdr.dib_version >= 3 && hdr.dib_v3_alpha_mask != 0 && hdr.bits_pp == 32) ? ColFmt.RGBA : ColFmt.RGB; } // ---------------------------------------------------------------------- // BMP encoder // Writes RGB or RGBA data. void write_bmp(Writer stream, long w, long h, in ubyte[] data, long tgt_chans = 0) { if (w < 1 || h < 1 || 0x7fff < w || 0x7fff < h) throw new ImageIOException("invalid dimensions"); size_t src_chans = data.length / cast(size_t) w / cast(size_t) h; if (src_chans < 1 || 4 < src_chans) throw new ImageIOException("invalid channel count"); if (tgt_chans != 0 && tgt_chans != 3 && tgt_chans != 4) throw new ImageIOException("unsupported format for writing"); if (src_chans * w * h != data.length) throw new ImageIOException("mismatching dimensions and length"); if (tgt_chans == 0) tgt_chans = (src_chans == 1 || src_chans == 3) ? 3 : 4; const dib_size = 108; const size_t tgt_linesize = cast(size_t) (w * tgt_chans); const size_t pad = 3 - ((tgt_linesize-1) & 3); const size_t idat_offset = 14 + dib_size; // bmp file header + dib header const size_t filesize = idat_offset + cast(size_t) h * (tgt_linesize + pad); if (filesize > 0xffff_ffff) { throw new ImageIOException("image too large"); } ubyte[14+dib_size] hdr; hdr[0] = 0x42; hdr[1] = 0x4d; hdr[2..6] = nativeToLittleEndian(cast(uint) filesize); hdr[6..10] = 0; // reserved hdr[10..14] = nativeToLittleEndian(cast(uint) idat_offset); // offset of pixel data hdr[14..18] = nativeToLittleEndian(cast(uint) dib_size); // dib header size hdr[18..22] = nativeToLittleEndian(cast(int) w); hdr[22..26] = nativeToLittleEndian(cast(int) h); // positive -> bottom-up hdr[26..28] = nativeToLittleEndian(cast(ushort) 1); // planes hdr[28..30] = nativeToLittleEndian(cast(ushort) (tgt_chans * 8)); // bits per pixel hdr[30..34] = nativeToLittleEndian((tgt_chans == 3) ? CMP_RGB : CMP_BITS); hdr[34..54] = 0; // rest of dib v1 if (tgt_chans == 3) { hdr[54..70] = 0; // dib v2 and v3 } else { static immutable ubyte[16] b = [ 0, 0, 0xff, 0, 0, 0xff, 0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0xff ]; hdr[54..70] = b; } static immutable ubyte[4] BGRs = ['B', 'G', 'R', 's']; hdr[70..74] = BGRs; hdr[74..122] = 0; stream.rawWrite(hdr); const LineConv!ubyte convert = get_converter!ubyte(src_chans, (tgt_chans == 3) ? _ColFmt.BGR : _ColFmt.BGRA); auto tgt_line = new ubyte[tgt_linesize + pad]; const size_t src_linesize = cast(size_t) w * src_chans; size_t si = cast(size_t) h * src_linesize; foreach (_; 0..h) { si -= src_linesize; convert(data[si .. si + src_linesize], tgt_line[0..tgt_linesize]); stream.rawWrite(tgt_line); } stream.flush(); }
D
module mach.sys.memory; private: import core.exception : OutOfMemoryError; import core.stdc.stdlib : cmalloc = malloc; import core.stdc.stdlib : cfree = free; import core.stdc.string : cmemcpy = memcpy; import core.stdc.string : cmemmove = memmove; static immutable OOMError = new OutOfMemoryError(); @nogc nothrow public: T* malloc(T)(){ auto ptr = cmalloc(T.sizeof); if(ptr is null) throw OOMError; return cast(T*) ptr; } void free(T)(T* ptr) in{ assert(ptr !is null, "Cannot free null pointer."); }body{ cfree(ptr); } auto memcpy(A, B)(A* dest, in B* src, in size_t count) in{ assert(src !is null, "Cannot memcpy from null pointer."); assert(dest !is null, "Cannot memcpy to null pointer."); }body{ return cast(A*) cmemcpy(dest, src, count); } auto memmove(A, B)(A* dest, in B* src, in size_t count) in{ assert(src !is null, "Cannot memmove from null pointer."); assert(dest !is null, "Cannot memmove to null pointer."); }body{ return cast(A*) cmemmove(dest, src, count); }
D
/** * D Documentation Generator * Copyright: © 2014 Economic Modeling Specialists, Intl., © 2015 Ferdinand Majerech * Authors: Brian Schott, Ferdinand Majerech * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt Boost License 1.0) */ module item; import formatter; import std.algorithm; import std.array: appender, empty, array; import dparse.ast; import std.string: format; struct Item { string url; string name; string summary; string type; /// AST node of the item. Only used for functions at the moment. const ASTNode node; } struct Members { Item[] aliases; Item[] classes; Item[] enums; Item[] functions; Item[] interfaces; Item[] structs; Item[] templates; Item[] values; Item[] variables; Item[] publicImports; void writeImports(R, Writer)(ref R dst, Writer writer) { if(publicImports.empty) { return; } writer.writeSection(dst, { writer.writeList(dst, "Public imports", { foreach(imp; publicImports) writer.writeListItem(dst, { if(imp.url is null) { dst.put(imp.name); } else writer.writeLink(dst, imp.url, { dst.put(imp.name); }); }); }); }, "imports"); } /// Write the table of members for a class/struct/module/etc. void write(R, Writer)(ref R dst, Writer writer) { if (aliases.empty && classes.empty && enums.empty && functions.empty && interfaces.empty && structs.empty && templates.empty && values.empty && variables.empty) { return; } writer.writeSection(dst, { if(!enums.empty) writer.writeItems(dst, enums, "Enums"); if(!aliases.empty) writer.writeItems(dst, aliases, "Aliases"); if(!variables.empty) writer.writeItems(dst, variables, "Variables"); if(!functions.empty) writer.writeItems(dst, functions, "Functions"); if(!structs.empty) writer.writeItems(dst, structs, "Structs"); if(!interfaces.empty) writer.writeItems(dst, interfaces, "Interfaces"); if(!classes.empty) writer.writeItems(dst, classes, "Classes"); if(!templates.empty) writer.writeItems(dst, templates, "Templates"); if(!values.empty) writer.writeItems(dst, values, "Values"); }, "members"); } }
D
/Users/liujianhao/code/rust/simple_web_app/simple_web_app/target/rls/debug/deps/atty-02dbc4733aaefb4f.rmeta: /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/atty-0.2.14/src/lib.rs /Users/liujianhao/code/rust/simple_web_app/simple_web_app/target/rls/debug/deps/atty-02dbc4733aaefb4f.d: /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/atty-0.2.14/src/lib.rs /Users/liujianhao/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/atty-0.2.14/src/lib.rs:
D
module nxt.array_stack; /** Stack. See_Also: http://forum.dlang.org/thread/wswbtzakdvpgaebuhbom@forum.dlang.org */ import nxt.container.dynamic_array : Stack = DynamicArray; @safe pure nothrow @nogc unittest { alias T = uint; Stack!T s; assert(s.empty); // insertBack: s.insertBack(13U); assert(!s.empty); assert(s.back == 13); s.insertBack(14U); assert(!s.empty); assert(s.back == 14); s.insertBack(15U); assert(!s.empty); assert(s.back == 15); // popBack: s.popBack(); assert(!s.empty); assert(s.back == 14); s.popBack(); assert(!s.empty); assert(s.back == 13); s.popBack(); assert(s.empty); // insertBack: s.insertBack(13U, 14U, 15U); assert(!s.empty); assert(s.back == 15); // takeBack: assert(s.takeBack() == 15); assert(s.takeBack() == 14); assert(s.takeBack() == 13); assert(s.empty); }
D
/Users/kenjou/Documents/SimpleToDo/SimpleTodo/Build/Intermediates/SimpleTodo.build/Debug-iphonesimulator/SimpleTodo.build/Objects-normal/x86_64/EditViewController.o : /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/FontSizeViewController.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/MainViewController.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/AppDelegate.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/AddViewController.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/SettingViewController.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/Item.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/Item+CoreDataProperties.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/EditViewController.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/GadController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Firebase/Analytics/Sources/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule ./GoogleMobileAds.framework/Headers/GADRewardBasedVideoAdDelegate.h ./GoogleMobileAds.framework/Headers/GADRewardBasedVideoAd.h ./GoogleMobileAds.framework/Headers/GADAdReward.h ./GoogleMobileAds.framework/Headers/GADSearchRequest.h ./GoogleMobileAds.framework/Headers/GADSearchBannerView.h ./GoogleMobileAds.framework/Headers/GADDynamicHeightSearchRequest.h ./GoogleMobileAds.framework/Headers/GADMediatedNativeContentAd.h ./GoogleMobileAds.framework/Headers/GADMediatedNativeAppInstallAd.h ./GoogleMobileAds.framework/Headers/GADMediatedNativeAdNotificationSource.h ./GoogleMobileAds.framework/Headers/GADCustomEventParameters.h ./GoogleMobileAds.framework/Headers/GADMediatedNativeAdDelegate.h ./GoogleMobileAds.framework/Headers/GADMediatedNativeAd.h ./GoogleMobileAds.framework/Headers/GADCustomEventNativeAdDelegate.h ./GoogleMobileAds.framework/Headers/GADCustomEventNativeAd.h ./GoogleMobileAds.framework/Headers/GADCustomEventInterstitialDelegate.h ./GoogleMobileAds.framework/Headers/GADCustomEventInterstitial.h ./GoogleMobileAds.framework/Headers/GADCustomEventExtras.h ./GoogleMobileAds.framework/Headers/GADCustomEventRequest.h ./GoogleMobileAds.framework/Headers/GADCustomEventBannerDelegate.h ./GoogleMobileAds.framework/Headers/GADCustomEventBanner.h ./GoogleMobileAds.framework/Headers/GADNativeAdImageAdLoaderOptions.h ./GoogleMobileAds.framework/Headers/GADNativeCustomTemplateAd.h ./GoogleMobileAds.framework/Headers/GADNativeContentAd.h ./GoogleMobileAds.framework/Headers/GADNativeAppInstallAd.h ./GoogleMobileAds.framework/Headers/GADNativeAdImage+Mediation.h ./GoogleMobileAds.framework/Headers/GADNativeAdImage.h ./GoogleMobileAds.framework/Headers/GADNativeAdDelegate.h ./GoogleMobileAds.framework/Headers/GADNativeAd.h ./GoogleMobileAds.framework/Headers/GADAdLoaderAdTypes.h ./GoogleMobileAds.framework/Headers/DFPRequest.h ./GoogleMobileAds.framework/Headers/DFPInterstitial.h ./GoogleMobileAds.framework/Headers/DFPCustomRenderedInterstitialDelegate.h ./GoogleMobileAds.framework/Headers/DFPCustomRenderedAd.h ./GoogleMobileAds.framework/Headers/GADAppEventDelegate.h ./GoogleMobileAds.framework/Headers/DFPCustomRenderedBannerViewDelegate.h ./GoogleMobileAds.framework/Headers/DFPBannerView.h ./GoogleMobileAds.framework/Headers/GADVideoOptions.h ./GoogleMobileAds.framework/Headers/GADVideoControllerDelegate.h ./GoogleMobileAds.framework/Headers/GADVideoController.h ./GoogleMobileAds.framework/Headers/GADNativeExpressAdViewDelegate.h ./GoogleMobileAds.framework/Headers/GADNativeExpressAdView.h ./GoogleMobileAds.framework/Headers/GADMobileAds.h ./GoogleMobileAds.framework/Headers/GADMediaView.h ./GoogleMobileAds.framework/Headers/GADInterstitialDelegate.h ./GoogleMobileAds.framework/Headers/GADInterstitial.h ./GoogleMobileAds.framework/Headers/GADInAppPurchase.h ./GoogleMobileAds.framework/Headers/GADExtras.h ./GoogleMobileAds.framework/Headers/GADAdLoaderDelegate.h ./GoogleMobileAds.framework/Headers/GADAdLoader.h ./GoogleMobileAds.framework/Headers/GADCorrelatorAdLoaderOptions.h ./GoogleMobileAds.framework/Headers/GADCorrelator.h ./GoogleMobileAds.framework/Headers/GADRequestError.h ./GoogleMobileAds.framework/Headers/GADRequest.h ./GoogleMobileAds.framework/Headers/GADInAppPurchaseDelegate.h ./GoogleMobileAds.framework/Headers/GADBannerViewDelegate.h ./GoogleMobileAds.framework/Headers/GADAdSizeDelegate.h ./GoogleMobileAds.framework/Headers/GADBannerView.h ./GoogleMobileAds.framework/Headers/GADAdSize.h ./GoogleMobileAds.framework/Headers/GADAdNetworkExtras.h ./GoogleMobileAds.framework/Headers/GADAdDelegate.h ./GoogleMobileAds.framework/Headers/GoogleMobileAdsDefines.h ./GoogleMobileAds.framework/Headers/GoogleMobileAds.h ./GoogleMobileAds.framework/Modules/module.modulemap /Users/kenjou/Documents/SimpleToDo/SimpleTodo/GoogleMobileAds.framework/Modules/module.modulemap /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseInstanceID/FirebaseInstanceID/FIRInstanceID.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseInstanceID/FirebaseInstanceID/FirebaseInstanceID.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIROptions.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRConfiguration.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRApp.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRAnalyticsConfiguration.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRUserPropertyNames.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRParameterNames.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIREventNames.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRAnalytics.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRAnalytics+AppDelegate.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FirebaseAnalytics.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Firebase/Analytics/Sources/Firebase.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Build/Intermediates/SimpleTodo.build/Debug-iphonesimulator/SimpleTodo.build/Objects-normal/x86_64/EditViewController~partial.swiftmodule : /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/FontSizeViewController.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/MainViewController.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/AppDelegate.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/AddViewController.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/SettingViewController.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/Item.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/Item+CoreDataProperties.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/EditViewController.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/GadController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Firebase/Analytics/Sources/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule ./GoogleMobileAds.framework/Headers/GADRewardBasedVideoAdDelegate.h ./GoogleMobileAds.framework/Headers/GADRewardBasedVideoAd.h ./GoogleMobileAds.framework/Headers/GADAdReward.h ./GoogleMobileAds.framework/Headers/GADSearchRequest.h ./GoogleMobileAds.framework/Headers/GADSearchBannerView.h ./GoogleMobileAds.framework/Headers/GADDynamicHeightSearchRequest.h ./GoogleMobileAds.framework/Headers/GADMediatedNativeContentAd.h ./GoogleMobileAds.framework/Headers/GADMediatedNativeAppInstallAd.h ./GoogleMobileAds.framework/Headers/GADMediatedNativeAdNotificationSource.h ./GoogleMobileAds.framework/Headers/GADCustomEventParameters.h ./GoogleMobileAds.framework/Headers/GADMediatedNativeAdDelegate.h ./GoogleMobileAds.framework/Headers/GADMediatedNativeAd.h ./GoogleMobileAds.framework/Headers/GADCustomEventNativeAdDelegate.h ./GoogleMobileAds.framework/Headers/GADCustomEventNativeAd.h ./GoogleMobileAds.framework/Headers/GADCustomEventInterstitialDelegate.h ./GoogleMobileAds.framework/Headers/GADCustomEventInterstitial.h ./GoogleMobileAds.framework/Headers/GADCustomEventExtras.h ./GoogleMobileAds.framework/Headers/GADCustomEventRequest.h ./GoogleMobileAds.framework/Headers/GADCustomEventBannerDelegate.h ./GoogleMobileAds.framework/Headers/GADCustomEventBanner.h ./GoogleMobileAds.framework/Headers/GADNativeAdImageAdLoaderOptions.h ./GoogleMobileAds.framework/Headers/GADNativeCustomTemplateAd.h ./GoogleMobileAds.framework/Headers/GADNativeContentAd.h ./GoogleMobileAds.framework/Headers/GADNativeAppInstallAd.h ./GoogleMobileAds.framework/Headers/GADNativeAdImage+Mediation.h ./GoogleMobileAds.framework/Headers/GADNativeAdImage.h ./GoogleMobileAds.framework/Headers/GADNativeAdDelegate.h ./GoogleMobileAds.framework/Headers/GADNativeAd.h ./GoogleMobileAds.framework/Headers/GADAdLoaderAdTypes.h ./GoogleMobileAds.framework/Headers/DFPRequest.h ./GoogleMobileAds.framework/Headers/DFPInterstitial.h ./GoogleMobileAds.framework/Headers/DFPCustomRenderedInterstitialDelegate.h ./GoogleMobileAds.framework/Headers/DFPCustomRenderedAd.h ./GoogleMobileAds.framework/Headers/GADAppEventDelegate.h ./GoogleMobileAds.framework/Headers/DFPCustomRenderedBannerViewDelegate.h ./GoogleMobileAds.framework/Headers/DFPBannerView.h ./GoogleMobileAds.framework/Headers/GADVideoOptions.h ./GoogleMobileAds.framework/Headers/GADVideoControllerDelegate.h ./GoogleMobileAds.framework/Headers/GADVideoController.h ./GoogleMobileAds.framework/Headers/GADNativeExpressAdViewDelegate.h ./GoogleMobileAds.framework/Headers/GADNativeExpressAdView.h ./GoogleMobileAds.framework/Headers/GADMobileAds.h ./GoogleMobileAds.framework/Headers/GADMediaView.h ./GoogleMobileAds.framework/Headers/GADInterstitialDelegate.h ./GoogleMobileAds.framework/Headers/GADInterstitial.h ./GoogleMobileAds.framework/Headers/GADInAppPurchase.h ./GoogleMobileAds.framework/Headers/GADExtras.h ./GoogleMobileAds.framework/Headers/GADAdLoaderDelegate.h ./GoogleMobileAds.framework/Headers/GADAdLoader.h ./GoogleMobileAds.framework/Headers/GADCorrelatorAdLoaderOptions.h ./GoogleMobileAds.framework/Headers/GADCorrelator.h ./GoogleMobileAds.framework/Headers/GADRequestError.h ./GoogleMobileAds.framework/Headers/GADRequest.h ./GoogleMobileAds.framework/Headers/GADInAppPurchaseDelegate.h ./GoogleMobileAds.framework/Headers/GADBannerViewDelegate.h ./GoogleMobileAds.framework/Headers/GADAdSizeDelegate.h ./GoogleMobileAds.framework/Headers/GADBannerView.h ./GoogleMobileAds.framework/Headers/GADAdSize.h ./GoogleMobileAds.framework/Headers/GADAdNetworkExtras.h ./GoogleMobileAds.framework/Headers/GADAdDelegate.h ./GoogleMobileAds.framework/Headers/GoogleMobileAdsDefines.h ./GoogleMobileAds.framework/Headers/GoogleMobileAds.h ./GoogleMobileAds.framework/Modules/module.modulemap /Users/kenjou/Documents/SimpleToDo/SimpleTodo/GoogleMobileAds.framework/Modules/module.modulemap /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseInstanceID/FirebaseInstanceID/FIRInstanceID.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseInstanceID/FirebaseInstanceID/FirebaseInstanceID.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIROptions.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRConfiguration.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRApp.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRAnalyticsConfiguration.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRUserPropertyNames.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRParameterNames.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIREventNames.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRAnalytics.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRAnalytics+AppDelegate.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FirebaseAnalytics.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Firebase/Analytics/Sources/Firebase.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Build/Intermediates/SimpleTodo.build/Debug-iphonesimulator/SimpleTodo.build/Objects-normal/x86_64/EditViewController~partial.swiftdoc : /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/FontSizeViewController.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/MainViewController.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/AppDelegate.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/AddViewController.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/SettingViewController.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/Item.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/Item+CoreDataProperties.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/EditViewController.swift /Users/kenjou/Documents/SimpleToDo/SimpleTodo/SimpleTodo/GadController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Firebase/Analytics/Sources/module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreData.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule ./GoogleMobileAds.framework/Headers/GADRewardBasedVideoAdDelegate.h ./GoogleMobileAds.framework/Headers/GADRewardBasedVideoAd.h ./GoogleMobileAds.framework/Headers/GADAdReward.h ./GoogleMobileAds.framework/Headers/GADSearchRequest.h ./GoogleMobileAds.framework/Headers/GADSearchBannerView.h ./GoogleMobileAds.framework/Headers/GADDynamicHeightSearchRequest.h ./GoogleMobileAds.framework/Headers/GADMediatedNativeContentAd.h ./GoogleMobileAds.framework/Headers/GADMediatedNativeAppInstallAd.h ./GoogleMobileAds.framework/Headers/GADMediatedNativeAdNotificationSource.h ./GoogleMobileAds.framework/Headers/GADCustomEventParameters.h ./GoogleMobileAds.framework/Headers/GADMediatedNativeAdDelegate.h ./GoogleMobileAds.framework/Headers/GADMediatedNativeAd.h ./GoogleMobileAds.framework/Headers/GADCustomEventNativeAdDelegate.h ./GoogleMobileAds.framework/Headers/GADCustomEventNativeAd.h ./GoogleMobileAds.framework/Headers/GADCustomEventInterstitialDelegate.h ./GoogleMobileAds.framework/Headers/GADCustomEventInterstitial.h ./GoogleMobileAds.framework/Headers/GADCustomEventExtras.h ./GoogleMobileAds.framework/Headers/GADCustomEventRequest.h ./GoogleMobileAds.framework/Headers/GADCustomEventBannerDelegate.h ./GoogleMobileAds.framework/Headers/GADCustomEventBanner.h ./GoogleMobileAds.framework/Headers/GADNativeAdImageAdLoaderOptions.h ./GoogleMobileAds.framework/Headers/GADNativeCustomTemplateAd.h ./GoogleMobileAds.framework/Headers/GADNativeContentAd.h ./GoogleMobileAds.framework/Headers/GADNativeAppInstallAd.h ./GoogleMobileAds.framework/Headers/GADNativeAdImage+Mediation.h ./GoogleMobileAds.framework/Headers/GADNativeAdImage.h ./GoogleMobileAds.framework/Headers/GADNativeAdDelegate.h ./GoogleMobileAds.framework/Headers/GADNativeAd.h ./GoogleMobileAds.framework/Headers/GADAdLoaderAdTypes.h ./GoogleMobileAds.framework/Headers/DFPRequest.h ./GoogleMobileAds.framework/Headers/DFPInterstitial.h ./GoogleMobileAds.framework/Headers/DFPCustomRenderedInterstitialDelegate.h ./GoogleMobileAds.framework/Headers/DFPCustomRenderedAd.h ./GoogleMobileAds.framework/Headers/GADAppEventDelegate.h ./GoogleMobileAds.framework/Headers/DFPCustomRenderedBannerViewDelegate.h ./GoogleMobileAds.framework/Headers/DFPBannerView.h ./GoogleMobileAds.framework/Headers/GADVideoOptions.h ./GoogleMobileAds.framework/Headers/GADVideoControllerDelegate.h ./GoogleMobileAds.framework/Headers/GADVideoController.h ./GoogleMobileAds.framework/Headers/GADNativeExpressAdViewDelegate.h ./GoogleMobileAds.framework/Headers/GADNativeExpressAdView.h ./GoogleMobileAds.framework/Headers/GADMobileAds.h ./GoogleMobileAds.framework/Headers/GADMediaView.h ./GoogleMobileAds.framework/Headers/GADInterstitialDelegate.h ./GoogleMobileAds.framework/Headers/GADInterstitial.h ./GoogleMobileAds.framework/Headers/GADInAppPurchase.h ./GoogleMobileAds.framework/Headers/GADExtras.h ./GoogleMobileAds.framework/Headers/GADAdLoaderDelegate.h ./GoogleMobileAds.framework/Headers/GADAdLoader.h ./GoogleMobileAds.framework/Headers/GADCorrelatorAdLoaderOptions.h ./GoogleMobileAds.framework/Headers/GADCorrelator.h ./GoogleMobileAds.framework/Headers/GADRequestError.h ./GoogleMobileAds.framework/Headers/GADRequest.h ./GoogleMobileAds.framework/Headers/GADInAppPurchaseDelegate.h ./GoogleMobileAds.framework/Headers/GADBannerViewDelegate.h ./GoogleMobileAds.framework/Headers/GADAdSizeDelegate.h ./GoogleMobileAds.framework/Headers/GADBannerView.h ./GoogleMobileAds.framework/Headers/GADAdSize.h ./GoogleMobileAds.framework/Headers/GADAdNetworkExtras.h ./GoogleMobileAds.framework/Headers/GADAdDelegate.h ./GoogleMobileAds.framework/Headers/GoogleMobileAdsDefines.h ./GoogleMobileAds.framework/Headers/GoogleMobileAds.h ./GoogleMobileAds.framework/Modules/module.modulemap /Users/kenjou/Documents/SimpleToDo/SimpleTodo/GoogleMobileAds.framework/Modules/module.modulemap /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseInstanceID/FirebaseInstanceID/FIRInstanceID.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseInstanceID/FirebaseInstanceID/FirebaseInstanceID.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIROptions.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRConfiguration.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRApp.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRAnalyticsConfiguration.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRUserPropertyNames.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRParameterNames.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIREventNames.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRAnalytics.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FIRAnalytics+AppDelegate.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Headers/Public/FirebaseAnalytics/FirebaseAnalytics/FirebaseAnalytics.h /Users/kenjou/Documents/SimpleToDo/SimpleTodo/Pods/Firebase/Analytics/Sources/Firebase.h
D
// @file exception4.d import std.stdio; void main(){ try{ // Block of code to try // ... // And if something goes wrong, we can 'throw' throw new Exception("Something exceptional happened"); } catch(Exception e) { // Generic catch any 'Exception' // Goal is to log or otherwise handle exception } finally { // Potentially free/release resources // Last block that will always run writeln("This block always executes"); } }
D
/** * State manager thing */ module game.state.States; import game.state.model.IState; /** * States class */ public class States { /** * The map of states */ private IState[string] states; /** * The current state */ private string cur_state; /** * Constructor * * Params: * states = The states to manage */ public this ( IState[string] states ) in { assert(states.length > 0 ); } body { this.states = states; } /** * Initialize the states */ public void init ( ) { foreach ( _, state; this.states ) { state.init(); } } /** * Set the current state to use, and reset the one in use * * Params: * state = The key of the state */ public void setState ( string state ) { if ( this.cur_state.length > 0 ) { this.current().reset(); } this.cur_state = state; } /** * Get the current state * * Returns: * The current state */ public IState current ( ) in { assert(cur_state.length > 0 && cur_state in this.states); } body { return this.states[this.cur_state]; } public alias opCall = current; }
D
instance DIA_BARTOK_EXIT(C_INFO) { npc = vlk_440_bartok; nr = 999; condition = dia_bartok_exit_condition; information = dia_bartok_exit_info; permanent = TRUE; description = DIALOG_ENDE; }; func int dia_bartok_exit_condition() { return TRUE; }; func void dia_bartok_exit_info() { AI_StopProcessInfos(self); }; instance DIA_BARTOK_PICKPOCKET(C_INFO) { npc = vlk_440_bartok; nr = 900; condition = dia_bartok_pickpocket_condition; information = dia_bartok_pickpocket_info; permanent = TRUE; description = "(Украсть его колчан со стрелами будет просто)"; }; func int dia_bartok_pickpocket_condition() { if((Npc_GetTalentSkill(other,NPC_TALENT_PICKPOCKET) == 1) && (self.aivar[AIV_PLAYERHASPICKEDMYPOCKET] == FALSE) && (Npc_HasItems(self,itrw_arrow) >= 40) && (other.attribute[ATR_DEXTERITY] >= (30 - THEFTDIFF))) { return TRUE; }; }; func void dia_bartok_pickpocket_info() { Info_ClearChoices(dia_bartok_pickpocket); Info_AddChoice(dia_bartok_pickpocket,DIALOG_BACK,dia_bartok_pickpocket_back); Info_AddChoice(dia_bartok_pickpocket,DIALOG_PICKPOCKET,dia_bartok_pickpocket_doit); }; func void dia_bartok_pickpocket_doit() { if(other.attribute[ATR_DEXTERITY] >= 30) { b_giveinvitems(self,other,itrw_arrow,40); self.aivar[AIV_PLAYERHASPICKEDMYPOCKET] = TRUE; b_giveplayerxp(XP_AMBIENT); Info_ClearChoices(dia_bartok_pickpocket); } else { AI_StopProcessInfos(self); b_attack(self,other,AR_THEFT,1); }; }; func void dia_bartok_pickpocket_back() { Info_ClearChoices(dia_bartok_pickpocket); }; instance DIA_BARTOK_HALLO(C_INFO) { npc = vlk_440_bartok; nr = 1; condition = dia_bartok_hallo_condition; information = dia_bartok_hallo_info; permanent = FALSE; description = "Как дела?"; }; func int dia_bartok_hallo_condition() { return TRUE; }; func void dia_bartok_hallo_info() { AI_Output(other,self,"DIA_Bartok_Hello_15_00"); //Как дела? AI_Output(self,other,"DIA_Bartok_Hello_04_01"); //Ты ведь нездешний, да? Ничего - я тоже. AI_Output(other,self,"DIA_Bartok_Hello_15_02"); //А откуда ты пришел? AI_Output(self,other,"DIA_Bartok_Hello_04_03"); //Из леса, я там охотился на падальщиков и волков вместе с другими охотниками. AI_Output(self,other,"DIA_Bartok_Hello_04_04"); //Но я бросил это занятие. Настали опасные времена. Повсюду шатается всякий сброд... }; instance DIA_BARTOK_JAEGER(C_INFO) { npc = vlk_440_bartok; nr = 2; condition = dia_bartok_jaeger_condition; information = dia_bartok_jaeger_info; permanent = FALSE; description = "Где мне найти других охотников?"; }; func int dia_bartok_jaeger_condition() { if(Npc_KnowsInfo(other,dia_bartok_hallo)) { return TRUE; }; }; func void dia_bartok_jaeger_info() { AI_Output(other,self,"DIA_Bartok_Jager_15_00"); //Где мне найти других охотников? AI_Output(self,other,"DIA_Bartok_Jager_04_01"); //У нас был лагерь около таверны, на полпути к ферме Онара. AI_Output(self,other,"DIA_Bartok_Jager_04_02"); //Но я не знаю, остался ли там кто еще. }; instance DIA_BARTOK_BOSPER(C_INFO) { npc = vlk_440_bartok; nr = 3; condition = dia_bartok_bosper_condition; information = dia_bartok_bosper_info; permanent = FALSE; description = "Боспер говорит, что ты работал на него..."; }; func int dia_bartok_bosper_condition() { if(Npc_KnowsInfo(other,dia_bosper_bartok) && Npc_KnowsInfo(other,dia_bartok_hallo)) { return TRUE; }; }; func void dia_bartok_bosper_info() { AI_Output(other,self,"DIA_Bartok_Bosper_15_00"); //Боспер говорит, что ты работал на него... AI_Output(self,other,"DIA_Bartok_Bosper_04_01"); //Да, было дело. Но его интересовали только эти чертовы шкуры. AI_Output(self,other,"DIA_Bartok_Bosper_04_02"); //Я говорил ему, как опасно стало охотиться. Но он не хотел ничего слушать. AI_Output(self,other,"DIA_Bartok_Bosper_04_03"); //Правда, платил он хорошо - грех жаловаться. AI_Output(other,self,"DIA_Bartok_Bosper_15_04"); //Ты можешь рассказать что-нибудь о нем? AI_Output(self,other,"DIA_Bartok_Bosper_04_05"); //(смеется) У Боспера недавно украли лук. Прямо средь бела дня. AI_Output(self,other,"DIA_Bartok_Bosper_04_06"); //Кто-то вломился в его лавку, схватил лук и был таков. AI_Output(self,other,"DIA_Bartok_Bosper_04_07"); //Воры наглеют прямо на глазах! if(MIS_BOSPER_BOGEN != LOG_SUCCESS) { MIS_BOSPER_BOGEN = LOG_RUNNING; }; }; instance DIA_BARTOK_WANNALEARN(C_INFO) { npc = vlk_440_bartok; nr = 4; condition = dia_bartok_wannalearn_condition; information = dia_bartok_wannalearn_info; permanent = FALSE; description = "Ты можешь научить меня охотиться?"; }; func int dia_bartok_wannalearn_condition() { if(Npc_KnowsInfo(other,dia_bartok_hallo)) { return TRUE; }; }; func void dia_bartok_wannalearn_info() { AI_Output(other,self,"DIA_Bartok_WannaLearn_15_00"); //Ты можешь научить меня охотиться? AI_Output(self,other,"DIA_Bartok_WannaLearn_04_01"); //Я могу научить тебя красться и правильно держать лук. if(PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_FUR] == FALSE) { AI_Output(self,other,"DIA_Bartok_WannaLearn_04_02"); //Если ты хочешь научиться снимать шкуры с животных - иди к Босперу. Это он научил меня. }; BARTOK_TEACHPLAYER = TRUE; Log_CreateTopic(TOPIC_CITYTEACHER,LOG_NOTE); b_logentry(TOPIC_CITYTEACHER,"Барток может обучить меня красться и стрельбе из лука."); }; instance DIA_BARTOK_TEACHSNEAK(C_INFO) { npc = vlk_440_bartok; nr = 4; condition = dia_bartok_teachsneak_condition; information = dia_bartok_teachsneak_info; permanent = TRUE; description = b_buildlearnstring("Научи меня красться!",b_getlearncosttalent(other,NPC_TALENT_SNEAK)); }; func int dia_bartok_teachsneak_condition() { if((BARTOK_TEACHPLAYER == TRUE) && (Npc_GetTalentSkill(other,NPC_TALENT_SNEAK) == 0)) { return TRUE; }; }; func void dia_bartok_teachsneak_info() { AI_Output(other,self,"DIA_Bartok_TeachSneak_15_00"); //Научи меня красться! if(b_teachthieftalent(self,other,NPC_TALENT_SNEAK)) { AI_Output(self,other,"DIA_Bartok_TeachSneak_04_01"); //Хорошо - сначала ты должен научиться правильно распределять свой вес. AI_Output(self,other,"DIA_Bartok_TeachSneak_04_02"); //Для этого согни ноги в коленях и старайся всегда опускать ногу на пятку. AI_Output(self,other,"DIA_Bartok_TeachSneak_04_03"); //Все нагрузка должна приходиться на опорную ногу, пока другая нога не будет твердо стоять на земле. AI_Output(self,other,"DIA_Bartok_TeachSneak_04_04"); //К большинству зверей невозможно подкрасться, если только они не спят. Они просто учуют тебя. AI_Output(self,other,"DIA_Bartok_TeachSneak_04_05"); //Так что будь внимателен при охоте. }; }; var int bosper_merkebow; instance DIA_BARTOK_TEACH(C_INFO) { npc = vlk_440_bartok; nr = 4; condition = dia_bartok_teach_condition; information = dia_bartok_teach_info; permanent = TRUE; description = "Я хочу научиться лучше стрелять из лука!"; }; func int dia_bartok_teach_condition() { if(BARTOK_TEACHPLAYER == TRUE) { return TRUE; }; }; func void dia_bartok_teach_info() { AI_Output(other,self,"DIA_Bartok_TeachBow_15_00"); //Я хочу научиться лучше стрелять из лука! AI_Output(self,other,"DIA_Bartok_TeachBow_04_01"); //Хорошо, посмотрим, чему я могу тебя научить... BOSPER_MERKEBOW = other.hitchance[NPC_TALENT_BOW]; Info_ClearChoices(dia_bartok_teach); Info_AddChoice(dia_bartok_teach,DIALOG_BACK,dia_bartok_teach_back); Info_AddChoice(dia_bartok_teach,b_buildlearnstring(PRINT_LEARNBOW1,b_getlearncosttalent(other,NPC_TALENT_BOW)),dia_bartok_teach_bow_1); Info_AddChoice(dia_bartok_teach,b_buildlearnstring(PRINT_LEARNBOW5,b_getlearncosttalent(other,NPC_TALENT_BOW) * 5),dia_bartok_teach_bow_5); }; func void dia_bartok_teach_back() { if(other.hitchance[NPC_TALENT_BOW] >= 60) { AI_Output(self,other,"DIA_Bartok_TeachBow_BACK_04_00"); //Тебе лучше поискать кого-нибудь, кто знает больше, чем я. } else if(BOSPER_MERKEBOW < other.hitchance[NPC_TALENT_BOW]) { AI_Output(self,other,"DIA_Bartok_TeachBow_BACK_04_01"); //Хорошо, ты стал стрелять значительно лучше. }; Info_ClearChoices(dia_bartok_teach); }; func void dia_bartok_teach_bow_1() { b_teachfighttalentpercent(self,other,NPC_TALENT_BOW,1,60); Info_ClearChoices(dia_bartok_teach); Info_AddChoice(dia_bartok_teach,DIALOG_BACK,dia_bartok_teach_back); Info_AddChoice(dia_bartok_teach,b_buildlearnstring(PRINT_LEARNBOW1,b_getlearncosttalent(other,NPC_TALENT_BOW)),dia_bartok_teach_bow_1); Info_AddChoice(dia_bartok_teach,b_buildlearnstring(PRINT_LEARNBOW5,b_getlearncosttalent(other,NPC_TALENT_BOW) * 5),dia_bartok_teach_bow_5); }; func void dia_bartok_teach_bow_5() { b_teachfighttalentpercent(self,other,NPC_TALENT_BOW,5,60); Info_ClearChoices(dia_bartok_teach); Info_AddChoice(dia_bartok_teach,DIALOG_BACK,dia_bartok_teach_back); Info_AddChoice(dia_bartok_teach,b_buildlearnstring(PRINT_LEARNBOW1,b_getlearncosttalent(other,NPC_TALENT_BOW)),dia_bartok_teach_bow_1); Info_AddChoice(dia_bartok_teach,b_buildlearnstring(PRINT_LEARNBOW5,b_getlearncosttalent(other,NPC_TALENT_BOW) * 5),dia_bartok_teach_bow_5); }; var int bartok_bereit; var int bartok_later; instance DIA_BARTOK_ZUSAMMEN(C_INFO) { npc = vlk_440_bartok; nr = 5; condition = dia_bartok_zusammen_condition; information = dia_bartok_zusammen_info; permanent = TRUE; description = "Почему бы нам не поохотиться вместе?"; }; func int dia_bartok_zusammen_condition() { if((BARTOK_BEREIT == FALSE) && Npc_KnowsInfo(other,dia_bartok_hallo)) { return TRUE; }; }; func void dia_bartok_zusammen_info() { if(BARTOK_LATER == FALSE) { AI_Output(other,self,"DIA_Bartok_Zusammen_15_00"); //Почему бы нам не поохотиться вместе? AI_Output(self,other,"DIA_Bartok_Zusammen_04_01"); //Хм. Вдвоем охотиться не так опасно, это точно... AI_Output(self,other,"DIA_Bartok_Zusammen_04_02"); //А что ты знаешь об охоте, а? AI_Output(self,other,"DIA_Bartok_Zusammen_04_03"); //Я имею в виду, ты знаешь, как снимать шкуры с животных? }; if(PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_FUR] == TRUE) { if(BARTOK_LATER == TRUE) { AI_Output(self,other,"DIA_Bartok_HuntNOW_04_01"); //У тебя есть 50 монет? } else { AI_Output(other,self,"DIA_Bartok_Zusammen_15_04"); //Да. AI_Output(self,other,"DIA_Bartok_Zusammen_04_05"); //Хорошо, я хочу получить 50 золотых монет. А ты можешь забирать себе шкуры и продавать их Босперу. AI_Output(self,other,"DIA_Bartok_Zusammen_04_06"); //Это будет честно, правда? }; Info_ClearChoices(dia_bartok_zusammen); Info_AddChoice(dia_bartok_zusammen,"Позже...",dia_bartok_zusammen_later); Info_AddChoice(dia_bartok_zusammen,"Вот, держи...",dia_bartok_zusammen_pay); } else { AI_Output(other,self,"DIA_Bartok_Zusammen_15_07"); //Нет. AI_Output(self,other,"DIA_Bartok_Zusammen_04_08"); //Тогда овчинка выделки не стоит. AI_Output(self,other,"DIA_Bartok_Zusammen_04_09"); //Возвращайся, когда научишься чему-нибудь. }; }; func void dia_bartok_zusammen_later() { AI_Output(other,self,"DIA_Bartok_HuntNOW_Later_15_00"); //Позже... BARTOK_LATER = TRUE; Info_ClearChoices(dia_bartok_zusammen); }; func void dia_bartok_zusammen_pay() { Info_ClearChoices(dia_bartok_zusammen); if(b_giveinvitems(other,self,itmi_gold,50)) { AI_Output(other,self,"DIA_Bartok_HuntNOW_GO_15_00"); //Вот, держи... BARTOK_BEREIT = TRUE; } else { AI_Output(self,other,"DIA_Bartok_HuntNOW_GO_04_03"); //Где? Не вижу! У тебя нет золота. }; }; var int bartok_los; instance DIA_BARTOK_HUNTNOW(C_INFO) { npc = vlk_440_bartok; nr = 5; condition = dia_bartok_huntnow_condition; information = dia_bartok_huntnow_info; permanent = FALSE; description = "Пойдем охотиться!"; }; func int dia_bartok_huntnow_condition() { if(BARTOK_BEREIT == TRUE) { return TRUE; }; }; func void dia_bartok_huntnow_info() { AI_Output(other,self,"DIA_Bartok_HuntNOW_15_00"); //Пойдем охотиться! AI_Output(self,other,"DIA_Bartok_HuntNOW_GO_04_01"); //Хорошо, пошли за мной. За южными воротами начинается лес. Там водится более чем достаточно всяких тварей. AI_Output(self,other,"DIA_Bartok_HuntNOW_GO_04_02"); //(себе под нос) Даже больше, чем хотелось бы... BARTOK_LOS = TRUE; AI_StopProcessInfos(self); self.aivar[AIV_PARTYMEMBER] = TRUE; Npc_ExchangeRoutine(self,"GUIDEMITTE"); Wld_InsertNpc(wolf,"NW_FARM1_CITYWALL_FOREST_02"); Wld_InsertNpc(wolf,"NW_FARM1_CITYWALL_FOREST_02"); Wld_InsertNpc(wolf,"NW_FARM1_CITYWALL_FOREST_02"); }; var int bartok_orkstillthere; instance DIA_BARTOK_IMWALD(C_INFO) { npc = vlk_440_bartok; nr = 1; condition = dia_bartok_imwald_condition; information = dia_bartok_imwald_info; permanent = FALSE; important = TRUE; }; func int dia_bartok_imwald_condition() { if((BARTOK_LOS == TRUE) && (Npc_GetDistToWP(self,"NW_FARM1_CITYWALL_FOREST_03") < 500)) { return TRUE; }; }; func void dia_bartok_imwald_info() { AI_Output(self,other,"DIA_Bartok_ImWald_04_00"); //Как ты думаешь, стоит нам углубиться в лес или нет? Info_ClearChoices(dia_bartok_imwald); Info_AddChoice(dia_bartok_imwald,"Пойдем назад!",dia_bartok_imwald_nachhause); Info_AddChoice(dia_bartok_imwald,"Стоит.",dia_bartok_imwald_weiter); }; func void dia_bartok_imwald_nachhause() { AI_Output(other,self,"DIA_Bartok_ImWald_NachHause_15_00"); //Пойдем назад! AI_Output(self,other,"DIA_Bartok_ImWald_NachHause_04_01"); //Я тоже так думаю. А то мы так попадем прямо в объятия орка. Info_ClearChoices(dia_bartok_imwald); AI_StopProcessInfos(self); self.aivar[AIV_PARTYMEMBER] = FALSE; Npc_ExchangeRoutine(self,"START"); }; func void dia_bartok_imwald_weiter() { AI_Output(other,self,"DIA_Bartok_ImWald_Weiter_15_00"); //Стоит. AI_Output(self,other,"DIA_Bartok_ImWald_Weiter_04_01"); //Хорошо. (по себя) Будем надеяться, что нам повезет... if(!Npc_IsDead(cityorc)) { BARTOK_ORKSTILLTHERE = TRUE; }; Info_ClearChoices(dia_bartok_imwald); AI_StopProcessInfos(self); Npc_ExchangeRoutine(self,"GUIDEENDE"); }; var int bartok_ende; instance DIA_BARTOK_ANGEKOMMEN(C_INFO) { npc = vlk_440_bartok; nr = 1; condition = dia_bartok_angekommen_condition; information = dia_bartok_angekommen_info; permanent = FALSE; important = TRUE; }; func int dia_bartok_angekommen_condition() { if((BARTOK_LOS == TRUE) && (Npc_GetDistToWP(self,"NW_FARM1_CITYWALL_FOREST_07") < 500)) { return TRUE; }; }; func void dia_bartok_angekommen_info() { AI_Output(self,other,"DIA_Bartok_Angekommen_04_00"); //Все! Я думаю, мне лучше вернуться в город. AI_Output(self,other,"DIA_Bartok_Angekommen_04_01"); //Здесь для меня слишком опасно - и даже для нас двоих. if(BARTOK_ORKSTILLTHERE == TRUE) { b_bartok_shitanorc(); BARTOK_ORKGESAGT = TRUE; }; AI_Output(self,other,"DIA_Bartok_Angekommen_04_03"); //Еще увидимся! AI_Output(self,other,"DIA_Bartok_Angekommen_04_04"); //Ты можешь продать шкуры Босперу. BARTOK_ENDE = TRUE; AI_StopProcessInfos(self); self.aivar[AIV_PARTYMEMBER] = FALSE; Npc_ExchangeRoutine(self,"START"); }; instance DIA_BARTOK_PERM(C_INFO) { npc = vlk_440_bartok; nr = 1; condition = dia_bartok_perm_condition; information = dia_bartok_perm_info; permanent = TRUE; description = "Все в порядке?"; }; func int dia_bartok_perm_condition() { if(BARTOK_LOS == TRUE) { return TRUE; }; }; func void dia_bartok_perm_info() { AI_Output(other,self,"DIA_Bartok_PERM_15_00"); //Все в порядке? if(BARTOK_ENDE == TRUE) { AI_Output(self,other,"DIA_Bartok_PERM_04_01"); //Да. Но я больше не выйду из города. По крайней мере, в ближайшее время. if(BARTOK_ORKGESAGT == TRUE) { AI_Output(self,other,"DIA_Bartok_PERM_04_02"); //У меня все еще поджилки трясутся от одной мысли об этом орке. }; } else { AI_Output(self,other,"DIA_Bartok_PERM_04_03"); //Конечно. Давая прикончим еще парочку зверей! }; };
D
/* * This file is part of EvinceD. * EvinceD is based on GtkD. * * EvinceD is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 3 * of the License, or (at your option) any later version, with * some exceptions, please read the COPYING file. * * EvinceD is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with EvinceD; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA */ // generated automatically - do not change // find conversion definition on APILookup.txt module evince.view.View; private import evince.document.Annotation; private import evince.document.Link; private import evince.document.LinkAction; private import evince.document.SourceLink; private import evince.view.DocumentModel; private import evince.view.JobFind; private import evince.view.c.functions; public import evince.view.c.types; private import glib.ConstructionException; private import glib.Str; private import gobject.ObjectG; private import gobject.Signals; private import gtk.Border; private import gtk.BuildableIF; private import gtk.BuildableT; private import gtk.Container; private import gtk.ScrollableIF; private import gtk.ScrollableT; private import gtk.Widget; private import std.algorithm; /** */ public class View : Container, ScrollableIF { /** the main Gtk struct */ protected EvView* evView; /** Get the main Gtk struct */ public EvView* getViewStruct(bool transferOwnership = false) { if (transferOwnership) ownedRef = false; return evView; } /** the main Gtk struct as a void* */ protected override void* getStruct() { return cast(void*)evView; } /** * Sets our main struct and passes it to the parent class. */ public this (EvView* evView, bool ownedRef = false) { this.evView = evView; super(cast(GtkContainer*)evView, ownedRef); } // add the Scrollable capabilities mixin ScrollableT!(EvView); /** */ public static GType getType() { return ev_view_get_type(); } /** */ public this() { auto __p = ev_view_new(); if(__p is null) { throw new ConstructionException("null returned by new"); } this(cast(EvView*) __p); } /** * Adds a Text Markup annotation (defaulting to a 'highlight' one) to * the currently selected text on the document. * * When the selected text spans more than one page, it will add a * corresponding annotation for each page that contains selected text. * * Returns: %TRUE if annotations were added successfully, %FALSE otherwise. * * Since: 3.30 */ public bool addTextMarkupAnnotationForSelectedText() { return ev_view_add_text_markup_annotation_for_selected_text(evView) != 0; } /** */ public void autoscrollStart() { ev_view_autoscroll_start(evView); } /** */ public void autoscrollStop() { ev_view_autoscroll_stop(evView); } /** */ public void beginAddAnnotation(EvAnnotationType annotType) { ev_view_begin_add_annotation(evView, annotType); } /** */ public bool canZoomIn() { return ev_view_can_zoom_in(evView) != 0; } /** */ public bool canZoomOut() { return ev_view_can_zoom_out(evView) != 0; } /** */ public void cancelAddAnnotation() { ev_view_cancel_add_annotation(evView); } /** */ public void copy() { ev_view_copy(evView); } /** */ public void copyLinkAddress(LinkAction action) { ev_view_copy_link_address(evView, (action is null) ? null : action.getLinkActionStruct()); } /** */ public void findCancel() { ev_view_find_cancel(evView); } /** */ public void findNext() { ev_view_find_next(evView); } /** */ public void findPrevious() { ev_view_find_previous(evView); } /** * Restart the current search operation from the given @page. * * Params: * page = a page index * * Since: 3.12 */ public void findRestart(int page) { ev_view_find_restart(evView, page); } /** */ public void findSearchChanged() { ev_view_find_search_changed(evView); } /** */ public void findSetHighlightSearch(bool value) { ev_view_find_set_highlight_search(evView, value); } /** * FIXME * * Since: 3.10 */ public void findSetResult(int page, int result) { ev_view_find_set_result(evView, page, result); } /** */ public void findStarted(JobFind job) { ev_view_find_started(evView, (job is null) ? null : job.getJobFindStruct()); } /** */ public void focusAnnotation(EvMapping* annotMapping) { ev_view_focus_annotation(evView, annotMapping); } /** */ public bool getAllowLinksChangeZoom() { return ev_view_get_allow_links_change_zoom(evView) != 0; } /** */ public bool getEnableSpellchecking() { return ev_view_get_enable_spellchecking(evView) != 0; } /** */ public bool getHasSelection() { return ev_view_get_has_selection(evView) != 0; } /** */ public bool getPageExtents(int page, GdkRectangle* pageArea, Border border) { return ev_view_get_page_extents(evView, page, pageArea, (border is null) ? null : border.getBorderStruct()) != 0; } /** */ public bool getPageExtentsForBorder(int page, Border border, GdkRectangle* pageArea) { return ev_view_get_page_extents_for_border(evView, page, (border is null) ? null : border.getBorderStruct(), pageArea) != 0; } /** * Returns a pointer to a constant string containing the selected * text in the view. * * The value returned may be NULL if there is no selected text. * * Returns: The string representing selected text. * * Since: 3.30 */ public string getSelectedText() { auto retStr = ev_view_get_selected_text(evView); scope(exit) Str.freeString(retStr); return Str.toString(retStr); } /** */ public void handleLink(Link link) { ev_view_handle_link(evView, (link is null) ? null : link.getLinkStruct()); } /** */ public void hideCursor() { ev_view_hide_cursor(evView); } /** */ public void highlightForwardSearch(SourceLink link) { ev_view_highlight_forward_search(evView, (link is null) ? null : link.getSourceLinkStruct()); } /** */ public bool isCaretNavigationEnabled() { return ev_view_is_caret_navigation_enabled(evView) != 0; } /** * Returns: %TRUE iff the view is currently loading a document * * Since: 3.8 */ public bool isLoading() { return ev_view_is_loading(evView) != 0; } /** */ public bool nextPage() { return ev_view_next_page(evView) != 0; } /** */ public bool previousPage() { return ev_view_previous_page(evView) != 0; } /** */ public void reload() { ev_view_reload(evView); } /** */ public void removeAnnotation(Annotation annot) { ev_view_remove_annotation(evView, (annot is null) ? null : annot.getAnnotationStruct()); } /** */ public void scroll(GtkScrollType scroll, bool horizontal) { ev_view_scroll(evView, scroll, horizontal); } /** */ public void selectAll() { ev_view_select_all(evView); } /** */ public void setAllowLinksChangeZoom(bool allowed) { ev_view_set_allow_links_change_zoom(evView, allowed); } /** */ public void setCaretCursorPosition(uint page, uint offset) { ev_view_set_caret_cursor_position(evView, page, offset); } /** * Enables or disables caret navigation mode for the document. * * Params: * enabled = whether to enable caret navigation mode * * Since: 3.10 */ public void setCaretNavigationEnabled(bool enabled) { ev_view_set_caret_navigation_enabled(evView, enabled); } /** */ public void setEnableSpellchecking(bool spellcheck) { ev_view_set_enable_spellchecking(evView, spellcheck); } /** */ public void setLoading(bool loading) { ev_view_set_loading(evView, loading); } /** */ public void setModel(DocumentModel model) { ev_view_set_model(evView, (model is null) ? null : model.getDocumentModelStruct()); } /** * Sets the maximum size in bytes that will be used to cache * rendered pages. Use 0 to disable caching rendered pages. * * Note that this limit doesn't affect the current visible page range, * which will always be rendered. In order to limit the total memory used * you have to use ev_document_model_set_max_scale() too. * * Params: * cacheSize = size in bytes */ public void setPageCacheSize(size_t cacheSize) { ev_view_set_page_cache_size(evView, cacheSize); } /** */ public void showCursor() { ev_view_show_cursor(evView); } /** * Returns: whether the document supports caret navigation * * Since: 3.10 */ public bool supportsCaretNavigation() { return ev_view_supports_caret_navigation(evView) != 0; } /** */ public void zoomIn() { ev_view_zoom_in(evView); } /** */ public void zoomOut() { ev_view_zoom_out(evView); } /** */ gulong addOnActivate(void delegate(View) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) { return Signals.connect(this, "activate", dlg, connectFlags ^ ConnectFlags.SWAPPED); } /** */ gulong addOnAnnotAdded(void delegate(Annotation, View) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) { return Signals.connect(this, "annot-added", dlg, connectFlags ^ ConnectFlags.SWAPPED); } /** */ gulong addOnAnnotRemoved(void delegate(Annotation, View) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) { return Signals.connect(this, "annot-removed", dlg, connectFlags ^ ConnectFlags.SWAPPED); } /** */ gulong addOnCursorMoved(void delegate(int, int, View) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) { return Signals.connect(this, "cursor-moved", dlg, connectFlags ^ ConnectFlags.SWAPPED); } /** */ gulong addOnExternalLink(void delegate(ObjectG, View) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) { return Signals.connect(this, "external-link", dlg, connectFlags ^ ConnectFlags.SWAPPED); } /** */ gulong addOnHandleLink(void delegate(ObjectG, View) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) { return Signals.connect(this, "handle-link", dlg, connectFlags ^ ConnectFlags.SWAPPED); } /** */ gulong addOnLayersChanged(void delegate(View) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) { return Signals.connect(this, "layers-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); } /** */ gulong addOnMoveCursor(bool delegate(GtkMovementStep, int, bool, View) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) { return Signals.connect(this, "move-cursor", dlg, connectFlags ^ ConnectFlags.SWAPPED); } /** */ gulong addOnPopup(void delegate(void*, View) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) { return Signals.connect(this, "popup", dlg, connectFlags ^ ConnectFlags.SWAPPED); } /** */ gulong addOnScroll(void delegate(GtkScrollType, GtkOrientation, View) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) { return Signals.connect(this, "scroll", dlg, connectFlags ^ ConnectFlags.SWAPPED); } /** */ gulong addOnSelectionChanged(void delegate(View) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) { return Signals.connect(this, "selection-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); } /** */ gulong addOnSyncSource(void delegate(SourceLink, View) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) { return Signals.connect(this, "sync-source", dlg, connectFlags ^ ConnectFlags.SWAPPED); } }
D
import std.stdio; import std.string; import std.algorithm; void main() { string name = "A-small"; string path = ""; File input = File(path ~ name ~ ".in", "r"); File output = File(path ~ name ~ ".out", "w"); int testCases; input.readf(" %d", &testCases); foreach(testCase; 1..testCases + 1) { string cmd; int n; input.readf(" %s %d", &cmd, &n); double[] a = new double[](n); foreach(i; 0..n) { input.readf(" %f", &a[i]); } double res; switch (cmd) { case "median": a.sort(); res = a[n / 2]; break; case "mean": double s = 0; foreach(i; 0..n) { s += a[i]; } res = s / n; break; default: throw new Exception(""); } output.writefln("Case #%d: %.10f", testCase, res); } output.close(); input.close(); }
D
module gfm.sdl2.sdl; import std.conv: to; import std.string: format, toStringz; import derelict.sdl2.sdl; import derelict.sdl2.image; import derelict.util.exception; import gfm.sdl2.exception; import gfm.sdl2.displaymode; import gfm.sdl2.renderer; import gfm.common.log; import gfm.math.box; final class SDL2 { public { this(Log log) { _log = log; _SDLInitialized = false; _SDL2LoggingRedirected = false; try { // in debug builds, use a debug version of SDL2 debug DerelictSDL2.load("SDL2d.dll"); else DerelictSDL2.load(); } catch(DerelictException e) { throw new SDL2Exception(e.msg); } // enable all logging, and pipe it to our own logger object { SDL_LogGetOutputFunction(_previousLogCallback, &_previousLogUserdata); SDL_LogSetAllPriority(SDL_LOG_PRIORITY_VERBOSE); SDL_LogSetOutputFunction(&loggingCallback, cast(void*)this); _SDL2LoggingRedirected = true; } if (0 != SDL_Init(0)) throwSDL2Exception("SDL_Init"); _log.infof("Platform: %s, %s CPU, L1 cacheline size: %sb", getPlatform(), getCPUCount(), getL1LineSize()); subSystemInit(SDL_INIT_TIMER); subSystemInit(SDL_INIT_VIDEO); subSystemInit(SDL_INIT_JOYSTICK); subSystemInit(SDL_INIT_AUDIO); subSystemInit(SDL_INIT_HAPTIC); foreach(driver;getVideoDrivers()) _log.infof("Available driver: %s", driver); { int res = SDL_VideoInit(null); if (res != 0) throwSDL2Exception("SDL_VideoInit"); } _log.infof("Running using video driver: %s", to!string(SDL_GetCurrentVideoDriver())); int numDisplays = SDL_GetNumVideoDisplays(); _log.infof("%s video display(s) detected.", numDisplays); } void close() { // restore previously set logging function if (_SDL2LoggingRedirected) { SDL_LogSetOutputFunction(_previousLogCallback, _previousLogUserdata); _SDL2LoggingRedirected = false; } if (_SDLInitialized) { SDL_Quit(); _SDLInitialized = false; } if (DerelictSDL2.isLoaded()) DerelictSDL2.unload(); } ~this() { close(); } string[] getVideoDrivers() { const int numDrivers = SDL_GetNumVideoDrivers(); string[] res; res.length = numDrivers; for(int i = 0; i < numDrivers; ++i) res[i] = to!string(SDL_GetVideoDriver(i)); return res; } string getPlatform() { return to!string(SDL_GetPlatform()); } int getL1LineSize() { int res = SDL_GetCPUCacheLineSize(); if (res <= 0) res = 64; return res; } int getCPUCount() { int res = SDL_GetCPUCount(); if (res <= 0) res = 1; return res; } void delay(int milliseconds) { SDL_Delay(milliseconds); } uint getTicks() { return SDL_GetTicks(); } SDL2VideoDisplay[] getDisplays() { int numDisplays = SDL_GetNumVideoDisplays(); SDL2VideoDisplay[] availableDisplays; for (int displayIndex = 0; displayIndex < numDisplays; ++displayIndex) { SDL_Rect rect; int res = SDL_GetDisplayBounds(displayIndex, &rect); if (res != 0) throwSDL2Exception("SDL_GetDisplayBounds"); box2i bounds = box2i(rect.x, rect.y, rect.x + rect.w, rect.y + rect.h); SDL2DisplayMode[] availableModes; int numModes = SDL_GetNumDisplayModes(displayIndex); for(int modeIndex = 0; modeIndex < numModes; ++modeIndex) { SDL_DisplayMode mode; if (0 != SDL_GetDisplayMode(displayIndex, modeIndex, &mode)) throwSDL2Exception("SDL_GetDisplayMode"); availableModes ~= new SDL2DisplayMode(modeIndex, mode); } availableDisplays ~= new SDL2VideoDisplay(displayIndex, bounds, availableModes); } return availableDisplays; } SDL2RendererInfo[] getRenderersInfo() { SDL2RendererInfo[] res; int num = SDL_GetNumRenderDrivers(); if (num < 0) throwSDL2Exception("SDL_GetNumRenderDrivers"); for (int i = 0; i < num; ++i) { SDL_RendererInfo info; int err = SDL_GetRenderDriverInfo(i, &info); if (err != 0) throwSDL2Exception("SDL_GetRenderDriverInfo"); res ~= new SDL2RendererInfo(i, info); } return res; } void startTextInput() { SDL_StartTextInput(); } void stopTextInput() { SDL_StopTextInput(); } // clipboard as a property // set clipboard @property string clipboard(string s) { int err = SDL_SetClipboardText(toStringz(s)); if (err != 0) throwSDL2Exception("SDL_SetClipboardText"); return s; } // get clipboard @property string clipboard() { if (SDL_HasClipboardText() == SDL_FALSE) return null; const(char)* s = SDL_GetClipboardText(); if (s is null) throwSDL2Exception("SDL_GetClipboardText"); // is clipboard texte utf-8? Assuming yes. return to!string(s); } } package { // exception mechanism that shall be used by every module here void throwSDL2Exception(string callThatFailed) { string message = format("%s failed: %s", callThatFailed, getErrorString()); throw new SDL2Exception(message); } string getErrorString() { const(char)* message = SDL_GetError(); SDL_ClearError(); // clear error return to!string(message); } } package { Log _log; } private { bool _SDL2LoggingRedirected; SDL_LogOutputFunction _previousLogCallback; void* _previousLogUserdata; bool _SDLInitialized; bool subSystemInitialized(int subSystem) { int inited = SDL_WasInit(SDL_INIT_EVERYTHING); return 0 != ( inited & subSystem ); } void subSystemInit(int flag) { if (!subSystemInitialized(flag)) { int res = SDL_InitSubSystem(flag); if (0 != res) throwSDL2Exception("SDL_InitSubSystem"); } } void onLogMessage(int category, SDL_LogPriority priority, const(char)* message) { static string readablePriority(SDL_LogPriority priority) pure { switch(priority) { case SDL_LOG_PRIORITY_VERBOSE : return "verbose"; case SDL_LOG_PRIORITY_DEBUG : return "debug"; case SDL_LOG_PRIORITY_INFO : return "info"; case SDL_LOG_PRIORITY_WARN : return "warn"; case SDL_LOG_PRIORITY_ERROR : return "error"; case SDL_LOG_PRIORITY_CRITICAL : return "critical"; default : return "unknown"; } } static string readableCategory(SDL_LogPriority priority) pure { switch(priority) { case SDL_LOG_CATEGORY_APPLICATION : return "application"; case SDL_LOG_CATEGORY_ERROR : return "error"; case SDL_LOG_CATEGORY_SYSTEM : return "system"; case SDL_LOG_CATEGORY_AUDIO : return "audio"; case SDL_LOG_CATEGORY_VIDEO : return "video"; case SDL_LOG_CATEGORY_RENDER : return "render"; case SDL_LOG_CATEGORY_INPUT : return "input"; default : return "unknown"; } } string formattedMessage = format("SDL (category %s, priority %s): %s", readableCategory(category), readablePriority(priority), to!string(message)); if (priority == SDL_LOG_PRIORITY_WARN) _log.warn(formattedMessage); else if (priority == SDL_LOG_PRIORITY_ERROR || priority == SDL_LOG_PRIORITY_CRITICAL) _log.error(formattedMessage); else _log.info(formattedMessage); } } } extern(C) { void loggingCallback(void* userData, int category, SDL_LogPriority priority, const(char)* message) { SDL2 sdl2 = cast(SDL2)userData; sdl2.onLogMessage(category, priority, message); } }
D