Sets the timezone of the entire track

        Args:
            timezone (int): Timezone hour delta
170020
def timezone(self, timezone=0):
        
        tz_dt = timedelta(hours=timezone)
        for segment in self.segments:
            for point in segment.points:
                point.time = point.time + tz_dt
        return self
270655
def _build_date_time_time_zone(self, date_time):
        
        timezone = date_time.tzinfo.zone if date_time.tzinfo is not None else None
        return {
            self._cc('dateTime'): date_time.strftime('%Y-%m-%dT%H:%M:%S'),
            self._cc('timeZone'): get_windows_tz(timezone or self.protocol.timezone)
        }
199401
protected function setDefaultTimezone()
    {
        $timezone = 'UTC';
        if (is_link('/etc/localtime')) {
            // Mac OS X (and older Linuxes)
            // /etc/localtime is a symlink to the timezone in /usr/share/zoneinfo.
            $filename = readlink('/etc/localtime');
            if (strpos($filename, '/usr/share/zoneinfo/') === 0) {
                $timezone = substr($filename, 20);
            }
        } elseif (file_exists('/etc/timezone')) {
            // Ubuntu / Debian.
            $data = file_get_contents('/etc/timezone');
            if ($data) {
                $timezone = trim($data);
            }
        } elseif (file_exists('/etc/sysconfig/clock')) {
            // RHEL/CentOS
            $data = parse_ini_file('/etc/sysconfig/clock');
            if (!empty($data['ZONE'])) {
                $timezone = trim($data['ZONE']);
            }
        }
        date_default_timezone_set($timezone);
    }
1182966
def utc_offset_by_timezone(timezone_name):
    
    return int(pytz.timezone(timezone_name).utcoffset(
        utc_time()).total_seconds()/SECONDS_IN_HOUR)
366685
public static function setTimeZone($timezone) {
		if (self::_validateTimezone($timezone)) {
			self::$_timezone = $timezone;
			return TRUE;
		}
		return FALSE;
	}
915148
public function setTimezone($timezone)
    {
        $smt = $this->getConnection()->prepare('SET time_zone = ?');
        $smt->bindValue(1, $timezone);
        $smt->execute();
    }
538532
def set_timestamp(self,timestamp=None):
        
        if timestamp is None:
            import time
            timestamp = time.strftime('%Y-%m-%dT%H:%M:%S%Z')
        self.node.set('timestamp',timestamp)
470128
def timezone(self):
        
        if self._tz is None:
            # GET CENTROID FROM GSSHA GRID
            cen_lat, cen_lon = self.centerLatLon()
            # update time zone
            tf = TimezoneFinder()
            tz_name = tf.timezone_at(lng=cen_lon, lat=cen_lat)

            self._tz = timezone(tz_name)
        return self._tz
205241
def _to_timezone(self, dt):
        """"""
        tz = self._get_tz()
        utc_dt = pytz.utc.localize(dt)
        return utc_dt.astimezone(tz)
549855
public void setLocale(TimeZone timeZone, Locale locale){
        compactCalendarController.setLocale(timeZone, locale);
        invalidate();
    }
