Returns a String (offset) or Instant (timestamp).
541349
CompletableFuture<EventPosition> getInitialOffset() {
        return this.hostContext.getCheckpointManager().getCheckpoint(this.partitionId)
                .thenApply((startingCheckpoint) -> {
                    return checkpointToOffset(startingCheckpoint);
                }
463997
def current_timestamp():
    """"""
    now = datetime.utcnow()
    timestamp = now.isoformat()[0:19] + 'Z'

    debug("generated timestamp: {now}".format(now=timestamp))

    return timestamp
1306580
public synchronized Instant getStartTime(TimestampProvider times) {
        if (startTime==null) {
            startTime = times.getTime();
        }
        return startTime;
    }
549054
def _tz_offset_string(offset):
        """"""

        s = ""
        io = int(offset)
        if io == 0:
            s += "Z"
        else:
            if -1440 < io < 1440:
                ho = abs(io) / 60
                mo = abs(io) % 60

                s += "%c%02u" % ("+" if io > 0 else "-", ho)
                if mo != 0:
                    s += ":%02u" % mo

            else:
                raise ValueError("Timezone `offset` (%u) out of range "
                                 "-1439 to +1439 minutes" % io)
        return s
814819
def date(fmt=None,timestamp=None):
    ""
    if fmt=='U': # return timestamp
        t = datetime.datetime.now()
        return int(time.mktime(t.timetuple()))
    if fmt=='c': # return isoformat 
        d = datetime.datetime.fromtimestamp(timestamp)
        return d.isoformat()
    if fmt=='Ymd':
        d = datetime.datetime.now()
        return d.strftime("%Y%m%d")
678132
def time_str (time_t, slug = False):
  '''
  '''
  return datetime.fromtimestamp (int (time_t)).strftime (
    DEFAULT_SLUGFORMAT if slug else DEFAULT_TIMEFORMAT)
844626
public static Timestamp toSqlTimestamp(Instant instant) {
        try {
            Timestamp ts = new Timestamp(instant.getEpochSecond() * 1000);
            ts.setNanos(instant.getNano());
            return ts;
        } catch (ArithmeticException ex) {
            throw new IllegalArgumentException(ex);
        }
    }
1319320
protected static String instantToStringTime(Instant instant) {
    	String result = "";
    	if (instant!=null) { 
    		StringBuffer time = new StringBuffer();
    		time.append(String.format("%02d",instant.get(DateTimeFieldType.hourOfDay())));
    		time.append(":").append(String.format("%02d",instant.get(DateTimeFieldType.minuteOfHour())));
    		time.append(":").append(String.format("%02d",instant.get(DateTimeFieldType.secondOfMinute())));
    		time.append(".").append(String.format("%03d",instant.get(DateTimeFieldType.millisOfSecond())));
    		String timeZone = instant.getZone().getID();
    		if (timeZone.equals("UTC")) { 
    		    time.append("Z"); 
    		} else { 
    			time.append(timeZone);
    		}
    		result = time.toString();
    	}
    	return result;
    }
1200741
def readable_timestamp(stamp):
    
    if date.fromtimestamp(stamp) == date.today():
        return str(datetime.fromtimestamp(stamp).strftime("%I:%M:%S%p"))
    else:
        return str(date.fromtimestamp(stamp))
1359058
def timestamp(x):
    """"""
    if x.tzinfo is None:
        # Naive dates to utc
        x = x.replace(tzinfo=utc)

    if hasattr(x, 'timestamp'):
        return x.timestamp()
    else:
        return (x - datetime(1970, 1, 1, tzinfo=utc)).total_seconds()
526467
private String format(final Instant instant) {
		synchronized (formatter) {
			if (!instant.equals(lastInstant)) {
				lastInstant = instant;
				lastFormat = formatter.format(instant);
			}
			return lastFormat;
		}
	}
730651
def Timestamp():
    
    timestamp = ''
    try:
        timestamp = str(datetime.datetime.now())+' UTC'
    except Exception as e:  # pragma: no cover
        logger.error('Could not get current time ' + str(e))
    return timestamp
631920
def _make_string_formatter(f, offset=None):
  
  format = f
  delta = offset
  return lambda v: time.strftime(format, (_date(v, delta)).timetuple())
377524
private String getString(int offset, int maxLength) {
        int index = offset;
        int lastIndex = index + maxLength;
        while (index < lastIndex && (buffer[index] != 0)) {
            index++;
        }
        return new String(buffer, offset, index - offset, StandardCharsets.ISO_8859_1);
    }
456290
def get_timestamp(length):
    """"""
    s = '%.6f' % time.time()
    whole, frac = map(int, s.split('.'))
    res = '%d%d' % (whole, frac)
    return res[:length]
382760
def get_utc_timestamp(self, handle):
        """"""
        fpath = self._fpath_from_handle(handle)
        datetime_obj = datetime.datetime.utcfromtimestamp(
            os.stat(fpath).st_mtime
        )
        return timestamp(datetime_obj)
302160
def get_time_at(time_in=None, time_at=None, out_fmt='%Y-%m-%dT%H:%M:%S'):
    '''
    
    '''
    dt = get_timestamp_at(time_in=time_in, time_at=time_at)
    return time.strftime(out_fmt, time.localtime(dt))