Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Strange problem here:

Brandon@forge ~/Dropbox/research.local/oil
$ date
Tue, Nov 27, 2012  6:14:23 PM

Brandon@forge ~/Dropbox/research.local/oil
$ cat <<EOF | pdflatex
\documentclass{article}
\begin{document}
\today
\end{document}
EOF

gives me a document whose content reads "November 28, 2012".
Now, I imagine this has something to do with locale or time zone – but why would that be different inside of TeX than at the command line?

Worth mentioning: I'm running Cygwin on Windows 7 and TeX Live 2012.

share|improve this question
2  
What does \currenttime from the datetime package give you? –  Qrrbrbirlbel Nov 28 '12 at 2:46
    
I'm running the same system (Cygwin, Windows 7, TeX Live 2012) and the output is as expected. You're sure you checked texput.pdf? –  Werner Nov 28 '12 at 3:00
3  
I'm not good at these things but it's not possible to have Dropbox server time, is that right? –  percusse Nov 28 '12 at 3:13
1  
datetime picks up the date and time from the TeX count registers \year, \month, \day and \time. TeX sets these at the start of the tex/latex run. I assume it gets the information from the operating system it's running on. What do get if you use \pdfcreationdate ? –  Nicola Talbot Dec 2 '12 at 18:36
1  
Sorry, haven't asked you yet: what if you run pdflatex from cmd instead of through bash? Or unset TZ in bash and run from bash? –  cyberSingularity Dec 17 '12 at 22:28
show 9 more comments

1 Answer

up vote 5 down vote accepted
+50

As soon as you mentioned the TZ environment variable, it seemed like the likely culprit, especially as you are running the Windows version of TeX Live rather than the cygwin version (which is a perfectly reasonable thing to do, so hopefully this is the only issue it causes). I believe Windows and cygwin have different interpretations of that variable, and when running Windows binaries from cygwin sessions, the cygwin environment is inherited. Presumably outside of cygwin on your system, the TZ variable is not set.

So, to ensure the time is correctly interpreted, you need to unset the TZ variable before using native Windows binaries such as the TeX Live binaries. To avoid globally unsetting the variable (which surely serves other needed purposes in cygwin), perhaps consider the use of bash aliases, eg alias pdflatex="TZ= pdflatex".


To attempt to answer your latter question from the comment about which TZ value to use in cygwin, the official time zone database has the following text before the America/Los Angeles entry:

# US Pacific time, represented by Los Angeles
#
# California, northern Idaho (Benewah, Bonner, Boundary, Clearwater,
# Idaho, Kootenai, Latah, Lewis, Nez Perce, and Shoshone counties,
# and the northern three-quarters of Idaho county),
# most of Nevada, most of Oregon, and Washington
share|improve this answer
    
Thanks for the discussion and the solution. I added an 'unset TZ' into my workflow. –  Brandon Kuczenski Dec 17 '12 at 23:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.