Bug 478802 - RFE: Add Epoch Time Format
Summary: RFE: Add Epoch Time Format
Status: RESOLVED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: Noah Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-20 22:33 UTC by NecRaul
Modified: 2024-01-15 11:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description NecRaul 2023-12-20 22:33:16 UTC
Similar screenshotting utilities like ShareX have this feature.

I am not a C++ developer so I'm unsure whether or not this is correct but I checked out the source code to the best of my ability and it seemed like only one file (change_placeholder_format.cpp) would need to be updated in order to add this functionality. I tried to do it myself but setting up the development environment for a minuscule change that I'm unsure whether or not I can even make and even if I do, may not get merged seemed like too much of a commitment.
Comment 1 Noah Davis 2023-12-20 23:14:34 UTC
The amount of effort required isn't the main issue for adding a feature. The main issue is determining the validity or importance of a feature's use case and how it would affect the user interface.

I assume you want the epoch time format in automatically generated filenames, but you didn't explicitly say that. What does "epoch time format" mean to you? Obviously it's the amount of time since the Unix epoch, but do you want it in seconds or some other unit of time?

Why do you want the epoch time format? It doesn't need to be a grandiose reason and you don't need to write an essay for this feature request to be accepted, I just need to understand you.
Comment 2 Noah Davis 2023-12-20 23:16:04 UTC
If you're curious and you do want the epoch time format in filenames, the class to look at would be ExportManager (.h/.cpp).
Comment 3 NecRaul 2023-12-21 07:51:07 UTC
(In reply to Noah Davis from comment #1)
> The amount of effort required isn't the main issue for adding a feature. The
> main issue is determining the validity or importance of a feature's use case
> and how it would affect the user interface.
> 
> I assume you want the epoch time format in automatically generated
> filenames, but you didn't explicitly say that. What does "epoch time format"
> mean to you? Obviously it's the amount of time since the Unix epoch, but do
> you want it in seconds or some other unit of time?
> 
> Why do you want the epoch time format? It doesn't need to be a grandiose
> reason and you don't need to write an essay for this feature request to be
> accepted, I just need to understand you.

The reason has mainly to do with how date format is used in different countries, US and couple other countries (generally) use mm-dd-yy while most of the world uses dd-mm-yy. Using both approach would eventually result in discrepancies when sorting screenshots by name: In the first case, 01-31-23 would come later than 01-01-24, while in the second case 25-06-23 would come later than 21-09-23. Even with these discrepancies, using a subfolder with month and year as its name is a viable approach. Using epoch time in the filename would result in no discrepancies even without  a subfolder. By discrepancies, I mean although the screenshot A is taken later than screenshot B, it's shown earlier etc.

(In reply to Noah Davis from comment #2)
> If you're curious and you do want the epoch time format in filenames, the
> class to look at would be ExportManager (.h/.cpp).

Thanks for the information, I'll try to look into it and test it for myself, if I manage to set up an environment for it.

Also, I'm sorry if this was the wrong place to ask for a feature. I noticed the "Requests" section, after having made the bug report.
Comment 4 Noah Davis 2023-12-21 15:28:12 UTC
Wouldn't ISO date format (https://en.wikipedia.org/wiki/ISO_8601) do the same as epoch time format for you? When sorted by name, a series of similarly named files with ISO dates in the name would be sorted by year, then month, day, hour, minute, second and finally timezone (if used). Is there another reason why you prefer epoch time format?
Comment 5 Noah Davis 2023-12-21 15:31:22 UTC
> Also, I'm sorry if this was the wrong place to ask for a feature. I noticed the "Requests" section, after having made the bug report.

Don't worry about it. I'm not even sure what section you're talking about. Just use "NOR wishlist" as the importance like you already did. Of course, I have the permissions necessary to change the importance even if you forgot to do that.
Comment 6 Nate Graham 2023-12-21 16:52:19 UTC
> Using epoch time in the filename would result in no discrepancies
But what *is* "epoch time"? Can you describe what it is, or give an example of a filename formatted to use it?
Comment 7 NecRaul 2023-12-21 17:07:27 UTC
(In reply to Noah Davis from comment #4)
> Wouldn't ISO date format (https://en.wikipedia.org/wiki/ISO_8601) do the
> same as epoch time format for you? When sorted by name, a series of
> similarly named files with ISO dates in the name would be sorted by year,
> then month, day, hour, minute, second and finally timezone (if used). Is
> there another reason why you prefer epoch time format?

I'm already using something akin to ISO format (%Y-%M-%D-%H-%m-%S) for my filenames. Aside from personal preference and the ones I mentioned earlier, another one (or last one) would be most imageboard cdn's use epoch time to store/name images at the time of their upload. Obviously this has little importance on the actual development of Spectacle, but it's nice to have all of your images (of the same topic) in the same folder with same/similar formats.

(In reply to Nate Graham from comment #6)
> > Using epoch time in the filename would result in no discrepancies
> But what *is* "epoch time"? Can you describe what it is, or give an example
> of a filename formatted to use it?

Sorry if I wasn't descriptive enough, I meant adding a new placeholder like %u/%U in addition to the ones Spectacle already has. The filename with only this placeholder would end up looking like like 1703178285.png.
Comment 8 Noah Davis 2023-12-21 21:08:59 UTC
> Aside from personal preference and the ones I mentioned earlier, another one (or last one) would be most imageboard cdn's use epoch time to store/name images at the time of their upload. Obviously this has little importance on the actual development of Spectacle, but it's nice to have all of your images (of the same topic) in the same folder with same/similar formats.

I think that's a good enough reason.

> Sorry if I wasn't descriptive enough, I meant adding a new placeholder like %u/%U in addition to the ones Spectacle already has. The filename with only this placeholder would end up looking like like 1703178285.png.

It looks like you want the time since the Unix epoch in seconds. At the time of copying, the time since the epoch in seconds was "1703192800", which is similar to your number.
Comment 9 Bug Janitor Service 2023-12-26 23:41:44 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/spectacle/-/merge_requests/310
Comment 10 Noah Davis 2024-01-15 11:33:53 UTC
Git commit 2ec6a2d4dccaaf02eb2992050e24289d20951247 by Noah Davis.
Committed on 15/01/2024 at 12:32.
Pushed by ndavis into branch 'master'.

Add <UnixTime> filename placeholder

M  +2    -0    src/ExportManager.cpp
M  +1    -0    tests/FilenameTest.cpp

https://invent.kde.org/graphics/spectacle/-/commit/2ec6a2d4dccaaf02eb2992050e24289d20951247