/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
/* Convert time to calendar value */
nSeconds = mktime( &aTime );
/* * mktime expects the struct tm to be in local timezone, so we have to adjust * the returned value to be timezone neutral.
*/
if ( nSeconds != time_t(-1) )
{
time_t bias;
/* timezone corrections */
tzset();
#ifdefined(STRUCT_TM_HAS_GMTOFF) /* members of struct tm are corrected by mktime */
bias = 0 - aTime.tm_gmtoff;
#elifdefined(HAS_ALTZONE) /* check if daylight saving time is in effect */
bias = aTime.tm_isdst > 0 ? altzone : timezone; #else /* expect daylight saving time to be one hour */
bias = aTime.tm_isdst > 0 ? timezone - 3600 : timezone; #endif
// coverity[store_truncates_time_t] - TODO: sal_uInt32 TimeValue::Seconds is only large // enough for integer time_t values < 2^32 representing dates until year 2106:
pTimeVal->Seconds = nSeconds;
pTimeVal->Nanosec = pDateTime->NanoSeconds;
/* Convert atime, which is a local time, to its GMT equivalent. Then, get * the timezone offset for the local time for the GMT equivalent time. Note * that we cannot directly use local time to determine the timezone offset * because GMT is the only reliable time that we can determine timezone * offset from.
*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.