PDA

View Full Version : [C] strptime non legge fuso orario


Damage92
16-05-2010, 16:30
Sto programmando sotto linux in C. Voglio usare la funzione strptime per convertire una stringa in struct tm.

Il problema è che è indifferente alla parte finale della stringa, quella che specifica il fuso orario da aggiungere alla data. Per esempio nella stringa:
Sun, 16 May 2010 14:56:25 +0200
Per lui le ore sono 14, mentre dovrebbe aggiungere 2!

Ho consultato la rfc (link (http://www.faqs.org/rfcs/rfc822.html)), e mi pare che il formato sia apposto...

Qualcuno che ha mai usato questa funzione sa illuminarmi?

Damage92
17-05-2010, 20:59
Forse ho trovato la risposta.
Nella man c'è scritto:
Glibc Notes
For reasons of symmetry, glibc tries to support for strptime() the same format characters as for strftime(3). (In most cases the corresponding
fields are parsed, but no field in tm is changed.)

Quindi pare che alcuni caratteri non siano riconosciuti :(