diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 21:43:19 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 21:43:19 -0400 |
| commit | d8afa73368cdff38125fa1f7d17ad5ce54c84def (patch) | |
| tree | ac4e54673da6ac32df1e351b913b7c1ddd1118b9 /examples/log | |
| parent | f4020db2f0d772481ba71edf78fbb65575badc00 (diff) | |
Improved inline C code: now uses `C_code` keyword and supports
interpolation with @
Diffstat (limited to 'examples/log')
| -rw-r--r-- | examples/log/log.tm | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/log/log.tm b/examples/log/log.tm index 94984b81..9c3396e7 100644 --- a/examples/log/log.tm +++ b/examples/log/log.tm @@ -6,13 +6,13 @@ timestamp_format := CString("%F %T") logfiles : @|Path| func _timestamp(->Text) - c_str := inline C:CString { + c_str := C_code:CString( char *str = GC_MALLOC_ATOMIC(20); time_t t; time(&t); struct tm *tm_info = localtime(&t); strftime(str, 20, "%F %T", tm_info); str - } + ) return c_str.as_text() func info(text:Text, newline=yes) |
