You are not logged in.

#1 2020-01-15 16:42:03

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 5,879

[SOLVED] scrot with a differnt "time"

OK I use this for a scrot call:

scrot '%F_%H%M%S_S11.jpg' -e 'mv $f /media/5/images/ ; mirage /media/5/images/$f'

but what I'd like is to have the "%F_%H%M%S" report "UTC" time or any other time zone similar to the bash commands:

 SAMPLES:

         Atlantic: ${tztime Canada/Atlantic}
          Central: ${tztime Canada/Central}
          Pacific: ${tztime Canada/Pacific}
            Yukon: ${tztime Canada/Yukon}

              UTZ: ${tztime UTZ}
             ZULU: ${tztime ZULU}
        Greenwich: ${tztime Greenwich}

but like %H%M%S with no :


Possible???  YES!!!  use faketime - see below!


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.

Offline

#2 2020-01-15 18:19:36

damo
....moderator....
Registered: 2015-08-20
Posts: 5,633

Re: [SOLVED] scrot with a differnt "time"

scrot uses strftime to output the characters preceded by "%".

See 'man strftime' for the possibilities. '%Z'?


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#3 2020-01-15 18:26:07

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 5,879

Re: [SOLVED] scrot with a differnt "time"

 15 Jan 20 @ 15:24:59 ~
   $ man strftime
No manual entry for strftime
 
 15 Jan 20 @ 15:25:02 ~
   $  15 Jan 20 @ 15:24:59 ~
bash: 15: command not found
 
 15 Jan 20 @ 15:28:52 ~
   $    $ man strftime
bash: $: command not found
 
 15 Jan 20 @ 15:28:52 ~
   $ No manual entry for strftime
bash: No: command not found
 
 15 Jan 20 @ 15:28:52 ~
   $  
 
 15 Jan 20 @ 15:28:52 ~
   $  15 Jan 20 @ 15:25:02 ~
bash: 15: command not found
 
 15 Jan 20 @ 15:28:52 ~
   $    $ 
bash: $: command not found
 
 15 Jan 20 @ 15:28:53 ~
   $ strftime %Z UTZ
bash: strftime: command not found
 
 15 Jan 20 @ 15:29:10 ~
   $ strftime %z
bash: strftime: command not found
 
 15 Jan 20 @ 15:29:52 ~
   $ sho strftime
alias = aptitude show filename
E: Unable to locate package strftime
 
 15 Jan 20 @ 15:30:32 ~
   $ ser strftime
alias ser = aptitude search
p   libposix-strftime-compiler-perl                 - GNU C library compatible strftime for loggers and servers 
 
 15 Jan 20 @ 15:30:40 ~
   $ get strftime
[sudo] password for sector11: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package strftime
 
 15 Jan 20 @ 15:30:57 ~
   $ strftime %z
bash: strftime: command not found
 
 15 Jan 20 @ 15:31:04 ~
   $ 

but will check

Yea, can not get it or %z to work  sad

EDIT:

scrot %F_%H%M%S_%Z.jpg

%z would give -HHMM
gives the "offset" from UTZ where I am,  Not where say where Calgary Canada would be.
2020-01-15-155859-S11.jpg
But getting closer, thanks damo.

Last edited by Sector11 (2020-01-15 19:02:51)


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.

Offline

#4 2020-01-15 18:58:04

unklar
Member
Registered: 2015-10-31
Posts: 1,027

Re: [SOLVED] scrot with a differnt "time"

https://packages.debian.org/search?keyw … ection=all

apt show libposix-strftime-compiler-perl
Package: libposix-strftime-compiler-perl
Version: 0.42-1
Priority: optional
Section: perl
Maintainer: Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org>
Installed-Size: 39,9 kB
Depends: perl
Homepage: https://metacpan.org/release/POSIX-strftime-Compiler
Tag: devel::lang:perl, devel::library, implemented-in::perl
Download-Size: 11,7 kB
APT-Sources: https://deb.debian.org/debian stretch/main i386 Packages
Description: GNU C library compatible strftime for loggers and servers
 POSIX::strftime::Compiler provides a GNU C library compatible
 strftime(3), which is not affected by the system locale. This is useful
 when you want to write loggers, servers and portable applications that
 generate the same result strings on any locale. Technically,
 POSIX::strftime::Compiler wraps POSIX::strftime and converts some format
 characters to perl code.

Last edited by unklar (2020-01-15 19:05:05)

Offline

#5 2020-01-15 19:08:20

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 5,879

Re: [SOLVED] scrot with a differnt "time"

