mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 14:15:32 +00:00
Make change tracking in export to latex be independent of timezone
This commit is contained in:
parent
df57b7050b
commit
e04523f77b
@ -400,7 +400,7 @@ int Changes::latexMarkChange(otexstream & os, BufferParams const & bparams,
|
||||
}
|
||||
|
||||
docstring chgTime;
|
||||
chgTime += ctime(&change.changetime);
|
||||
chgTime += asctime(gmtime(&change.changetime));
|
||||
// remove trailing '\n'
|
||||
chgTime.erase(chgTime.end() - 1);
|
||||
|
||||
|
@ -40,7 +40,7 @@ string const formatted_time(time_t t, string const & fmt)
|
||||
}
|
||||
|
||||
|
||||
time_t from_ctime(string t)
|
||||
time_t from_gmtime(string t)
|
||||
{
|
||||
// Example for the format: "Sun Nov 6 10:39:39 2011\n"
|
||||
// Generously remove trailing '\n' (and other whitespace if needed)
|
||||
@ -57,6 +57,7 @@ time_t from_ctime(string t)
|
||||
<< "´ (invalid format)");
|
||||
return static_cast<time_t>(-1);
|
||||
}
|
||||
loc_dt.setTimeSpec(Qt::UTC);
|
||||
return loc_dt.toTime_t();
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ std::string const formatted_time(time_t t, std::string const & fmt);
|
||||
* time zone and daylight saving time are the same as when \p t was created
|
||||
* by ctime().
|
||||
*/
|
||||
time_t from_ctime(std::string t);
|
||||
time_t from_gmtime(std::string t);
|
||||
|
||||
} // namespace support
|
||||
} // namespace lyx
|
||||
|
@ -107,9 +107,9 @@ An environment
|
||||
\end{quote}
|
||||
|
||||
We also support change tracking:
|
||||
\lyxadded{Hans Wurst}{Sun Nov 6 10:39:39 2011}{Added text}
|
||||
\lyxadded{Hans Wurst}{Sun Nov 6 09:39:39 2011}{Added text}
|
||||
some parts remain
|
||||
\lyxdeleted{Hans Wurst}{Sun Nov 6 10:39:55 2011}{This was the original text}
|
||||
\lyxdeleted{Hans Wurst}{Sun Nov 6 09:39:55 2011}{This was the original text}
|
||||
some parts remain
|
||||
|
||||
\section*{A starred section for floats}
|
||||
|
@ -3204,11 +3204,9 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
string localtime = p.getArg('{', '}');
|
||||
preamble.registerAuthor(name);
|
||||
Author const & author = preamble.getAuthor(name);
|
||||
// from_ctime() will fail if LyX decides to output the
|
||||
// time in the text language. It might also use a wrong
|
||||
// time zone (if the original LyX document was exported
|
||||
// with a different time zone).
|
||||
time_t ptime = from_ctime(localtime);
|
||||
// from_gmtime() will fail if LyX decides to output the
|
||||
// time in the text language.
|
||||
time_t ptime = from_gmtime(localtime);
|
||||
if (ptime == static_cast<time_t>(-1)) {
|
||||
cerr << "Warning: Could not parse time `" << localtime
|
||||
<< "´ for change tracking, using current time instead.\n";
|
||||
|
Loading…
Reference in New Issue
Block a user