Skip to content

Commit d927ba4

Browse files
authored
Merge pull request vtsykun#14 from okvpn/fix/locale-format
Ignore LC_NUMERIC format in sprintf
2 parents d6a0c64 + d80e48a commit d927ba4

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Command/CronCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected function executeLoop(InputInterface $input, OutputInterface $output):
9999
}
100100

101101
$this->scheduler($input, $output);
102-
$output->writeln(sprintf('[%s] All schedule tasks completed in %.3f seconds', $this->getCurrentDate()->format('Y-m-d H:i:s.u'), \microtime(true) - $runAt), OutputInterface::VERBOSITY_VERBOSE);
102+
$output->writeln(sprintf('[%s] All schedule tasks completed in %.3F seconds', $this->getCurrentDate()->format('Y-m-d H:i:s.u'), \microtime(true) - $runAt), OutputInterface::VERBOSITY_VERBOSE);
103103
if ($loop instanceof ReactLoopAdapter) {
104104
$loop->setDefaultLoopTime();
105105
}

src/Middleware/CronMiddlewareEngine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ private function handleDemand(\DateTimeInterface $now, ScheduleEnvelope $envelop
103103
$delay = (float) $nextTime->format('U.u') - (float) $now->format('U.u');
104104

105105
$loop->addTimer($delay, $runner);
106-
ET::debug($envelope, \sprintf("{{ task }} > was scheduled with delay %.6f sec.", $delay));
106+
ET::debug($envelope, \sprintf("{{ task }} > was scheduled with delay %.6F sec.", $delay));
107107
}
108108

109109
return $result;
110110
});
111111

112112
$delay = (float) $nextTime->format('U.u') - (float) $now->format('U.u');
113113

114-
ET::debug($envelope, \sprintf("{{ task }} > was scheduled with delay %.6f sec.", $delay));
114+
ET::debug($envelope, \sprintf("{{ task }} > was scheduled with delay %.6F sec.", $delay));
115115
$loop->addTimer($delay, $runner);
116116

117117
return ($clone = clone $stack)->end()->handle($envelope, $clone);

src/Utils/CronUtils.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
final class CronUtils
1111
{
12-
public static function toDate(/*float|string|\DateTimeInterface */ $unix, /* \DateTimeInterface|\DateTimeZone|string|null */ $timezone): \DateTimeImmutable
12+
public static function toDate(/*float|string|\DateTimeInterface */ $unix, /* \DateTimeInterface|\DateTimeZone|string|null */ $timezone = null): \DateTimeImmutable
1313
{
1414
$timezone = $timezone instanceof \DateTimeInterface ? $timezone->getTimezone() : $timezone;
1515
$timezone = \is_string($timezone) ? new \DateTimeZone($timezone) : $timezone;
@@ -18,6 +18,6 @@ public static function toDate(/*float|string|\DateTimeInterface */ $unix, /* \Da
1818
$unix = $unix->format('U.u');
1919
}
2020

21-
return \DateTimeImmutable::createFromFormat("U.u", sprintf("%.6f", $unix), $timezone);
21+
return \DateTimeImmutable::createFromFormat("U.u", sprintf("%.6F", $unix), $timezone);
2222
}
2323
}

0 commit comments

Comments
 (0)