| 1 | -- date and time widget type using os.date with optional time formatting |
| 2 | -- Copyright (C) 2009 Lucas de Vries <[email protected]> |
| 3 | -- Copyright (C) 2010 Adrian C. <[email protected]> |
| 4 | -- Copyright (C) 2017 mutlusun <[email protected]> |
| 5 | -- Copyright (C) 2019 Nguyễn Gia Phong <[email protected]m> |
| 6 | -- |
| 7 | -- This file is part of Vicious. |
| 8 | -- |
| 9 | -- Vicious is free software: you can redistribute it and/or modify |
| 10 | -- it under the terms of the GNU General Public License as |
| 11 | -- published by the Free Software Foundation, either version 2 of the |
| 12 | -- License, or (at your option) any later version. |
| 13 | -- |
| 14 | -- Vicious is distributed in the hope that it will be useful, |
| 15 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | -- GNU General Public License for more details. |
| 18 | -- |
| 19 | -- You should have received a copy of the GNU General Public License |
| 20 | -- along with Vicious. If not, see <https://www.gnu.org/licenses/>. |
| 21 | |
| 22 | -- {{{ Grab environment |
| 23 | local os = { date = os.date, time = os.time } |
| 24 | local helpers = require"vicious.helpers" |
| 25 | -- }}} |
| 26 | |
| 27 | return helpers.setcall(function (format, warg) |
| 28 | return os.date(format or nil, warg and os.time()+warg or nil) |
| 29 | end) |