/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/datetime.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
{
if (argc == 0)
{
if (grub_get_datetime (&datetime))
return grub_errno;
grub_printf ("%d-%02d-%02d %02d:%02d:%02d %s\n",
return 0;
}
mask = 0;
{
char *p, c;
p = args[0];
c = *p;
if (c == '-')
ofs = 0;
else if (c == ':')
ofs = 3;
else
goto fail;
for (n = 1; (n < 3) && (*p); n++)
{
if (*p != c)
goto fail;
}
if (*p)
goto fail;
if ((ofs == 0) && (n == 2))
{
ofs++;
cur_mask <<= 1;
}
for (; n; n--, ofs++)
goto fail;
}
if (grub_get_datetime (&datetime))
return grub_errno;
if (mask & GRUB_DATETIME_SET_YEAR)
if (mask & GRUB_DATETIME_SET_MONTH)
if (mask & GRUB_DATETIME_SET_DAY)
if (mask & GRUB_DATETIME_SET_HOUR)
if (mask & GRUB_DATETIME_SET_MINUTE)
if (mask & GRUB_DATETIME_SET_SECOND)
return grub_set_datetime (&datetime);
fail:
}
{
cmd =
N_("[[year-]month-day] [hour:minute[:second]]"),
}
{
}