shithub: mc

Download patch

ref: 7e02923fe7e9abd65a9b039a832ca593075f8132
parent: f9135fb90f213d2c0167a5855f18ac2fd500ccdc
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Aug 28 18:29:54 EDT 2014

Add format variants that just do ymd.

--- a/lib/date/date.myr
+++ b/lib/date/date.myr
@@ -8,7 +8,9 @@
 	const parsefmt	: (fmt : byte[:], d : byte[:]	-> date)
 	const parsez	: (d : byte[:], tz : byte[:]	-> date)
 	const fmt	: (d : date	-> byte[:])
+	const fmtymd	: (d : date	-> byte[:])
 	const bfmt	: (buf : byte[:], d : date	-> std.size)
+	const bfmtymd	: (buf : byte[:], d : date	-> std.size)
 
 	/* useful constructors */
 	const mkdate	: (tm : std.time, tz : diff -> date)
@@ -30,8 +32,16 @@
 	-> std.fmt("%04i-%02i-%02i %i:%i:%i", d.year, d.mon, d.day, d.h, d.m, d.s)
 }
 
+const fmtymd = {d
+	-> std.fmt("%04i-%02i-%02i", d.year, d.mon, d.day)
+}
+
 const bfmt = {buf, d
 	-> std.bfmt(buf, "%04i-%02i-%02i %i:%i:%i", d.year, d.mon, d.day, d.h, d.m, d.s)
+}
+
+const bfmtymd = {buf, d
+	-> std.bfmt(buf, "%04i-%02i-%02i", d.year, d.mon, d.day)
 }
 
 const now = {tz : byte[:]