danke unklar but not really needed, uses the same format as conky does:

Conky: ${time %?} or ${time %? %? %?}

Time
====
%H 	Two digit representation of the hour in 24-hour format 	00 through 23
%I 	Two digit representation of the hour in 12-hour format 	01 through 12
%l   (lower-case 'L') Hour in 12-hour format, with a space preceeding single digits 1 through 12

%M 	Two digit representation of the minute 	00 through 59

%p 	UPPER-CASE 'AM' or 'PM' based on the given time 	Example: AM for 00:31, PM for 22:23
%P 	lower-case 'am' or 'pm' based on the given time 	Example: am for 00:31, pm for 22:23

%r 	Same as "%I:%M:%S %p" 	Example: 09:34:17 PM for 21:34:17
%R 	Same as "%H:%M" 	Example: 00:35 for 12:35 AM, 16:44 for 4:44 PM
%S 	Two digit representation of the second 	00 through 59
%T 	Same as "%H:%M:%S" 	Example: 21:34:17 for 09:34:17 PM
-------
%X 	Preferred time representation based on locale, without the date 	Example: 03:59:16 or 15:59:16
-------
%z 	Either the time zone offset from UTC or the abbreviation (depends on operating system) 	Example: -0500 or EST for Eastern Time
%Z 	The time zone offset/abbreviation option NOT given by %z (depends on operating system) 	Example: -0500 or EST for Eastern Time

Day
===
%a 	An abbreviated textual representation of the day 	Sun through Sat
%A 	A full textual representation of the day 	Sunday through Saturday
%d 	Two-digit day of the month (with leading zeros) 	01 to 31
%e 	Day of the month, with a space preceding single digits 	1 to 31
%j 	Day of the year, 3 digits with leading zeros 	001 to 366
%u 	ISO-8601 numeric representation of the day of the week 	1 (for Monday) though 7 (for Sunday)
%w 	Numeric representation of the day of the week 	0 (for Sunday) through 6 (for Saturday)

Month
=====
%b 	Abbreviated month name, based on the locale 	Jan through Dec
%B 	Full month name, based on the locale 	January through December
%h 	Abbreviated month name, based on the locale (an alias of %b) 	Jan through Dec
%m 	Two digit representation of the month (with leading zeros) 	01 to 12

Year
====
%g 	Two digit representation of the year going by ISO-8601:1988 standards (see Week: %V) 	Example: 09 for the week of January 6, 2009
%G 	The full four-digit version of %g 	Example: 2008 for the week of January 3, 2009
%y 	Two digit representation of the year 	Example: 09 for 2009, 79 for 1979
%Y 	Four digit representation for the year 	Example: 2038

Century
=======
%C 	Two digit representation of the century (year divided by 100, truncated to an integer) 	19 for the 20th

Week
====
%U 	Week number of the given year, starting with the first Sunday as the first week 13 (for the 13th full week of the year)
%V 	ISO-8601:1988 week number of the given year, starting with the first week of the year with at least 4 weekdays, with Monday being the start of the week
 	01 through 53 (where 53 accounts for an overlapping week)
%W 	A numeric representation of the week of the year, starting with the first Monday as the first week
 	46 (for the 46th week of the year beginning with a Monday)

Time and Date Stamps
====================
%c 	Preferred date and time stamp based on local 	Example: Tue Feb 5 00:45:10 2009 for February 4, 2009 at 12:45:10 AM
%D 	Same as "%m/%d/%y" 	Example: 02/05/09 for February 5, 2009
%F 	Same as "%Y-%m-%d" (commonly used in database datestamps) 	Example: 2009-02-05 for February 5, 2009
%s 	Unix Epoch Time timestamp (same as the time() function) 	Example: 305815200 for September 10, 1979 08:40:00 AM
%x 	Preferred date representation based on locale, without the time 	Example: 02/05/09 for February 5, 2009

Miscellaneous
=============
%n 	A newline character ("\n") 	---
%t 	A Tab character ("\t") 	---
%% 	A literal percentage character ("%") 	---

Maximum length of this parameter is 1023 characters.

The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.

Offline

#6 2020-01-15 19:14:06

unklar
Member
Registered: 2015-10-31
Posts: 1,027

Re: [SOLVED] scrot with a differnt "time"

All right..   wink

Offline

#7 2020-01-15 19:45:21

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 5,879

Re: [SOLVED] scrot with a differnt "time"

Instead of:

IF this is my current time:  15-01-2020_163733_S11.jpg

I would like: 15-01-2020_203733_S11.jpg (4 hours ahead)

