example for a time unit definition
1 import unit_threaded; 2 3 auto res = TIME.transform(1 + 2 * 1000 + 3 * 1000 * 60 + 4 * 1000 * 60 * 60 4 + 5 * 1000 * 60 * 60 * 24); 5 res.length.shouldEqual(5); 6 res[0].name.shouldEqual("d"); 7 res[0].value.shouldEqual(5); 8 res[1].name.shouldEqual("h"); 9 res[1].value.shouldEqual(4); 10 res[2].name.shouldEqual("m"); 11 res[2].value.shouldEqual(3); 12 res[3].name.shouldEqual("s"); 13 res[3].value.shouldEqual(2); 14 res[4].name.shouldEqual("ms"); 15 res[4].value.shouldEqual(1); 16 17 res = TIME.transform(2001).onlyRelevant; 18 res.length.shouldEqual(2); 19 res[0].name.shouldEqual("s"); 20 res[0].value.shouldEqual(2); 21 res[1].name.shouldEqual("ms"); 22 res[1].value.shouldEqual(1); 23 24 res = TIME.transform(2001).onlyRelevant.mostSignificant(1); 25 res.length.shouldEqual(1); 26 res[0].name.shouldEqual("s"); 27 res[0].value.shouldEqual(2);
get the first nr of parts (or less if not enough parts are available).