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
1
vote
2 answers

Python specify file creation time by milliseconds

After some research I couldn't find any solution to this so here it goes: Python's command: time.ctime(os.path.getctime('/path')) displays output as (e.g): Fri Dec 2 16:06:05 2016. How can I make it display not only hours/minutes/seconds but also…
user5349891
1
vote
1 answer

Change ctime of file under FreeBSD UFS / MacOS X HFS

I'm searching for a way to create a file with an old ctime on different filesystems. On Linux ext, this is achieved by using touch /path/to/file debugfs -w -R 'set_inode_field /path/to/file ctime 201001010101' /dev/sdX echo 3 >…
Orsiris de Jong
  • 2,819
  • 1
  • 26
  • 48
1
vote
1 answer

I would like to obtain time (ctime(..)?) of a file in host language

I have a function like this: void ft_display_time(struct timespec ttime) { char *time_long; time_long = ctime(&ttime.tv_sec); if (time_long) { ft_printf("%.3s ", time_long + 4); ft_printf("%.2s ", time_long +…
LotoLo
  • 327
  • 4
  • 17
1
vote
2 answers

Equality check for time_t typed variables

I been comparing the equality of the 2 time one that is taken from loacal machine and one from server time_t local= kernel()->time_now() this time_now() do return time_t and uses normal way to get sys time time_t remote =fs->ctime() getting the…
RaGa__M
  • 2,550
  • 1
  • 23
  • 44
1
vote
7 answers

How to append system time to a string variable

#include #include #include using namespace std; int main() { string NowTime; time_t now; struct tm nowLocal; now=time(NULL); // get the time from the OS nowLocal=*localtime(&now); NowTime =…
chun11197
  • 11
  • 5
1
vote
1 answer

difference of two user entered time c++

i need to be able fill two variables (a kind of time variable), then be able to calculate their difference. after all of my searches i found difftime, but my problem is that, it uses time_t variables, and i don't know how to fill a 'time_t' with…
1
vote
1 answer

Runtime error in c++ when analysing time

I'm trying to check how much time passes with each 3 solutions for a problem, but sometimes I get a runtime error and can't see the passed time for 3rd solution, but sometimes it works. I think the solutions.h file is correct but i put it here…
codemonkey
  • 809
  • 1
  • 9
  • 21
1
vote
1 answer

What is the difference between typedef and Macros?

What is the difference between typedef and Macros? We can just simply define a macro instead of using a typedef, and what does this Macro evaluate to CLOCKS_PER_SEC (defined in )?
AnotherOne
  • 854
  • 2
  • 8
  • 19
1
vote
2 answers

With python: intervals at x:00 repeat

How do I sched a repeat timer for 5 min intervals. Which fire at 00 seconds, then repeat at 00. Ok, not hard real-time but as close as possible with sys lags. Trying to avoid a build up in lags and get near 00. Lang: Python, OS: WinXP x64 System…
Merlin
  • 24,552
  • 41
  • 131
  • 206
1
vote
0 answers

Finding time it takes to sort an array using selection sort (C++)?

The assignment I have asks me to write a class that displays the time it takes (in milliseconds) to sort an array that holds 100,000 randomly generated items using a selection sort. #include #include #include #include…
TEEBQNE
  • 6,104
  • 3
  • 20
  • 37
1
vote
1 answer

looking for another time structure with member objects other than tm

the member tm_mon, in struct tm is stored as an integer. I'm looking for another time stuct that stores the actual name of the month. I can get the user-friendly format with ctime(); but how can I selectively output just the month?
Ben Marconi
  • 161
  • 1
  • 1
  • 7
1
vote
2 answers

PHP - linux/unix CTIME (inode change time) is being set when it's only being modified

According to: http://www.php.net/manual/en/function.filectime.php "In most Unix filesystems, a file is considered changed when its inode data is changed; that is, when the permissions, owner, group, or other metadata from the inode is…
ParoX
  • 5,685
  • 23
  • 81
  • 152
1
vote
2 answers

loop rand(), on next rand() don't use previous?

I need two random numbers each loop, but cannot use the previous loop's random numbers. I'm lost, I've searched and don't know what to do. Please help! I've put my code below. So, what I need, specifically, is to generate two random numbers stored…
Quadruckus
  • 21
  • 4
1
vote
1 answer

C++ and CTime & System clock changing

I want to write simple application in C++ using ctime library. I'm getting the actual time and do some calculation in the loop. Very important for me is the fact that user can modify OS clock during calculations. Is there any way to get to know…
Lukasz Spas
  • 595
  • 2
  • 9
  • 23
1
vote
1 answer

Having problems with ctime, and working out function running time

I'm having trouble working out the time for my two maxsubarray functions to run. (right at the bottom of the code) The output it gives me: Inputsize: 101 Time using Brute Force:0 Time Using DivandCon: 12 is correct for the second time I use…
Xaryu
  • 11
  • 5