Is this legit? Im trying to get to a time_t as fast as possible given a string formatted like YYYYMMDDHHMMSS.
static time_t ConvertToSecSince1970(char *szYYYYMMDDHHMMSS)
{
struct tm Tm;
memset(&Tm, 0, sizeof(Tm));
Tm.tm_year =…
I think the following program should output the seconds to 1970 for the first day of every year from 1AD to 1970, preceded by the size of time_t on the system it's compiled on (CHAR_BIT is a macro so I think you can't just copy the compiled…
Seems like a bug, have a look at the code first:
#include
#include
int main() {
time_t t;
struct tm tm1;
tzset();
time(&t);
localtime_r(&t, &tm1);
tm1.tm_mday = 27;
tm1.tm_sec = 59;
tm1.tm_min…
Web app is breaking on the following line;
start_time = int(time.mktime(start)) * 1000
The error is a TypeError - argument must be 9-item sequence, not datetime.datetime
How to I convert my datetime.datetime to a 9-item-sequence?
I use mktime to create a unix timestamp from my current local time:
#include
int _tmain(int argc, _TCHAR* argv[])
{
struct tm info;
// 16.05.2014
info.tm_mday = 16;
info.tm_mon = 5;
info.tm_year = 114; // Years since 1900
//…
I'm trying to convert 2010-02 to February, 2010. But, I keep getting December, 1969
I've tried using mktime, strtotime, and some combination of the two, but still haven't been able to do it...
This is what I tried most recently...
$path_title =…
I've been using mktime/localtime for time management, including some heavy arithmetic on dates/times.
I noticed something very weird when providing to mktime a struct tm that contains negative values.
Take the code below. There was a DST change in…
i have a date '07/23/2009' and a time '18:11' and i want to get a timestamp out of it :
here is my example:
date_default_timezone_set('UTC');
$d = str_replace('/', ', ', '07/23/2009');
$t = str_replace(':', ', ', '18:11');
$date = $t.', 0,…
The code below is what I'm using for a website menu which moves the link for the current month's page to the top of the link list on the change of the month.
But this fails on the 31st of some months, such as April; I get two links to the same month…
I try to find a way for a default date (if date is not valid).
Common way works fine:
set(2022,6,17,12,12,0,0,0)
void KTime::Set(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, int nDST, bool isUTC)
{
assert(nYear >= 1900);
…
I find mktime cost too much time on __tz_convert which will read /etc/localtime every time to get current timezone.
However, if we assume timezone never change, if only take one call to __tz_convert to get current timezone, which I think can reduce…
I'm all of a sudden getting the following error on a site that I've done, which has been working fine so far:
A PHP Error was encountered
Severity: Warning
Message: mktime() [function.mktime]: It is not safe to rely on the system's timezone…
I was trying to make my own php mktime(); using my default timezone *(America/Sao_Paulo)*.
It was working ok, but I noticed that some timestamps had one hour more than it should be.
So I tracked down and find out this date where the script starts to…