Questions tagged [ctime]

CTime Class The upper date limit is 12/31/3000. The lower limit is 1/1/1970 12:00:00 AM GMT.

CTime does not have a base class.

CTime values are based on coordinated universal time (UTC), which is equivalent to Greenwich mean time (GMT). The local time zone is controlled by the TZ environment variable.

When creating a CTime object, set the nDST parameter to 0 to indicate that standard time is in effect, or to a value greater than 0 to indicate that daylight savings time is in effect, or to a value less than zero to have the C run-time library code compute whether standard time or daylight savings time is in effect. tm_isdst is a required field. If not set, its value is undefined and the return value from mktime is unpredictable. If timeptr points to a tm structure returned by a previous call to asctime, gmtime, or localtime, the tm_isdst field contains the correct value.

A companion class, CTimeSpan, represents a time interval.

The CTime and CTimeSpan classes are not designed for derivation. Because there are no virtual functions, the size of CTime and CTimeSpan objects is exactly 8 bytes. Most member functions are inline.

252 questions
0
votes
2 answers

C truncate HH:MM:SS from ctime value, ctime

I have this unix timestamp which when converted using ctime shows as Thu Mar 26 15:30:26 2007, but I need only Thu Mar 26 2007. How do I change or truncate to eliminate the time (HH:MM:SS)?
Lincon
  • 21
  • 3
0
votes
1 answer

C - How to actually use a long long datatype with the ctime function

I tried asking this before but I forgot to include a question (since I just joined the site), so I didn't actually have my problem solved, people just told me why the second bit of code was wrong instead of how to make it work. This is part of a…
Mike Weber
  • 179
  • 1
  • 1
  • 10
0
votes
1 answer

Error in clock_gettime in ctime

I have this function: void Estatisticas::iniciarTempo() { clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &tempoInicial); } I'm trying to use clock_gettime by ctime, but I getting some errors: "undefined reference to 'clock_gettime'" Thanks a lot.
Breno
  • 27
  • 4
0
votes
2 answers

Issue with using ctime to advance a given date to next calendar date

I wrote the following piece of code to advance the input date to the following calendar date. This works well when tested in a dummy source file compiled with g++ 4.1.2 However, when running the following code from within my firm's…
Mindstorm
  • 443
  • 1
  • 5
  • 12
0
votes
3 answers

handling clock_t overflow from std::clock()

Question regarding clock tick count generated by clock() from . (Usage of clock() is covered in other questions) On my system clock_t is an alias for long whose max value according to my compiler's is 2147483647. clock_t delay =…
user17753
  • 3,083
  • 9
  • 35
  • 73
0
votes
2 answers

C++ Trouble with ctime's clock() method in VS2010 under VMWare Fusion/Boot Camp

I'm having trouble getting anything useful from the clock() method in the ctime library in particular situations on my Mac. Specifically, if I'm trying to run VS2010 in Windows 7 under either VMWare Fusion or on Boot Camp, it always seems to return…
0
votes
1 answer

MFC C++, adding seconds (int) to a current CTime variable

noob to C++. I have a CTime (actually it's a CTimeEx) object. The value of the time value is: CExTime now = now.GetSystemTime(); I am receiving an int, such as 60, to add to that time; this means that if I have 12:01:30 , then I'd want…
ilansch
  • 4,784
  • 7
  • 47
  • 96
0
votes
4 answers

Apache get file date without downloading

I'm currently writing some update polling stuff. I try to avoid writing even a simple REST-Interface for this (we're using much REST, still I'm not sure this is necessary here. Why write an interface for functionality already there?) My idea was to…
annih
  • 395
  • 2
  • 6
  • 21
0
votes
1 answer

ctime(x) = ctime(x-600) why?

I get the same string result for curTime and pastTime when I use "ctime" even though the actual values at curTime and pastTime are different by 600 seconds. How am I getting the same string time for both when using ctime? thx struct _timeb…
jdl
  • 6,151
  • 19
  • 83
  • 132
-1
votes
1 answer

ctime lib, pointer in C++

tm *ltm = localtime(&now); cout << "Year: "<< 1900 + ltm->tm_year << endl; in ctime lib why we must use ltm->tm_year but can't use *1tm.tm_year
EllieHz
  • 1
  • 1
-1
votes
1 answer

When I use ctime my loop runs half the amount of times as it should

The size is defined as 15, but this program only runs 8 times for some reason and i don't know why. This part is the only issue. Once i removed it and replaced it with something that doesn't use ctime it ran 15 times. for(int count = 0; count <…
-1
votes
1 answer

how to find the full minute before and after a date in miliseconds

I've a a problem with time numbers, Lets supose that i've this time: 05-03-2016 09:45:55.064371, I've a function that converts this to miliseconds (Using Epoch (reference_date), using ctime and chrono libraries)->1457167555064, now what I want to…
david.t_92
  • 1,971
  • 1
  • 11
  • 15
-1
votes
3 answers

How to get the first Sunday of year in c++?

I tried to get the date of first Sunday in this year int getFristSunday () { time_t rawtime; struct tm * timeinfo; time( &rawtime ); timeinfo = localtime( &rawtime ); timeinfo->tm_mon = 0; timeinfo->tm_wday = 0; mktime(…
-1
votes
1 answer

find /path/ -ctime 1 what does it do? PERL

find /path/ -ctime 1 or find /path/ -ctime -1 As a non native english speaker is hard to me to understand exactaly what this does. I'm trying to find files that are older than n days and delete them after using foreach my $l (@list){ `rm…
Bruno Francisco
  • 3,841
  • 4
  • 31
  • 61
-1
votes
1 answer

std chrono 1 hour wrong when converting with ctime to char*

I'm trying to display the difference between high resolution time points in a string like 00:00:00. My problem is that the time is +1 hour when i print it. #include #include #include #include using namespace…
fonZ
  • 2,428
  • 4
  • 21
  • 40
1 2 3
16
17