Page 1 of 1

Linux: Timestamp century error

Posted: Thu Mar 27, 2014 8:27 am
by CameronD
This is just a warning about a current bug/misfeature in v 0.64 that I noticed when I was trying to enter correct dates into scans of old photos.
It requires a fairly rare set of circumstances:
  • I have replicated under Linux and Windows 7.
  • a date format is set to display 2 digits of years
  • in XnViewMP go to tools->change timestamp, select specify date/time
  • in the date box just select and delete the existing value and type in your new date, using the same format.
Say the existing value was 27-Mar-14. Change the "14" to "94" and you will get a new date of 2094, rather than 1994. This is a bit dangerous, because in many places it only shows the two-digit form, so it can still look OK.

The code seems to simply use whatever century was in the previous entry.
You cannot type a 4-digit year if the format specifies a 2-digit display.
It will accept a date for files that is not representable in the filesystem on which the image resides.

The workaround is to either
  1. use the drop-down box to show the calendar gui tool, (you can select and type directly into the year spin-box) and/or
  2. change your short-date format to display 4 digits (Windows only - I can't find how to make the Linux version use a different format)

Re: timestamp century error

Posted: Thu Mar 27, 2014 12:41 pm
by xnview
I have 4 digit for year not 2

Re: timestamp century error

Posted: Thu Mar 27, 2014 2:11 pm
by CameronD
xnview wrote:I have 4 digit for year not 2
Do you know how to change it in the Linux version? I have looked for config files but cannot see any.
I presume it is a QT library function that you are using. It is displaying US-style dates m/d/yy in most places, except the ExifTool output tab.

Re: timestamp century error

Posted: Thu Mar 27, 2014 2:33 pm
by xnview
I think that Qt use current locale on linux

QT

Posted: Fri Mar 28, 2014 10:27 am
by CameronD
xnview wrote:I think that Qt use current locale on linux
Where's the smiley for my head repeatedly contacting the brick wall!?
I think QT on linux has some whacky ideas of its own about what to do with dates.

I have messed about with en_AU and made my own custom mods to d_fmt within LC_TIME.
I changed from %d/%m/%y to %d-%m-%Y

The command:

Code: Select all

> locale LC_TIME
shows my changes.
The command:

Code: Select all

> date +%x
prints the date in the new format, as it should.
but XnView still behaves as before, using %d/%m/%y.

With system default as en_AU.UTF-8, I change the language in xnview.ini to de or fr but I still get dates in the same format: %d/%m/%y

I tried a different set of tests, setting language in xnview.ini to auto (blank) and edit the desktop's calling script: xnview.sh by adding:

Code: Select all

export LANG=xx_YY.UTF-8
results for the following values of xx_YY are:
  • en_US, en_CA : %m/%d/%y
  • en_GB : %d/%m/%Y
  • en_AU : %d/%m/%y
  • fr_FR : %d/%m/%y
  • fr_CA : %y-%m-%d
  • de_DE : %d.%m.%y
Somebody has reported a similar problem here with somebody replying that QT does not even look at LC_TIME.
This does not seem to be quite true. I can alter xnview.sh to say

Code: Select all

export LANG=de_DE.UTF-8
export LC_TIME=en_GB.UTF-8
and I get german words with GB date format.
So editing xnview.sh to include LC_TIME=en_GB.UTF-8 is the only way I can find to get a 4-digit year.

It seems QT under Linux looks at the locale, but then uses its own inbuilt rules for formatting.

Re: timestamp century error

Posted: Fri Mar 28, 2014 1:21 pm
by m.Th.
Where's the smiley for my head repeatedly contacting the brick wall!?
Here you are:

Image

Expressive?

Re: timestamp century error

Posted: Fri Mar 28, 2014 2:38 pm
by CameronD
m.Th. wrote:Expressive?
Thank you - fits the mood perfectly!

Re: timestamp century error

Posted: Fri Mar 28, 2014 5:27 pm
by m.Th.
CameronD wrote:
m.Th. wrote:Expressive?
Thank you - fits the mood perfectly!
Glad that I could help! :)