2 var <>year=2000, <>month=1, <>day=1, <>hour=0, <>minute=0, <>second=0, <>dayOfWeek=6,
3 <>rawSeconds=0, <>bootSeconds=0;
5 *getDate { ^this.localtime }
6 *localtime { ^this.new.localtime }
7 *gmtime { ^this.new.gmtime }
8 *new { arg year, month, day, hour, minute, second, dayOfWeek, rawSeconds, bootSeconds;
9 ^super.newCopyArgs(year, month, day, hour, minute, second, dayOfWeek,
10 rawSeconds, bootSeconds);
13 ^[year, month, day, hour, minute, second, dayOfWeek, rawSeconds, bootSeconds]
24 // return a value suitable for seeding a random number generator.
28 // strings for time stamping things like filenames.
31 s = (((year % 100) * 100 + month) * 100 + day
33 s.removeAt(0); // get rid of the leading '1' char that was put there to force leading zeroes.
38 s = ((hour * 100 + minute) * 100 + second + 1000000).asString;
39 s.removeAt(0); // get rid of the leading '1' char that was put there to force leading zeroes.
43 ^this.dayStamp ++ "_" ++ this.secStamp
46 ^hour.asString ++ ":" ++ minute ++ ":" ++ (rawSeconds % 60).round(0.0001)
48 asSortableString { // standard database format, alphabetically sortable
49 ^String.streamContents({ arg s;
51 if(month < 10,{ s << 0 });
53 if(day < 10,{ s << 0 });
55 if(hour < 10,{ s << 0 });
57 if(minute < 10, { s << 0 });
59 if(second < 10, { s << 0 });