Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/11/2014, 12:30
newb
 
Fecha de Ingreso: marzo-2014
Mensajes: 41
Antigüedad: 10 años, 1 mes
Puntos: 0
[Ayuda] error "localtime unsafe"

Tengo este error en visual studio...

Cita:
error C4996: 'localtime': This function or variable may be unsafe. Consider using localtime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
El metodo para dar la fecha seria algo asi

Código:
 private:
 struct tm *tiempo;
 int dia;
 int mes;
 int anio;


/*..................................*/

 public:
 string muestraFecha(){
 stringstream s;
 time_t fecha_sistema;
 time(&fecha_sistema);
 tiempo=localtime(&fecha_sistema); //Aqui es donde me da el error
 
 anio=tiempo->tm_year + 1900;
 mes=tiempo->tm_mon + 1;
 dia=tiempo->tm_mday;

 s<<dia<<"/"<<mes<<"/"<<anio<<endl;
 return s.str();
}