6 Replies - 981 Views - Last Post: 04 November 2013 - 03:02 PM Rate Topic: -----

#1 VuKid  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 57
  • Joined: 27-September 13

visual studio clock?

Posted 04 November 2013 - 02:28 PM

Is there a way to get the current time in visual studios?
Is This A Good Question/Topic? 0
  • +

Replies To: visual studio clock?

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9573
  • View blog
  • Posts: 36,255
  • Joined: 12-June 08

Re: visual studio clock?

Posted 04 November 2013 - 02:31 PM

Do you mean the machine/local time,or what?
Was This Post Helpful? 0
  • +
  • -

#3 VuKid  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 57
  • Joined: 27-September 13

Re: visual studio clock?

Posted 04 November 2013 - 02:32 PM

Yes local time of the machine. I've tried ctime and others but it keeps giving me warnings that it is unsafe.
Was This Post Helpful? 0
  • +
  • -

#4 jimblumberg  Icon User is offline

  • member icon


Reputation: 4278
  • View blog
  • Posts: 13,437
  • Joined: 25-December 09

Re: visual studio clock?

Posted 04 November 2013 - 02:40 PM

Post your code and the complete error/warning messages.

Jim
Was This Post Helpful? 0
  • +
  • -

#5 VuKid  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 57
  • Joined: 27-September 13

Re: visual studio clock?

Posted 04 November 2013 - 02:45 PM

#include <ctime>
..
..
..


//current date/time based on current system
		time_t now = time(0);
		// convert now to string form
		char* dt = ctime(&now);
		cout << "The local date and time is: " << dt << endl;


error C4996: 'ctime': This function or variable may be unsafe. Consider using ctime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
Was This Post Helpful? 0
  • +
  • -

#6 jimblumberg  Icon User is offline

  • member icon


Reputation: 4278
  • View blog
  • Posts: 13,437
  • Joined: 25-December 09

Re: visual studio clock?

Posted 04 November 2013 - 02:56 PM

I suggest you follow the advice given in that warning:

Quote

To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.


Jim
Was This Post Helpful? 0
  • +
  • -

#7 VuKid  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 57
  • Joined: 27-September 13

Re: visual studio clock?

Posted 04 November 2013 - 03:02 PM

I've already used this at the top of header

#define _CRT_SECURE_NO_WARNINGS

still giving same thing.

nvm, I got it, thanks anyway.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1