From: Peter Lawler <gaim-devel@si...> - 2006-01-24 23:43:57
Just banging together a plugin here, and I wanted to use some date
I notice that gaim_date returns a time, and not a date. So I started
wondering whether this should be renamed to gaim_time. Further, this
would mean we would probably need a real gaim_date as well as a
But this lead to my looking around the source, and I can't locate a call
to gaim_date anyway. How would everyone feel about changing these around
to suit, or should gaim_date just get the axe (I don't think it should,
but that's because I'm too lazy to re-write the routines for every
plugin I write that may need it).
Peter Lawler spake unto us the following wisdom:
> But this lead to my looking around the source, and I can't locate a call=
> to gaim_date anyway. How would everyone feel about changing these around=
> to suit, or should gaim_date just get the axe (I don't think it should,=
> but that's because I'm too lazy to re-write the routines for every=20
> plugin I write that may need it).
These functions are both basically one-liners, although they have been
gratuitously complicated by using the argument to time() (I have no
idea why). gaim_date() could quite literally be:
static char date;
strftime(date, sizeof(date), "%H:%M:%S", localtime(time(NULL)));
gaim_date_full could likewise be simplified by using strftime instead
of ctime, so the carriage return does not require stripping.
Between this simplicity and the fact that they both return pointers to
static buffers (yuck), I'd axe them if they're unused.
The laws that forbid the carrying of arms are laws [that have no remedy
for evils]. They disarm only those who are neither inclined nor
determined to commit crimes.
-- Cesare Beccaria, "On Crimes and Punishments", 1764