173986
function setTimezone (timezone, relative) {
  debug('Date#setTimezone(%s, %s)', timezone, relative);

  // If `true` is passed in as the second argument, then the Date instance
  // will have it's timezone set, but it's current local values will remain
  // the same (i.e. the Date's internal time value will be changed)
  var ms, s, m, h, d, mo, y
  if (relative) {
    y  = this.getFullYear()
    mo = this.getMonth()
    d  = this.getDate()
    h  = this.getHours()
    m  = this.getMinutes()
    s  = this.getSeconds()
    ms = this.getMilliseconds()
  }

  // If the current process timezone doesn't match the desired timezone, then call
  // tzset() to change the current timezone of the process.
  var oldTz = exports.currentTimezone
    , tz = exports._currentZoneinfo;
  if (!tz || oldTz !== timezone) {
    debug('current timezone is not "%s", calling tzset()', timezone);
    tz = exports.tzset(timezone);
  }

  // Get the zoneinfo for this Date instance's time value
  var zoneInfo = exports.localtime(this.getTime() / 1000);

  // Change the timezone back if we changed it originally
  if (oldTz != timezone) {
    debug('setting timezone back to "%s"', oldTz);
    exports.tzset(oldTz);
  }
  oldTz = null;

  // If we got to here without throwing an Error, then
  // a valid timezone was requested, and we should have
  // a valid zoneInfo Object.
  this.getTimezone = function getTimezone() {
    return timezone;
  }

  // Returns the day of the month (1-31) for the specified date according to local time.
  this.getDate = function getDate() {
    return zoneInfo.dayOfMonth;
  }
  // Returns the day of the week (0-6) for the specified date according to local time.
  this.getDay = function getDay() {
    return zoneInfo.dayOfWeek;
  }
  // Deprecated. Returns the year (usually 2-3 digits) in the specified date according
  // to local time. Use `getFullYear()` instead.
  this.getYear = function getYear() {
    return zoneInfo.year;
  }
  // Returns the year (4 digits for 4-digit years) of the specified date according to local time.
  this.getFullYear = function getFullYear() {
    return zoneInfo.year + 1900;
  }
  // Returns the hour (0-23) in the specified date according to local time.
  this.getHours = function getHours() {
    return zoneInfo.hours;
  }
  // Returns the minutes (0-59) in the specified date according to local time.
  this.getMinutes = function getMinutes() {
    return zoneInfo.minutes;
  }
  // Returns the month (0-11) in the specified date according to local time.
  this.getMonth = function getMonth() {
    return zoneInfo.month;
  }
  // Returns the seconds (0-59) in the specified date according to local time.
  this.getSeconds = function getSeconds() {
    return zoneInfo.seconds;
  }
  // Returns the timezone offset from GMT the Date instance currently is in,
  // in minutes. Also, left of GMT is positive, right of GMT is negative.
  this.getTimezoneOffset = function getTimezoneOffset() {
    return -zoneInfo.gmtOffset / 60;
  }
  // NON-STANDARD: Returns the abbreviation (e.g. EST, EDT) for the specified time zone.
  this.getTimezoneAbbr = function getTimezoneAbbr() {
    return tz.tzname[zoneInfo.isDaylightSavings ? 1 : 0];
  }

  // Sets day, month and year at once
  this.setAllDateFields = function setAllDateFields(y,mo,d) {
    return this.setFullYear(y,mo,d);
  }
  // Sets the day of the month (from 1-31) in the current timezone
  this.setDate = function setDate(d) {
    zoneInfo.dayOfMonth = d;
    return mktime.call(this);
  }
  // Sets the year (four digits) in the current timezone
  this.setFullYear = function setFullYear(y,mo,d) {
    zoneInfo.year = y - 1900;
    if(arguments.length > 1)
      zoneInfo.month = mo;
    if(arguments.length > 2)
      zoneInfo.dayOfMonth = d;
    return mktime.call(this);
  }
  // Sets the hour (from 0-23) in the current timezone
  this.setHours = function setHours(h,m,s,ms) {
    zoneInfo.hours = h;
    if(arguments.length > 1)
      zoneInfo.minutes = m;
    if(arguments.length > 2)
      zoneInfo.seconds = s;
    if(arguments.length > 3) {
      mktime.call(this);
      var diff = ms - this.getMilliseconds();
      return this.setTime(this.getTime() + diff);
    } else
      return mktime.call(this);
  }
  // Sets the milliseconds (from 0-999) in the current timezone
  this.setMilliseconds = function setMilliseconds(ms) {
    var diff = ms - this.getMilliseconds();
    return this.setTime(this.getTime() + diff);
  }
  // Set the minutes (from 0-59) in the current timezone
  this.setMinutes = function setMinutes(m,s,ms) {
    zoneInfo.minutes = m;
    if(arguments.length > 1)
      zoneInfo.seconds = s;
    if(arguments.length > 2) {
      mktime.call(this);
      var diff = ms - this.getMilliseconds();
      return this.setTime(this.getTime() + diff);
    } else
      return mktime.call(this);
  }
  // Sets the month (from 0-11) in the current timezone
  this.setMonth = function setMonth(mo,d) {
    zoneInfo.month = mo;
    if(arguments.length > 1)
      zoneInfo.dayOfMonth = d;
    return mktime.call(this);
  }
  // Sets the seconds (from 0-59) in the current timezone
  this.setSeconds = function setSeconds(s,ms) {
    zoneInfo.seconds = s;
    if(arguments.length > 1) {
      mktime.call(this);
      var diff = ms - this.getMilliseconds();
      return this.setTime(this.getTime() + diff);
    } else
      return mktime.call(this);
  }
  // Sets a date and time by adding or subtracting a specified number of
  // milliseconds to/from midnight January 1, 1970.
  this.setTime = function setTime(v) {
    var rtn = _Date.prototype.setTime.call(this, v);
    // Since this function changes the internal UTC epoch date value, we need to
    // re-setup these timezone translation functions to reflect the new value
    reset.call(this);
    return rtn;
  }
  // Sets the day of the month, according to universal time (from 1-31)
  this.setUTCDate = function setUTCDate(d) {
    var rtn = _Date.prototype.setUTCDate.call(this, d);
    reset.call(this);
    return rtn;
  }
  // Sets the year, according to universal time (four digits)
  this.setUTCFullYear = function setUTCFullYear(y,mo,d) {
    var rtn;
    switch(arguments.length) {
      case 1:
        rtn = _Date.prototype.setUTCFullYear.call(this, y); break;
      case 2:
        rtn = _Date.prototype.setUTCFullYear.call(this, y,mo); break;
      case 3:
        rtn = _Date.prototype.setUTCFullYear.call(this, y,mo,d); break;
    }
    reset.call(this);
    return rtn;
  }
  // Sets the hour, according to universal time (from 0-23)
  this.setUTCHours = function setUTCHours(h,m,s,ms) {
    var rtn;
    switch(arguments.length) {
      case 1:
        rtn = _Date.prototype.setUTCHours.call(this, h); break;
      case 2:
        rtn = _Date.prototype.setUTCHours.call(this, h,m); break;
      case 3:
        rtn = _Date.prototype.setUTCHours.call(this, h,m,s); break;
      case 4:
        rtn = _Date.prototype.setUTCHours.call(this, h,m,s,ms); break;
    }
    reset.call(this);
    return rtn;
  }
  // Sets the milliseconds, according to universal time (from 0-999)
  this.setUTCMilliseconds = function setUTCMillseconds(ms) {
    var rtn = _Date.prototype.setUTCMilliseconds.call(this, ms);
    reset.call(this);
    return rtn;
  }
  // Set the minutes, according to universal time (from 0-59)
  this.setUTCMinutes = function setUTCMinutes(m,s,ms) {
    var rtn;
    switch(arguments.length) {
      case 1:
        rtn = _Date.prototype.setUTCMinutes.call(this, m); break;
      case 2:
        rtn = _Date.prototype.setUTCMinutes.call(this, m,s); break;
      case 3:
        rtn = _Date.prototype.setUTCMinutes.call(this, m,s,ms); break;
    }
    reset.call(this);
    return rtn;
  }
  // Sets the month, according to universal time (from 0-11)
  this.setUTCMonth = function setUTCMonth(mo,d) {
    var rtn;
    switch(arguments.length) {
      case 1:
        rtn = _Date.prototype.setUTCMonth.call(this, mo); break;
      case 2:
        rtn = _Date.prototype.setUTCMonth.call(this, mo,d); break;
    }
    reset.call(this);
    return rtn;
  }
  // Set the seconds, according to universal time (from 0-59)
  this.setUTCSeconds = function setUTCSeconds(s,ms) {
    var rtn;
    switch(arguments.length) {
      case 1:
        rtn = _Date.prototype.setUTCSeconds.call(this, s); break;
      case 2:
        rtn = _Date.prototype.setUTCSeconds.call(this, s,ms); break;
    }
    reset.call(this);
    return rtn;
  }

  this.toDateString = function toDateString() {
    return DAYS_OF_WEEK[this.getDay()].substring(0, 3) + ' ' + MONTHS[this.getMonth()].substring(0, 3) + ' ' + pad(this.getDate(), 2) + ' ' + this.getFullYear();
  }

  this.toTimeString = function toTimeString() {
    var offset = Math.abs(zoneInfo.gmtOffset / 60); // total minutes
    // split into HHMM:
    var hours = pad(Math.floor(offset / 60), 2);
    var minutes = pad(offset % 60, 2);
    return this.toLocaleTimeString() + ' GMT' + (zoneInfo.gmtOffset >= 0 ? '+' : '-') + hours + minutes
      + ' (' + tz.tzname[zoneInfo.isDaylightSavings ? 1 : 0] + ')';
  }

  this.toString = function toString() {
    return this.toDateString() + ' ' + this.toTimeString();
  }

  this.toLocaleDateString = function toLocaleDateString() {
    return DAYS_OF_WEEK[this.getDay()] + ', ' + MONTHS[this.getMonth()] + ' ' + pad(this.getDate(), 2) + ', ' + this.getFullYear();
  }

  this.toLocaleTimeString = function toLocaleTimeString() {
    return pad(this.getHours(), 2) + ':' + pad(this.getMinutes(), 2) + ':' + pad(this.getSeconds(), 2);
  }

  this.toLocaleString = this.toString;

  if (relative) {
    this.setAllDateFields(y,mo,d)
    this.setHours(h)
    this.setMinutes(m)
    this.setSeconds(s)
    this.setMilliseconds(ms)
    ms = s = m = h = d = mo = y = null
  }


  // Used internally by the 'set*' functions above...
  function reset () {
    this.setTimezone(this.getTimezone());
  }
  // 'mktime' calls 'reset' implicitly through 'setTime()'
  function mktime () {
    var oldTz = process.env.TZ;
    exports.tzset(this.getTimezone());
    zoneInfo.isDaylightSavings = -1; // Auto-detect the timezone
    var t = exports.mktime(zoneInfo);
    if (oldTz) {
      exports.tzset(oldTz);
      oldTz = null;
    }
    return this.setTime( (t * MILLIS_PER_SECOND) + this.getMilliseconds() );
  }

  return this;
}
1066669
def _get_tz(tz):
    
    zone = timezones.get_timezone(tz)
    if zone is None:
        zone = tz.utcoffset().total_seconds()
    return zone
734273
def set_timezone(self, request, org):
        """"""
        if org and org.timezone:
            timezone.activate(org.timezone)
687297
def set_beginTimestamp(self,btimestamp=None):
        
        if btimestamp is None:
            import time
            btimestamp = time.strftime('%Y-%m-%dT%H:%M:%S%Z')
        self.node.set('beginTimestamp',btimestamp)
563980
def tz(self):
        """"""

        if self.timezone is None:
            return None

        try:
            tz = pytz.timezone(self.timezone)
            return tz
        except pytz.UnknownTimeZoneError:
            raise AstralError("Unknown timezone '%s'" % self.timezone)
1001158
def add_timezone(value, tz=None):
    
    tz = tz or timezone.get_current_timezone()
    try:
        if timezone.is_naive(value):
            return timezone.make_aware(value, tz)
    except AttributeError:  # 'datetime.date' object has no attribute 'tzinfo'
        dt = datetime.datetime.combine(value, datetime.time())
        return timezone.make_aware(dt, tz)
    return value
1010623
def convert_timezone(obj, timezone):
    
    if timezone is None:
        return obj.replace(tzinfo=None)
    return pytz.timezone(timezone).localize(obj)