It it now a leap year?

Peter Gordon peter at thecodergeek.com
Wed Aug 8 20:49:15 UTC 2007


On Wed, 2007-08-08 at 12:31 -0400, Mike - EMAIL IGNORED wrote:
> Is there a system call or variable that will
> tell me if it is now a leap year, or should I
> do the arithmetic?
> 
> Mike.

It's not part of the "standard" set of API calls, but GLib (a library
used by many desktop applications and GTK+ itself for portability and
handling of various data structures) contains a function called
g_date_is_leap_year [1] that may help you in this.

Also, if you're using C++ instead, there is the official GLib C++
wrappers (GLibmm), the Glib::Date::is_leap_year member function will do
the same. Thirdly, Boost has a date_time library whose gregorian type
contains an "is_leap_year" function which also acts similarly.

[1] http://tinyurl.com/2mb24t
[2] http://tinyurl.com/3awun4
[3] http://tinyurl.com/2q4tzn

Hope that helps.
-- 
Peter Gordon (codergeek42)
GnuPG Public Key ID: 0xFFC19479 / Fingerprint:
  DD68 A414 56BD 6368 D957 9666 4268 CB7A FFC1 9479
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20070808/c9fac244/attachment-0001.sig>


More information about the fedora-list mailing list