3 ms·
How hard would it be to modify this to work with ISO-8601, the international time stamp format? In the most common case, you'd have something like 2023-07-02T1
by mabbo 3y ago
How hard would it be to modify this to work with ISO-8601, the international time stamp format?
In the most common case, you'd have something like 2023-07-02T15:46:00Z possibly with a ".123" been the last "0" and "Z".
Would it be fastest to just copy the relevant chars to the correct place for the code in the post? Or could you do it in place somehow?
- zokier 3y agoShouldn't be too hard, assuming you don't need any validation. There afaik are simd instructions to move bytes around (vpermb maybe?), so that should take care of getting rid of the separators
- anonymoushn 3y agoThe code in the post doesn't seem to finish the job. For a timestamp like "2023-07-02T15:46:00Z" or the other formats you mentioned, the timestamp fits in a single 32-byte register, so you could write code that deals with the stuff as it is. If you have a mix of timestamps with different numbers of decimals or with different time zones, dealing with those things will take a bit of work compered to the ideal case where you had all "Z" or all "+" or all "-" for the time zones and all the same number of decimals for the fractional seconds.