Days since
-
@d-healey
This is how to get the time stamp in days since year 0.inline function getTimeStampInDays() { local systemTime = Engine.getSystemTime(false); local timeStamp = parseInt(systemTime.substring(6, 8)) // Days + parseInt(systemTime.substring(4, 6)) * 30 // Months + parseInt(systemTime.substring(0, 4)) * 365; // Years return timeStamp; }
Store this in an external file and compare when you need
-
Thanks @ustk but it doesn't seem to be working fully here. I have two dates, one month apart, and it's returning the same value for both.
HiseSnippet 830.3ocsVstaSCCE1oqAQCWDShG.q8qVZoKoqsaiIDi0KnJnaUzwD7qIuD2UqkXGk3LnBsGEdG4M.NNIqoExFaUBK0pdt7cxmO1emzQABaZXnH.oU53Y9Tj1i0GOiKm1YJgwQC5hzdp9PRnjFfSbcvLeRXH0Aoos16TNzJUDEu94aNf3R31zLWHzIBlM8CLOlLy6n8eOy0sOwgdLyagrat+.aAuivUDA7YMcSjOw9Bx4zCIpzJnizdPOGlTDLVRjzPHmCDNyFOU7UdR9mvBYm4RUFVnwPgRbi5Lk45L558ZHBoUbT1Nesjc9y0GxbXy8m0AdVb.bFhE6AZEVlREWhRV2Dk5KbcTE3Fnm1BzqXB8VWerc.yWlEQwsGoOfCGNSHPaeQZkjKpvOJn2Q.Yvk08HWP6G.FyQTtsoYMbKSyJ6YX.s9PI1A1EV3WiOmJUGNvtxye.uKYVX4MZX1vxbWqVGass4tsZTeqsspZZYZtA.OCciaC8N4i1.3XnvkV2OfwkkSHQU7F3WAeplTVUZLtKiSwSh31Rlfm2yQk6XITlyqX7cLrLTe4JrItX404BTzmDDRGj9vR.TOL5rv3eUtcM7NUpfyVatIVUdCbNqp+ih0rFtMTrWf2xbdwFBmCSWsxAGYMSJW6V6kVtuPAHFwkKfJiB3Y608LtZd+RvOTHoGwKC8FiRFWYf+yPSljaL0cn.gqKMH2vpCgfaCXYdj2YzfZ3KItQz4IBWtWV87f6l5wN4J8BIJ3C3L4Q9zT6L8kUN5KTpl.90mFzkHIJIWpOHOeZfjoniVW5kv7qDAXI8tzvKjBeXB1eoNgYDBmHWhb4AGpIjoAf9wRJTkJjGxjyVbB58XZhYtSSxc2dGo655iXR6o4y2B4vWnq8+luoylehduISn1xLxVTu+mW0Aw2Cp7QQjDDcCIf16aHM8Ci7FCudxlBLgyotvCRWqf5FUhsoxV0YFS4NwF+BVoAsT1ZoAstNHxiXGHN0NQonl9+vXO.m3wu3qD7FXvFaghUO.Ncy5lHO3kRmZaqZEuD3d9XZrBX1ZEvzbEvzZEvzdEvr8JfYmaEi5+C71HovKQl.NF0KdLhlVONAtkEeiD8arz.GJL
-
@d-healey Strange, I use it for seconds and never had issues... I might have made a mistake while translating for days
-
@d-healey Oh wait! I think it is again the parsing function with 0 at start thinking it is hex...
We probably need Math.round instead...
Thanks for the discovery Dave! -
@d-healey Here you go:
HiseSnippet 820.3ocsV01aSCCD1oqAQCuHlD+.r1mZoktjt1tMlPLVeAUAcqhNPvml7RbWsVhcjiyfJz9uvOQ9G.mS5ZxftwTklkpT8c2y0Ge9dN2QRgKMJRHQFkNdVHEY7Xywy3poclRXbzftHimZNjDonRbpoClERhhndHCi0dm1fQohnj0udyADeB2klYBg9rf4R+.KfoxrNZ+2y786S7nGyBxEcy8G3J3cD9hXfOqYZiBItmSNidHQGVASjwC54wTB4XEQQiPFEOP3Ma7Tw23ow+YVD6TepdiCZLjnTy8E9dZFqsh5Lk46M5pycDBxxnrpvZoUgmaNj4wVXOqZ7rDG3LD4qGFEtM54jmd12c5YjidESo25lickrPUlGM2dj4.NbQMg.WA4oUZrnB+rfYGADAWUOfbNsuD1r.Q41110vsrsqrmkEbMDovdvovA+Z7YTk9hBNUAgC3cIyhJuQC6FN165z5Xmss2sUi5assSUaGa6M.3Ynaban2Y4ns.NFI7o0CkLtpbJIph2.+J3S0zzpCyhw8YbJdRL2UwD7k8CoCdrBxyYUr9gEFV9BWhOVcUb.+FRTSqKEwbubgWOJ9znjuUtcM7NUpfyVatIVmbK7RVU+uoqYMbaHcu.uk8hzMDtHltpIDt0Zllv1s1adB+JkHirRRnjphk7rS7dVWtnhI3GJTzi3k0UmRVWZg+aWSlrTe51Hov2mJWpa80f71.VlGGbJUVCeAwOltHPn+95BHyaV.kWe6l1UmKPAe.moNJjxuIYEZtT.91mFzknHZk1baPbgTohoofQW5EvHrTcWIytznyUhPXH1+HJgQCBuXeh55yKzCIm6.pAWSXpEe7HlZV9gn2KCQtqzccyQLk6zky2BKguPU69luyGI+DydSlPcUYjsnY+ub+O+E8QQrBDZfNTx9NzSdXbvX3EJWJvDNm5q6SMJn6nR2aq2qqLiobujM+FVyc5n2aL2oyUNQADWo3D2T0gdn+CSr.bhm71WI3QXXO1AknX.bl10sQAvaQm35pKEuD39xwzXEvr0Jfo4Jfo0Jfo8JfY6U.yN2JF8eC3swJQPpLALLpWxXDCidbBzkkzQh9CfZPhc.
You just saved my life because I use it in a distribution ready project!
-
@ustk Yeah that seems to work, thanks!
-
@d-healey Poor poor parseInt function...
-
@ustk Do you have a version of this function that works for hours?
-
@d-healey You just have to add the substring corresponding to hours and take 24h as coefficient.
HiseSnippet 858.3ocsVs1aaaCEkxIZnR6AVA1O.h7I6EOWJG+HoAEsMwIaFcI0XNqX6SELRzwDQhTfjpsFE8m7.1+fsKobrTZcSKLPHfAz8w4pitjmK8DkLlo0RExK3hE4Lj224OcgvL+34Tt.MdDx6G7OipMLEtz0QKxoZMKA44s0uZc3ErMxs92mdDMkJhYUtPnWI4wremmwMUdm7rWvSSOklvtfmUK6dOabrTbrLUV.7YKeBJmFeM8J14TaZM7QdeyIIbiTM0PMLMxa6ijIKlNW9VQY9uhq4WlxrFQnoPgJcepLMwxXqWzwy4oISt46VifpLopKrUYW3m7OimvW4upa7it.3JD06GdMtK5EUmdjud54UidaWRuG5OMVwyMUQrb6a8GKfMpYTXKnNsJyE03eZ3erDxPX5jQulcpBLVgn4.BoMtOgz5vvPXaPavIvWQD9I3qXF6FE7UkkOVLhtP2bmtjtQjCh5eQzPxA861YugQ6RhHjc.3Un6dWn2e8nCANpkorN4JtvzrjD6h2A+X32tkk0lVHWjxEL7rBQrgKEq6EYSdpApyUsBeeHFVoxXZJ1bSd.+NiZl2QIKDI0Ruit3Rs6olGzFGE0pUPPvidD92filZWg.6fc+hfGzFueqV3eF2smCukUN3e75KWpdswCbkZXWhqVmAaey03l6QRbuf4s1vJC668bUd+gCHGZK8eynJakGzeUoc0VwLEJQU66vvOrp8KEmKMrWJZZa0AgeHD+wglMaswrmIUxzTlZsgs6op6BXSQQ1kLUa7anoErUIBhkaqF8+7pw5CKhKkH0RTJFK3lWlyDeNMJZotBd5OGOhZnVY6RePd4Lkgaof2H1af4gkh3.+QL80FYNLQ7ST3vbFYRQJ0b6gO1ItKC.8faoxsJYglaVTeh78xDouV59P+IbS770y2FqguPW69luKmu+89mLaFK1TQ1s8O8ut+Gli9CYgAzbfjTweGbl77hrovLkXFvDgfkZOm50vdhpzlXsscloLQhy3+f0xfQVaukAitIHJiFqjuNtTcXuA4ANO.mDtKRCfazAabDxoX.b9jNDTFbw1qiissheA395wzcCvr2Ffo2Ffo+FfYvFfY3FfY+6Di8+T77BiLqTl.NlbhaLhm2IBJbJychD8+.rY34e
Note that you cannot achieve a real date to date difference. If the month has 30 or 31 days, it'll change the result, but you generally don't care if used for checking authorisation that been said... Also, I don't even begin at zero which means that the first January count is already a full month plus one day because I haven't removed the offset (a simple -1 could fix this if one needs it). But what we generally need is not a real count but a difference between two measures, so it's not important where you begin to count, unless you need an absolute value...
But there's still something a bit annoying even with this simplified relative count:
If you arbitrarily consider 30 days/month, then the 31st January equals to 31 * 24 = 744h
and the 1st February gives (30 * 24) + 24 = 744h too... But who cares if a day is skipped?
And then if you choose 31 days/months, then you have 48h between the 31st and the 1st... If you really need to avoid this, then you'll need a lookup table -
@ustk Thanks. A simple comparison is all I need :)
-
@d-healey This is the perfect time to release what I've made when implementing the
getSystemTime()
function to Hise:HiseSnippet 2533.3oc6a07aaibEmx1LarRT1roAEs.8vTcRdshBo+JI61EVJ1VIN0xVwxaRSMB1NlbjzfPxQkbjiUCxsdn2Zu0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GiADpuk+qXLSzqpLyrJ+W7F4XlC
From now on I don't want to see anyone of you arriving on the forum beyond the time!
-
@ustk With sound - amazing :-)
-
@MikeB Thanks, sound's everything!
-
@ustk Really nice :)
-
@ustk Nice You're not joking when you're implementing something !!