[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Re: EPrints 3.3.13 TimeStamp Question



Hi,

We are running an EPrints 3.3.12.

We had the same problem. I found the patch at 
https://github.com/eprints/eprints/issues/194
But as said in the last comment, it doesn't work well with old years. It 
converted 1927 to 2027 for example.

Here is my workaround (in perl_lib/EPrints/Time.pm, in _render_date, 
around line 422)


         if( @l == 0 )
         {
                 return $session->html_phrase( 
"lib/utils:date_unspecified" );
         }

         #### MODIF GF
         # print STDERR "TIME: $datevalue\n";
         # print STDERR "TIME: ( @l )\n";

         # Convert UTC to local time zone, trim result to original 
resolution:
         # From https://github.com/eprints/eprints/issues/194
         # @l = @{[ local_datetime(datetime_utc(@l)) ]}[0..$#l]; ===> 
pb. convertit 1927 en 2027 !!! :-(
         #
         # Version GF via Perl monks
         # Si on n'a pas l'heure, on ne cherche pas ? convertir en heure 
locale...
         if (@l > 3) {
           my( $year, $month, $day, $hour, $min, $sec ) = @l;
           my $precision = $#l;

           #  proto: $time = timegm($sec,$min,$hour,$mday,$mon,$year);
           $month = $month-1 if defined $month;
           my $epoch = 
Time::Local::timegm($sec,$min,$hour,$day,$month,$year);

           #  proto: ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
           #          localtime(time);
           my ($lyear,$lmonth,$lday,$lhour,$isdst) = 
(localtime($epoch))[5,4,3,2,-1];

           $lyear += 1900;  # year is 1900 based
           $lmonth++;       # month number is zero based
           @l = ( $lyear, $lmonth, $lday, $lhour, $min, $sec 
)[0..$precision];
         }
         # print STDERR "TIMELOC: ( @l )\n";
         #### FIN MODIF GF

         my( $year, $mon, $day, $hour, $min, $sec ) = @l;


Please excuse the comments in french...

Hope this helps.

Best regards,
GF

Le 19/08/2015 18:53, Greg Whitney a ?crit :
> Hello,
>
> We have gone live with EPrints 3.3.13. One little detail that escaped 
> us during testing is that the EPrints TimeStamp doesn't appear to 
> default to our Montreal, Canada time-zone, even though the server date 
> & time are correct (Linux).
>
>
> Last Modified 
> <https://publications.polymtl.ca/cgi/users/home?screen=Items&_buffer_offset=0&_buffer_order=lastmod> 
> 	Down 
> <https://publications.polymtl.ca/cgi/users/home?screen=Items&_buffer_offset=0&_buffer_order=lastmod> 
>
>
> 	
> Title 
> <https://publications.polymtl.ca/cgi/users/home?screen=Items&_buffer_offset=0&_buffer_order=title> 
>
>
> 	
> Creators 
> <https://publications.polymtl.ca/cgi/users/home?screen=Items&_buffer_offset=0&_buffer_order=creators_name> 
>
>
> 	
> Item Type 
> <https://publications.polymtl.ca/cgi/users/home?screen=Items&_buffer_offset=0&_buffer_order=type> 
>
>
> 	
> Item Status 
> <https://publications.polymtl.ca/cgi/users/home?screen=Items&_buffer_offset=0&_buffer_order=eprint_status> 
>
>
> 	
> Comments and Suggestions 
> <https://publications.polymtl.ca/cgi/users/home?screen=Items&_buffer_offset=0&_buffer_order=suggestions> 
>
>
> 	
> Status 
> <https://publications.polymtl.ca/cgi/users/home?screen=Items&_buffer_offset=0&_buffer_order=ispublished> 
>
>
> 	
> Dissertation/thesis director 
> <https://publications.polymtl.ca/cgi/users/home?screen=Items&_buffer_offset=0&_buffer_order=director_thesis> 
>
>
> 	
> Date Deposited 
> <https://publications.polymtl.ca/cgi/users/home?screen=Items&_buffer_offset=0&_buffer_order=-datestamp> 
>
>
> 	
> 05 Aug 2015 19:02 	A Configurable Multi-Rail Power and I/O Pad Applied 
> to Wafer-Scale Systems 	Laflamme-Mayer, Nicolas, Blaqui?re, Yves, 
> Savaria, Yvon and Sawan, Mohamad 	Article 	User Workarea 	
> Unspecified
> 	Published 	Unspecified 	Unspecified 	
>
>   * View Item
>     <https://publications.polymtl.ca/cgi/users/home?screen=EPrint%3A%3AView&eprintid=1674>
>   * Remove item
>     <https://publications.polymtl.ca/cgi/users/home?screen=EPrint%3A%3ARemove&eprintid=1674>
>   * Edit item
>     <https://publications.polymtl.ca/cgi/users/home?screen=EPrint%3A%3AEdit&eprintid=1674>
>   * Deposit item
>     <https://publications.polymtl.ca/cgi/users/home?screen=EPrint%3A%3ADeposit&eprintid=1674>
>
> 19 Aug 2015 15:14 	Test pour EPrints 3.3.13 	Whitney, Greg 
> Dissertation or Thesis 	User Workarea 	
> OK
> 	Published 	Robin Sylvestre 	05 Aug 2015 17:33 	
>
>   * View Item
>     <https://publications.polymtl.ca/cgi/users/home?screen=EPrint%3A%3AView&eprintid=1771>
>   * Remove item
>     <https://publications.polymtl.ca/cgi/users/home?screen=EPrint%3A%3ARemove&eprintid=1771>
>   * Edit item
>     <https://publications.polymtl.ca/cgi/users/home?screen=EPrint%3A%3AEdit&eprintid=1771>
>   * Deposit item
>     <https://publications.polymtl.ca/cgi/users/home?screen=EPrint%3A%3ADeposit&eprintid=1771>
>
> 	
> 	
>
> 	
> 		
>
> 	
> 		
>
> 	
> 		
>
> 	
> 		
>
> 	
> 		
>
> 	
> 		
>
> 	
> 		
>
> 	
> 		
>
> The Last Modified & Date Deposited times are 4 HOURS LATER than our 
> Montreal time-zone. Does anyone know why & how to correct this?? There 
> doesn't appear to be anything in the EPrints GUI Admin for this.
> Thanks!
> Greg Whitney
> Polytechnique Montreal Library
>
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: http://www.eprints.org/tech.php/
> *** EPrints community wiki: http://wiki.eprints.org/
> *** EPrints developers Forum: http://forum.eprints.org/