get the timestamp at current dat start

NOTE: the result start at the timezone (GTM +8) 00:00:00, not the GTM 0.

@param
{number} offset, offset of timezone;
@return number
183454
public static function getDayTimestamp($now = null, $offset = 8) {
        $now = $now === null ? time() : $now;
        
        $gtm0 = $now - ($now % 86400); // GTM 0
        
        $dayline = ($now - $gtm0) / 3600;
        
        // 时差跨天
        if ($dayline + $offset > 23) {
            return $gtm0 + 86400 + $offset * 3600 * - 1;
        } else {
            return $gtm0 + $offset * 3600 * - 1;
        }
    }
389594
function GMTDate() { /*Get Date o GMT*/
	var now = new Date(); 
	var currentDate = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(),  now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds(),now.getUTCMilliseconds());
	return currentDate;
}
807697
def get_timestamp(dt=None):
    '''
    
    '''

    if dt is None: dt = datetime.datetime.utcnow()
    t = dt.utctimetuple()

    return calendar.timegm(t)
1045858
public function utcOffset(int $offset = null)
    {
        if (func_num_args() < 1) {
            return $this->offsetMinutes;
        }

        return $this->setTimezone(static::safeCreateDateTimeZone($offset / static::MINUTES_PER_HOUR));
    }
512258
function getCLFOffset(date) {
	const offset	= date.getTimezoneOffset().toString();
	const op		= offset[0] === '-' ? '-' : '+';
	let number		= offset.replace(op, '');

	while (number.length < 4) {
		number = `0${number}`;
	}

	return `${op}${number}`;
}
953166
def start_time(self):
        

        timestamp = self.abs_time / 10 ** 9
        if self.time_flags & v4c.FLAG_HD_LOCAL_TIME:
            timestamp = datetime.fromtimestamp(timestamp)
        else:
            timestamp = datetime.fromtimestamp(timestamp, timezone.utc)

        return timestamp
1172166
function getTime(ts) {
		function pad2(n) {
			return n < 10 ? '0' + n : n;
		}

		function pad3(n) {
			return n < 10 ? '00' + n : (n < 100 ? '0' + n : n);
		}

		return pad2(ts.getHours()) + ':' +
			pad2(ts.getMinutes()) + ':' +
			pad2(ts.getSeconds()) + '.' +
			pad3(ts.getMilliseconds());
	}
784020
function tsToObj(ts, offset) {
  ts += offset * 60 * 1000;

  const d = new Date(ts);

  return {
    year: d.getUTCFullYear(),
    month: d.getUTCMonth() + 1,
    day: d.getUTCDate(),
    hour: d.getUTCHours(),
    minute: d.getUTCMinutes(),
    second: d.getUTCSeconds(),
    millisecond: d.getUTCMilliseconds()
  };
}
365018
protected long computeOffset(final long t, final DateTimeZone tz)
  {
    // start is the beginning of the last period ending within dataInterval
    long start = dataInterval.getEndMillis() - periodMillis;
    long startOffset = start % periodMillis - originMillis % periodMillis;
    if (startOffset < 0) {
      startOffset += periodMillis;
    }

    start -= startOffset;

    // tOffset is the offset time t within the last period
    long tOffset = t % periodMillis - originMillis % periodMillis;
    if (tOffset < 0) {
      tOffset += periodMillis;
    }
    tOffset += start;
    return tOffset - t - (tz.getOffset(tOffset) - tz.getOffset(t));
  }
37478
public function offsetDatetime($time = null, $offset = 0)
    {
        if ($this->timeFormat === static::$timeFormatDatetime) {
            return date('Y-m-d H:i:s', strtotime(($offset >= 0 ? "+$offset" : $offset) . " seconds", is_string($time) ? strtotime($time) : (is_int($time) ? $time : time())));
        }
        if ($this->timeFormat === static::$timeFormatTimestamp) {
            return (is_int($time) ? $time : time()) + $offset;
        }
        return null;
    }
144763
function (tp_inst, date) {
		if (tp_inst && tp_inst.timezone_select) {
			var now = date || new Date();
			tp_inst.timezone_select.val(-now.getTimezoneOffset());
		}
	}
578510
function(offset) {

			var monthNum = this.month
			offset = offset || 0
			monthNum += offset

			if(monthNum < 0) { monthNum = 11 }
			if(monthNum > 11) { monthNum = 0 }
			var month = this.getOffsetMonth(offset)
				, year = this.getOffsetYear(offset)

			// get the first day of the month we are currently viewing
			var firstOfMonth = new Date(year, month, 1).getDay(),
	
			// get the total number of days in the month we are currently viewing
			numDays = this.offsetDaysInMonth(offset),
	
			// declare our day counter
			dayCount = 0,
	
			html = '',
	
			row = '<tr>'
			
			// print out previous month's "days"
			for(i = 1; i <= firstOfMonth; i++) {
				row += '<td>&nbsp;</td>'
				dayCount++
			}
	
			for(i = 1; i <= numDays; i++) {
				// if we have reached the end of a week, wrap to the next line
				if(dayCount == 7) {
					row += '</tr>'
					html += row
					row = '<tr>'
					dayCount = 0
				}

				// output the text that goes inside each td
				// if the day is the current day, add a class of "selected"
				// Only show a default date if the selection mode is 'single'
				row += '<td data-day="' + i + '" class=""><a href="#">' + i + '</a></td>'
				dayCount++
			}
			
			// if we haven't finished at the end of the week, start writing out the "days" for the next month
			for(i = 1; i <= (7 - dayCount); i++) {
				row += '<td>&nbsp;</td>'
			}
	
			html += row
			
			return html
		}
1181639
function getLatency(emitter) {
    var start = Date.now();

    return emitter.request('time')
        .then(function (timestamp) {
          var end = Date.now();
          var latency = (end - start) / 2;
          var time = timestamp + latency;

          // apply the first ever retrieved offset immediately.
          if (isFirst) {
            isFirst = false;
            emitter.emit('change', time);
          }

          return latency;
        })
  }
1309083
private Timestamp make_localtime()
    {
        int offset = _offset != null
            ? _offset.intValue()
            : 0;

        // We use a Copy-Constructor that expects the time parameters to be in
        // UTC, as that's what we're supposed to have.
        // As this Copy-Constructor doesn't apply local offset to the time
        // field values (it assumes that the local offset is already applied to
        // them), we explicitly apply the local offset to the time field values
        // after we obtain the new Timestamp instance.
        Timestamp localtime = new Timestamp(_precision,
                                            _year,
                                            _month,
                                            _day,
                                            _hour,
                                            _minute,
                                            _second,
                                            _fraction,
                                            _offset,
                                            APPLY_OFFSET_NO);
        // explicitly apply the local offset to the time field values
        localtime.apply_offset(-offset);

        assert localtime._offset == _offset;

        return localtime;
    }
744955
def dst(self, dt):
        
        if self.__is_daylight_time(dt):
            return self.__dst_offset - self.__offset
        else:
            return datetime.timedelta(0)
1297283
function get_timestamp() {
        if (!empty($this->timestamp)) {
            $timestamp = $this->timestamp;
            unset($this->timestamp);
            return $timestamp;
        }
        return time();
    }
1122674
def utcoffset(self, dt):
        """"""
        tt = _localtime(_mktime((dt.year, dt.month, dt.day,
                 dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1)))
        if tt.tm_isdst > 0: return _dstoffset
        return _stdoffset