Prima::...et::Time(3)
π Prima::Widget::Time β the time input widget that just gets it π
okay so bestie, this is from the User Contributed Perl Documentation for Prima::...et::Time(3) (yes the header's a lil truncated in the wild, that's just how it's spelled, don't come for me π«Ά), and it's genuinely one of the cutest lil widgets in the Prima family. It's the standard time input widget, and β plot twist β it's derived from the Prima::InputLine class. Iconic lineage, honestly.
β¨ SYNOPSIS β¨
like, the whole vibe in four lines:
use Prima qw(Application Widget::Time);
my $mw = Prima::MainWindow->new;
$mw->insert( 'Widget::Time' =>
pack => { fill => 'x', pad => 20 },
);
run Prima;
no cap, that's it. you insert a 'Widget::Time', you pack it with fill => 'x' and pad => 20, you run Prima, and the clock is literally clocking. π
πΈ DESCRIPTION πΈ
Standard time input widget π β derived from the Prima::InputLine class. That's the whole thing, she's simple and she's serving.
π API π
π¦ Methods π¦
time2str TIMEβ converts the TIME into a string representation, according to whatever the currentformatstring is set to. it's giving "say it in human, pls". β¨default_formatβ returns a string meant to be used informat, where that string is constructed to reflect the formatting of the regional time preferences. localized and thoughtful, we love to see it π
See also: man 3 strftime, %X .
str2time STRINGβ tries to extract a time out of STRING, assuming it was constructed according to the currentformatstring. and here's the thing π β it doesn't fail, but any values that could not be extracted get assigned to the current second/minute/hour instead. so no crashing, just a lil "we'll keep what we had" energy πvalidate_time S, M, Hβ checks whether S, M, H form a valid point in time, and adjusts the values if they don't. returns the corrected values. she's the responsible friend fr fr π«Ά
π Properties π
format STRINGβ this is the format string, used when converting the time to its visual interpretation, also with regional preferences β f exhh:mm:ssorhh:mm:AA. the syntax of the format is verbatim as this, i e it recognizes the fixed patternshh,mm,ss,aa, andAA, replacing them with the time values.
("aa" is for <am / pm>, "AA" is for <AM / PM>). π
case matters, bestie!
hourβ selects the hour.minuteβ selects the minute.second INTEGERβ selects the second.time SEC, MIN, HOUR | [ SEC, MIN, HOUR ]β accepts three integers, or an arrayref with three integers, in the format oflocaltime. SEC and MIN can be from0to59, and HOUR from0to23.
Default value: today's time. β
lowkey the ranges are the whole personality check β you go out of0..59/0..23and that's a whole thing, so keep it cute and in range π
π AUTHOR π
Dmitry Karasik, <dmitry@karasik.eu.org>. thank you king, the widget ate π₯
π SEE ALSO π
Prima::InputLine β go look at the parent, she raised a good one π
okay that's the whole page!! and as a lil sign-off: this beauty ships as perl v5.42.0, dated 2024-08-20 β that's the source/version + date footer, folded in all cute so you don't gotta squint at it πβ¨ go forth and let your users pick a time, mwah π
π¦ where this page comes from
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms