Epoch
Venice based HTTP server for Swift 2 (Linux ready)
I'm generating a graph with gnuplot of activity over the last twenty four hours, but the time axis looks really bad because it's trying to fit the long number for every five minutes in the last day.
Is there any way for gnuplot to treat the x-axis as an epoch time, and mark every hour or so?
Source: (StackOverflow)
Does System.currentTimeMillis
always returns a fixed length of value. In my windows Core2, it return a 13 digit long value.
From its API:
Returns the current time in milliseconds. Note that while the unit of time of the return value is a millisecond, the granularity of the value depends on the underlying operating system and may be larger. For example, many operating systems measure time in units of tens of milliseconds.
Source: (StackOverflow)
The statement gives me the date and time.
How could I modify the statement so that it returns only the date?
SELECT to_timestamp( TRUNC( CAST( epoch_ms AS bigint ) / 1000 ) );
Source: (StackOverflow)
The time
module can be initialized using seconds since epoch:
>>> import time
>>> t1=time.gmtime(1284286794)
>>> t1
time.struct_time(tm_year=2010, tm_mon=9, tm_mday=12, tm_hour=10, tm_min=19,
tm_sec=54, tm_wday=6, tm_yday=255, tm_isdst=0)
Is there an elegant way to initialize a datetime.datetime
object in the same way?
Thanks,
Adam
Source: (StackOverflow)
I'm trying to get the number of days, weeks, months since Epoch in Java.
The Java Calendar class offers things like calendar.get(GregorianCalendar.DAY_OF_YEAR), or Calendar.get(GregorianCalendar.WEEK_OF_YEAR), which is a good start but it doesn't do exactly what I need.
Is there an elegant way to do this in Java?
Source: (StackOverflow)
I want to set a file's modification time to the time I got from exif data.
To get the time from exif, I found :
Graphics.Exif.getTag :: Exif -> String -> IO (Maybe String)
To set the file modification time, I found :
System.Posix.Files.setFileTimes :: FilePath -> EpochTime -> EpochTime -> IO ()
Assuming I do find a Time in Exif, I need to convert a String to an EpochTime.
- With
parseTime
I can get a UTCTime
.
- With
utcTimeToPOSIXSeconds
I can get a POSIXTime
- With a
POSIXTime
I can more or less get an EpochTime
To convert from a UTCTime
to EpochTime
this typechecks, but I'm not
sure it's correct :
fromIntegral . fromEnum . utcTimeToPOSIXSeconds $ etime
This is part of a function getTime that will return the time from Exif
data, if present, otherwise the file's modification time :
getTime (path,stat) = do
let ftime = modificationTime $ stat
err (SomeException _) = return ftime
time <- liftIO $ handle err $ do
exif <- Exif.fromFile path
let getExifTime = MaybeT . liftIO . Exif.getTag exif
res <- runMaybeT $ do
tmp <- msum . map getExifTime $ [ "DateTimeOriginal","DateTimeDigitized", "DateTime" ]
MaybeT . return . parseTime defaultTimeLocale "%Y:%m:%d %H:%M:%S" $ tmp
case res of
Nothing -> return ftime
Just etime -> return . fromIntegral . fromEnum . utcTimeToPOSIXSeconds $ etime
return (path,time)
My question is
Is there a better/simpler way to convert the time ? ( maybe using different libaries )
Source: (StackOverflow)
I have the following table:
SQL> desc recording
Name Null? Type
-------------------- -------- ------
CAPTUREID NOT NULL NUMBER(9)
STARTDATE NOT NULL DATE
ENDDATE DATE
STATE NUMBER(1)
ESTIMATEDENDTIME NUMBER(13)
Here's a single line for this table:
SQL> select * from recording where CAPTUREID=14760457;
CAPTUREID STARTDATE ENDDATE STATE ESTIMATEDENDTIME
---------- ------------------- ------------------- ----- ----------------
14760457 29/09/2010 08:50:01 29/09/2010 09:52:04 0 1285746720000
I'm pretty sure that this has been asked so many times before, but all the solutions I've found so far didn't really work, so... How do I convert ESTIMATEDENDTIME
from its original epoch form to a DD/MM/YYY HH:MI:SS
format in a single query in SQLPLUS?
Thanks!
Source: (StackOverflow)
I'm using an API right now and it provides an epochTime. I've tried everything to convert this epochtime to date, but it doesn't seem to be working including $epoch_time / 1000
and then using the date()
function to convert it.
The epoch time looks something like this 1353430853299. Is there a way to do this? strtotime()
did not work either.
It seems that all of the other readings about epoch time are about changing date to epochtime, but I'm looking to go the other way around. Any help is greatly appreciated.
Source: (StackOverflow)
Currently I store the time in my database like so: 2010-05-17 19:13:37
However, I need to compare two times, and I feel it would be easier to do if it were a unix timestamp such as 1274119041
. (These two times are different)
So how could I convert the timestamp to unix timestamp? Is there a simple php function for it?
Source: (StackOverflow)
I need to be able to convert a date to a time stamp, an epoch in milliseconds.
All I see online are for converting milliseconds to NSDate and not the other way round. Any help out there?
Source: (StackOverflow)
Could you help me convert Unix epoch time into format yyyy-mm-dd hh:mm:ss(24h) in sqlite?(GMT+7 is very appreciate).
Ex: from 1319017136629 to Wednesday, October 19, 2011 4:38:56 PM GMT+7
Many thanks in advance.
p/s: Just look around and found solution:
SELECT datetime(1319017136629, 'unixepoch', 'localtime');
But i am still looking for a way to batch convert Unixepoch time in SQLite.
Source: (StackOverflow)
What I want to do is convert an epoch time (seconds since midnight 1/1/1970) to "real" time (m/d/y h:m:s)
So far, I have the following algorithm, which to me feels a bit ugly:
void DateTime::splitTicks(time_t time) {
seconds = time % 60;
time /= 60;
minutes = time % 60;
time /= 60;
hours = time % 24;
time /= 24;
year = DateTime::reduceDaysToYear(time);
month = DateTime::reduceDaysToMonths(time,year);
day = int(time);
}
int DateTime::reduceDaysToYear(time_t &days) {
int year;
for (year=1970;days>daysInYear(year);year++) {
days -= daysInYear(year);
}
return year;
}
int DateTime::reduceDaysToMonths(time_t &days,int year) {
int month;
for (month=0;days>daysInMonth(month,year);month++)
days -= daysInMonth(month,year);
return month;
}
you can assume that the members seconds
, minutes
, hours
, month
, day
, and year
all exist.
Using the for
loops to modify the original time feels a little off, and I was wondering if there is a "better" solution to this.
Source: (StackOverflow)
How come date is converting to wrong time?
result=$(ls /path/to/file/File.*)
#/path/to/file/File.1361234760790
currentIndexTime=${result##*.}
echo "$currentIndexTime"
#1361234760790
date -d@"$currentIndexTime"
#Tue 24 Oct 45105 10:53:10 PM GMT
Source: (StackOverflow)
I have used a ruby script to convert iso time stamp to epoch, the files that I am parsing has following time stamp structure:
2009-03-08T00:27:31.807
Since I want to keep milliseconds I used following ruby code to convert it to epoch time:
irb(main):010:0> DateTime.parse('2009-03-08T00:27:31.807').strftime("%Q")
=> "1236472051807"
But In python I tried following:
import time
time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(1236472051807))
But I don't get the original time date time back,
>>> time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(1236472051807))
'41152-03-29 02:50:07'
>>>
I wonder is it related to how I am formatting?
Source: (StackOverflow)
I was able to find example code to get the current timestamp in Linux Epoch (Seconds since Midnight Jan 1st 1970), however I am having trouble finding an example as to how to calculate what the Epoch will be in the future, say for example 10 minutes from now, so how can I calculate a future time in Linux Epoch?
Source: (StackOverflow)