Hmmmmmmmmmmmmmmmmmm!!!!
I wonder if "faketime" will work with scrot

 15 Jan 20 @ 16:42:19 ~
   $ sho faketime
alias = aptitude show filename
Package: faketime                 
Version: 0.9.6-7+b1
State: not installed
Multi-Arch: foreign
Priority: extra
Section: utils
Maintainer: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Architecture: amd64
Uncompressed Size: 37.9 k
Depends: libfaketime (= 0.9.6-7+b1), libc6 (>= 2.4)
Conflicts: faketime:i386
Provides: faketime:i386 (= 0.9.6-7+b1)
Provided by: faketime:i386 (0.9.6-7+b1)
Description: report faked system time to programs
 The Fake Time Preload Library (FTPL, a.k.a. libfaketime) intercepts various system calls which programs use to
 retrieve the current date and time. It can then report faked dates and times (as specified by you, the user) to
 these programs. This means you can modify the system time a program sees without having to change the time
 system-wide. FTPL allows you to specify both absolute dates (e.g., 2004-01-01) and relative dates (e.g., 10
 days ago).
Homepage: http://www.code-wizards.com/projects/libfaketime/

 15 Jan 20 @ 16:42:26 ~
   $ 

EDIT: Time to test!

Last edited by Sector11 (2020-01-15 19:46:11)


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.

Offline

#8 2020-01-15 20:25:23

damo
....moderator....
Registered: 2015-08-20
Posts: 5,633

Re: [SOLVED] scrot with a differnt "time"

You could export a TZ timezone which is x hrs different, run scrot, then unset it. Like...

export TZ=Asia/Calcutta
date +%F-%k%M%S
unset TZ

Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#9 2020-01-15 21:03:05

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 5,879

Re: [SOLVED] scrot with a differnt "time"

Too complicated ... faketime works like a CHAMP!

time.conky has one command:

TEXT
${alignc}${time %T}

and I start it like this:

faketime -f '+4' conky -c /media/5/Conky/time.conky &

slow to start but scrots are fast and furious!

faketime -f '+4h' scrot '%F_%H%M%S_S11.jpg' -e 'mv $f /media/5/images/ ; mirage /media/5/images/$f'

2020-01-15-215936-S11.jpg
Note the time stamp of the uploaded image.

EDIT: OK time to change that back to normal and create the ones I need.

Last edited by Sector11 (2020-01-15 21:06:39)


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.

Offline

#10 2020-01-15 21:07:53

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,992
Website

Re: [SOLVED] scrot with a differnt "time"

or something like

name="$(date --universal +%d-%m-%y_%H%M%S)"
scrot "$name.png" # ... more here

Online

#11 2020-01-15 22:04:24

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 5,879

Re: [SOLVED] scrot with a differnt "time"

That would be a bash script right?


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.

Offline

#12 2020-01-15 22:26:46

damo
....moderator....
Registered: 2015-08-20
Posts: 5,633

Re: [SOLVED] scrot with a differnt "time"

Sector11 wrote:

That would be a bash script right?

You can run it as a command:

scrot "$(date --universal +%d-%m-%y_%H%M%S)".png

Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#13 2020-01-15 22:41:55

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 5,879

Re: [SOLVED] scrot with a differnt "time"

Cool, so two options  smile

EDIT: and that might be better  using TZ as it will automatically take care of "Daylight savings" time changes.

Last edited by Sector11 (2020-01-15 22:44:59)


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.

Offline

#14 2020-01-16 00:35:46

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 5,879

Re: [SOLVED] scrot with a differnt "time"

OK I need help getting the TZ part of date working.

This works:

 15 Jan 20 @ 21:30:20 ~
   $ TZ=Europe/Berlin date +%d-%m-%Y_%H%M%S
16-01-2020_013023

but cannot get it working with scrot:

this works well:

faketime -f '+4h' scrot -s 'S11_%F_%H%M%S.jpg' -e 'mv $f /media/5/images/ ; mirage /media/5/images/$f'

until a "daylight savings time change", then I'll have to edit it.


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.

Offline

#15 2020-01-16 00:52:17

damo
....moderator....
Registered: 2015-08-20
Posts: 5,633

Re: [SOLVED] scrot with a differnt "time"

This works in a terminal, but as a menu/keybind command I expect you would have to script it:

export TZ=Europe/Berlin
faketime -f '+4h' scrot -s 'S11_%F_%H%M%S.jpg' -e 'mv $f /media/5/images/ ; mirage /media/5/images/$f'
unset TZ

Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

Board footer

Powered by FluxBB