Date.php 920 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * This file is part of webman.
  4. *
  5. * Licensed under The MIT License
  6. * For full copyright and license information, please see the MIT-LICENSE.txt
  7. * Redistributions of files must retain the above copyright notice.
  8. *
  9. * @author walkor<[email protected]>
  10. * @copyright walkor<[email protected]>
  11. * @link http://www.workerman.net/
  12. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  13. */
  14. namespace support\bootstrap;
  15. use Webman\Bootstrap;
  16. use Workerman\Timer;
  17. /**
  18. * Class Date
  19. * @package support\bootstrap
  20. */
  21. class Date implements Bootstrap {
  22. public static $date = '';
  23. /**
  24. * @param \Workerman\Worker $worker
  25. * @return void
  26. */
  27. public static function start($worker)
  28. {
  29. self::$date = gmdate('D, d M Y H:i:s').' GMT';
  30. Timer::add(1, function() {
  31. self::$date = gmdate('D, d M Y H:i:s').' GMT';
  32. });
  33. }
  34. }