diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-12 03:41:44 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-12 03:41:44 -0400 |
| commit | fb6dc0a8b9b5537ef708778bf013f71f98fad41f (patch) | |
| tree | d1d1c8c8a2f101eddbad8293f3afd7cb27e3b1cd /examples | |
| parent | 4d4e3b2a9d80433ca0fe160a5c899c4d37dda9c8 (diff) | |
Fix up CString:as_text()
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/log.tm | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/examples/log.tm b/examples/log.tm index 765fc61f..24397c90 100644 --- a/examples/log.tm +++ b/examples/log.tm @@ -6,17 +6,16 @@ timestamp_format := CString("%F %T") logfiles := {:Path} func _timestamp()->Text: - return inline C ( + c_str := inline C ( ({ char *str = GC_MALLOC_ATOMIC(20); - time_t t; - time(&t); - struct tm *tm_info; - tm_info = localtime(&t); + time_t t; time(&t); + struct tm *tm_info = localtime(&t); strftime(str, 20, "%F %T", tm_info); - Text$format("%s", str); + str; }) - ) : Text + ) : CString + return c_str:as_text() func info(text:Text, newline=yes): say("$\[2]⚫ $text$\[]", newline) |
