From fb6dc0a8b9b5537ef708778bf013f71f98fad41f Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 12 Sep 2024 03:41:44 -0400 Subject: Fix up CString:as_text() --- examples/log.tm | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'examples/log.tm') 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) -- cgit v1.2.3