Comments (10)
I pushed a quick fix. It is not perfect--the buffer for local time may be longer than the buffer.
But at least it avoids the warning messages.
$ gcc-8 -Wall example.c zlog.c -o example -lpthread
$ gcc-8 --version
gcc-8 (Ubuntu 8.3.0-6ubuntu1~18.04) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
from zlog.
Confirmed that it avoids the warning for me too. Would be good to look at a more robust fix for a future version maybe but this is already an improvement :)
from zlog.
Did some quick tests - looks good. Thanks for taking care of this so quickly! :)
from zlog.
Thanks for the confirmation.
So far, I would like to find some time to do some more revisions first to handle the cases when the strftime()
returns 0 if the buffer is not large enough ( https://www.systutorials.com/docs/linux/man/3-strftime/ ) although it is rare. If strftime()
fails, the library can fall back to the ! ZLOG_REAL_WORLD_TIME case.
from zlog.
Could you use ctime_r() for the datetime formatting which is guaranteed to be 26 bytes or less?
from zlog.
@jwaggy ctime_r() sounds a better solution. Would you like to send some pull request?
from zlog.
This was fixed in master as of 44c5d8a but current master fails to compile with the same error. Looks like a regression....
from zlog.
Looks like it was introduced in this commit: 93e66a8
from zlog.
I may take a little time and implement @jwaggy’s suggestion to fix this problem.
from zlog.
The warnings should now be taken care of.
from zlog.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zlog.