Blame tests/datetime.c

Packit ae235b
/*
Packit ae235b
 * Copyright (C) 2011 Red Hat, Inc.
Packit ae235b
 *
Packit ae235b
 * This library is free software; you can redistribute it and/or modify
Packit ae235b
 * it under the terms of the GNU Lesser General Public License as
Packit ae235b
 * published by the Free Software Foundation; either version 2.1 of the
Packit ae235b
 * licence, or (at your option) any later version.
Packit ae235b
 *
Packit ae235b
 * This is distributed in the hope that it will be useful, but WITHOUT
Packit ae235b
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
Packit ae235b
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
Packit ae235b
 * License for more details.
Packit ae235b
 *
Packit ae235b
 * You should have received a copy of the GNU Lesser General Public License
Packit ae235b
 * along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit ae235b
 */
Packit ae235b
Packit ae235b
#include <locale.h>
Packit ae235b
#include <glib/glib.h>
Packit ae235b
Packit ae235b
int
Packit ae235b
main (int argc, char *argv[])
Packit ae235b
{
Packit ae235b
  gchar *fmt;
Packit ae235b
  GDateTime *dt;
Packit ae235b
  gchar *str;
Packit ae235b
Packit ae235b
  setlocale (LC_ALL, "");
Packit ae235b
Packit ae235b
  if (argc > 1)
Packit ae235b
    fmt = argv[1];
Packit ae235b
  else
Packit ae235b
    fmt = "%x %X";
Packit ae235b
Packit ae235b
  dt = g_date_time_new_now_local ();
Packit ae235b
  str = g_date_time_format (dt, fmt);
Packit ae235b
  g_print ("%s\n", str);
Packit ae235b
  g_free (str);
Packit ae235b
  g_date_time_unref (dt);
Packit ae235b
Packit ae235b
  return 0;
Packit ae235b
}