Opened 16 years ago

Closed 16 years ago

Last modified 6 years ago

#8765 closed patch

Add OSystem::getTimeAndDate API

Reported by: fingolfin Owned by: sev-
Priority: normal Component: --Other--
Version: Keywords:
Cc: Game:


The attached patch adds a new OSystem::getTimeAndDate method, which does basically what its name suggests: It returnes the current time and date, as time()+localtime() would yield on a POSIX system.

For simplicity, I just used the struct tm from time.h (which *is* part of the C standard) for the return value. But we could just as well define our own Common::Time struct for this, if preferred.

The benefit of this patch is that it reduces (removes?) the need to ever use time/localtime, which are not very portable. In particular, it might help fix (and help avoid similiar issues in the future) bug #1834822 ( WINCE: Save games have incorrect time & date). The PS2 port would also benefit (see patch).

It's a very simple & straight forward patch, we could IMO push it to SVN right now. But since we are in a feature freeze, I'll await Eugene's comment. And I'll be happy to postpone this till after the release, too.

Ticket imported from: #1859448. Ticket imported from: patches/870.

Attachments (1)

curtime.patch (5.4 KB ) - added by fingolfin 16 years ago.

Download all attachments as: .zip

Change History (5)

by fingolfin, 16 years ago

Attachment: curtime.patch added

comment:1 by sev-, 16 years ago

Status: newclosed

comment:2 by sev-, 16 years ago

Definitely it could help Kostas. Committed to both branch and trunk

comment:3 by SF/knakos, 16 years ago

implemented it in commits 30083, 30084. simplifies things a lot. thanks :-)

comment:4 by digitall, 6 years ago

Component: --Other--
Note: See TracTickets for help on using tickets.