aboutsummaryrefslogtreecommitdiff
path: root/examples/log.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-15 17:34:34 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-15 17:34:34 -0400
commit8ee23054bf771e56802ce21d70229b7f8f2e9654 (patch)
tree58b7ac43f523ed1de1e8b5f49b6465d376c88843 /examples/log.tm
parent3cbc62ee43737e3afae0dd2e6597ff703689634e (diff)
Update Inline C syntax and documentation/tests
Diffstat (limited to 'examples/log.tm')
-rw-r--r--examples/log.tm8
1 files changed, 3 insertions, 5 deletions
diff --git a/examples/log.tm b/examples/log.tm
index 24397c90..42df072c 100644
--- a/examples/log.tm
+++ b/examples/log.tm
@@ -6,15 +6,13 @@ timestamp_format := CString("%F %T")
logfiles := {:Path}
func _timestamp()->Text:
- c_str := inline C (
- ({
+ c_str := inline C: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;
- })
- ) : CString
+ str
+ }
return c_str:as_text()
func info(text:Text, newline=yes):