Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. void agregarBoleta(time_t t, int seats, boletaVendida * &mat, int &n)
  2. {
  3. for (int i = 0; i < seats; i++)
  4. {
  5. addMemoria(mat, n);
  6. mat[n-1].fecha = t;
  7. }
  8. }
  9.  
  10. time_t obtenerTime(int anio, int mes, int dia)
  11. {
  12. int year = anio;
  13. int month = mes;
  14. int day = dia;
  15.  
  16. time_t rawtime;
  17. time_t finaltime;
  18. struct tm * timeinfo;
  19.  
  20. /* get current timeinfo and modify it to the user's choice */
  21. time ( &rawtime ); // rawtime = unixtimestamp
  22.  
  23. timeinfo = localtime ( &rawtime );
  24.  
  25. timeinfo->tm_year = year - 1900;
  26. timeinfo->tm_mon = month;
  27. timeinfo->tm_mday = day;
  28.  
  29. /* call mktime: timeinfo->tm_wday will be set */
  30. finaltime = mktime ( timeinfo );
  31.  
  32. /*cout<<"Result: "<<finaltime<<endl;
  33. cout<<"Result: "<<time(NULL)<<endl;
  34. cout<<"Result: "<<timeinfo->tm_year<<endl;
  35. cout<<"Result: "<<timeinfo->tm_mon<<endl;*/
  36. return finaltime;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement