1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

core: add support of specifier %@ for UTC time in function util_strftimeval

This commit is contained in:
Sébastien Helleu
2025-05-18 22:15:06 +02:00
parent 4d617d0e01
commit 8106db400d
8 changed files with 48 additions and 20 deletions
+5 -3
View File
@@ -4803,7 +4803,7 @@ This function is not available in scripting API.
==== util_strftimeval
_WeeChat ≥ 4.2.0, updated in 4.3.0._
_WeeChat ≥ 4.2.0, updated in 4.3.0, 4.7.0._
Format date and time like function `strftime` in C library, using `struct timeval`
as input, and supporting extra specifiers.
@@ -4820,6 +4820,8 @@ Arguments:
* _string_: buffer where the formatted string is stored
* _max_: string size
* _format_: format, the same as _strftime_ function, with these extra specifiers:
** `%@`: return the date expressed in Coordinated Universal Time (UTC)
instead of date relative to the user's specified timezone _(WeeChat ≥ 4.7.0)_
** `%.N` where `N` is between 1 and 6: zero-padded microseconds on N digits
(for example `%.3` for milliseconds)
** `%f`: alias of `%.6`
@@ -4836,8 +4838,8 @@ C example:
char time[256];
struct timeval tv;
gettimeofday (&tv, NULL);
weechat_util_strftimeval (time, sizeof (time), "%FT%T.%f", &tv);
/* result: 2023-12-26T18:10:04.460509 */
weechat_util_strftimeval (time, sizeof (time), "%@%FT%T.%fZ", &tv);
/* result: 2023-12-26T18:10:04.460509Z */
----
[NOTE]
+5 -3
View File
@@ -4882,7 +4882,7 @@ Cette fonction n'est pas disponible dans l'API script.
==== util_strftimeval
_WeeChat ≥ 4.2.0, mis à jour dans la 4.3.0._
_WeeChat ≥ 4.2.0, mis à jour dans la 4.3.0, 4.7.0._
Formatter la date et l'heure comme la fonction `strftime` de la bibliothèque C,
en utilisant un `struct timeval` en entrée et en supportant des caractères de
@@ -4901,6 +4901,8 @@ Paramètres :
* _max_ : taille de la chaîne
* _format_ : format, le même que celui de la fonction _strftime_, avec des
caractères de conversion supplémentaires :
** `%@`: retourner la date exprimée en Temps Universel Coordonné (UTC)
au lieu de la date relative au fuseau horaire de l'utilisateur _(WeeChat ≥ 4.7.0)_
** `%.N` où `N` est entre 1 and 6: microsecondes remplies avec des zéros sur
N chiffres (par exemple `%.3` pour les millisecondes)
** `%f` : alias de `%.6`
@@ -4917,8 +4919,8 @@ Exemple en C :
char time[256];
struct timeval tv;
gettimeofday (&tv, NULL);
weechat_util_strftimeval (time, sizeof (time), "%FT%T.%f", &tv);
/* résultat : 2023-12-26T18:10:04.460509 */
weechat_util_strftimeval (time, sizeof (time), "%@%FT%T.%fZ", &tv);
/* résultat : 2023-12-26T18:10:04.460509Z */
----
[NOTE]
+5 -3
View File
@@ -5023,7 +5023,7 @@ Questa funzione non è disponibile nelle API per lo scripting.
// TRANSLATION MISSING
==== util_strftimeval
_WeeChat ≥ 4.2.0, updated in 4.3.0._
_WeeChat ≥ 4.2.0, updated in 4.3.0, 4.7.0._
Format date and time like function `strftime` in C library, using `struct timeval`
as input, and supporting extra specifiers.
@@ -5040,6 +5040,8 @@ Arguments:
* _string_: buffer where the formatted string is stored
* _max_: string size
* _format_: format, the same as _strftime_ function, with these extra specifiers:
** `%@`: return the date expressed in Coordinated Universal Time (UTC)
instead of date relative to the user's specified timezone _(WeeChat ≥ 4.7.0)_
** `%.N` where `N` is between 1 and 6: zero-padded microseconds on N digits
(for example `%.3` for milliseconds)
** `%f`: alias of `%.6`
@@ -5056,8 +5058,8 @@ C example:
char time[256];
struct timeval tv;
gettimeofday (&tv, NULL);
weechat_util_strftimeval (time, sizeof (time), "%FT%T.%f", &tv);
/* result: 2023-12-26T18:10:04.460509 */
weechat_util_strftimeval (time, sizeof (time), "%@%FT%T.%fZ", &tv);
/* result: 2023-12-26T18:10:04.460509Z */
----
[NOTE]
+5 -3
View File
@@ -4937,7 +4937,7 @@ weechat_printf (NULL, "date: %s",
// TRANSLATION MISSING
==== util_strftimeval
_WeeChat ≥ 4.2.0, updated in 4.3.0._
_WeeChat ≥ 4.2.0, updated in 4.3.0, 4.7.0._
Format date and time like function `strftime` in C library, using `struct timeval`
as input, and supporting extra specifiers.
@@ -4954,6 +4954,8 @@ Arguments:
* _string_: buffer where the formatted string is stored
* _max_: string size
* _format_: format, the same as _strftime_ function, with these extra specifiers:
** `%@`: return the date expressed in Coordinated Universal Time (UTC)
instead of date relative to the user's specified timezone _(WeeChat ≥ 4.7.0)_
** `%.N` where `N` is between 1 and 6: zero-padded microseconds on N digits
(for example `%.3` for milliseconds)
** `%f`: alias of `%.6`
@@ -4970,8 +4972,8 @@ C example:
char time[256];
struct timeval tv;
gettimeofday (&tv, NULL);
weechat_util_strftimeval (time, sizeof (time), "%FT%T.%f", &tv);
/* result: 2023-12-26T18:10:04.460509 */
weechat_util_strftimeval (time, sizeof (time), "%@%FT%T.%fZ", &tv);
/* result: 2023-12-26T18:10:04.460509Z */
----
[NOTE]
+6 -3
View File
@@ -4663,7 +4663,7 @@ weechat_printf (NULL, "date: %s",
==== util_strftimeval
_WeeChat ≥ 4.2.0, ажурирано у 4.3.0._
_WeeChat ≥ 4.2.0, ажурирано у 4.3.0, 4.7.0._
Форматира датум и време као функција `strftime` из C библиотеке, користећи `struct timeval`
као улаз уз подршку за додатне спецификаторе.
@@ -4680,6 +4680,9 @@ int weechat_util_strftimeval (char *string, int max, const char *format, struct
* _string_: бафер у који се смешта форматирани стринг
* _max_: величина стринга
* _format_: формат, исто као за _strftime_ функцију, са следећим додатним спецификаторима:
// TRANSLATION MISSING
** `%@`: return the date expressed in Coordinated Universal Time (UTC)
instead of date relative to the user's specified timezone _(WeeChat ≥ 4.7.0)_
** `%.N` где је `N` између 1 и 6: микросекунде допуњене нулама на N цифара
(на пример `%.3` за милисекунде)
** `%f`: алијас за `%.6`
@@ -4696,8 +4699,8 @@ C пример:
char time[256];
struct timeval tv;
gettimeofday (&tv, NULL);
weechat_util_strftimeval (time, sizeof (time), "%FT%T.%f", &tv);
/* резултат: 2023-12-26T18:10:04.460509 */
weechat_util_strftimeval (time, sizeof (time), "%@%FT%T.%fZ", &tv);
/* резултат: 2023-12-26T18:10:04.460509Z */
----
[NOTE]