add morphism for unix-timestamp to iso8601
This commit is contained in:
parent
8b8acb81a6
commit
24b332c682
1 changed files with 15 additions and 0 deletions
15
morphisms/timepoint.morphism-base
Normal file
15
morphisms/timepoint.morphism-base
Normal file
|
@ -0,0 +1,15 @@
|
|||
```
|
||||
#include <time.h>
|
||||
```
|
||||
|
||||
morph_unixtime_to_iso ()
|
||||
TimePoint ~ <TimeSince UnixEpoch> ~ Duration ~ Seconds ~ ℝ ~ <QuantizedLinear 0 1 1> ~ ℕ ~ x86.UInt64
|
||||
--> TimePoint ~ ISO8601 ~ <Seq~<ValueTerminated 0> Char~Ascii~x86.UInt8>
|
||||
```
|
||||
time_t rawtime = (time_t)(*src);
|
||||
struct tm *timeinfo = gmtime(&rawtime);
|
||||
if (!timeinfo) return -1;
|
||||
|
||||
strftime((char*)dst, 20, "%Y-%m-%dT%H:%M:%SZ", timeinfo);
|
||||
return 0;
|
||||
```
|
Loading…
Add table
Reference in a new issue