mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-15 05:00:49 +08:00
fix carbon 3 diffIn*
This commit is contained in:
@@ -262,7 +262,7 @@ class TorrentRepository extends BaseRepository
|
||||
public function getPeerUploadSpeed($peer): string
|
||||
{
|
||||
$diff = $peer->uploaded - $peer->uploadoffset;
|
||||
$seconds = max(1, $peer->started->diffInSeconds($peer->last_action));
|
||||
$seconds = max(1, $peer->started->diffInSeconds($peer->last_action, true));
|
||||
return mksize($diff / $seconds) . '/s';
|
||||
}
|
||||
|
||||
@@ -270,9 +270,9 @@ class TorrentRepository extends BaseRepository
|
||||
{
|
||||
$diff = $peer->downloaded - $peer->downloadoffset;
|
||||
if ($peer->isSeeder()) {
|
||||
$seconds = max(1, $peer->started->diffInSeconds($peer->finishedat));
|
||||
$seconds = max(1, $peer->started->diffInSeconds($peer->finishedat, true));
|
||||
} else {
|
||||
$seconds = max(1, $peer->started->diffInSeconds($peer->last_action));
|
||||
$seconds = max(1, $peer->started->diffInSeconds($peer->last_action, true));
|
||||
}
|
||||
return mksize($diff / $seconds) . '/s';
|
||||
}
|
||||
@@ -550,7 +550,7 @@ class TorrentRepository extends BaseRepository
|
||||
$hasBeenDownloaded = Snatch::query()->where('torrentid', $torrent->id)->exists();
|
||||
$log = "Torrent: {$torrent->id} is in promotion, hasBeenDownloaded: $hasBeenDownloaded";
|
||||
if (!$hasBeenDownloaded) {
|
||||
$diffInSeconds = $torrent->promotion_until->diffInSeconds($torrent->added);
|
||||
$diffInSeconds = $torrent->promotion_until->diffInSeconds($torrent->added, true);
|
||||
$log .= ", addSeconds: $diffInSeconds";
|
||||
$torrentUpdate['promotion_until'] = $torrent->promotion_until->addSeconds($diffInSeconds);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user