Fix to update start time

This commit is contained in:
Ilia Rostovtsev
2020-02-29 01:31:19 +03:00
parent c84155f9e9
commit 4c4bb4fa97

View File

@@ -459,9 +459,11 @@ sub translate
my $format = $opt->{'translate-format'};
# Updating Google Translate API token to avoid expiration
if (((time() - $data->{'start_time'}) / 60) > 15) {
my $time = time();
if ((($time - $data->{'start_time'}) / 60) > 15) {
say CYAN, "Updating Google Translate API token..", RESET;
$data->{'token'} = get_google_translate_token();
$data->{'start_time'} = $time;
}
my $token = $data->{'token'};