Hallo,
gibt es in GLBasic eigentlich einen Weg einen "Timestamp" auszulesen oder muß ich mir den selbst generieren?
Momentan weiß ich nur von dem Weg mit PLATFORMINFO$("TIME"), wobei man hier nur die formatierte Zeit heraus bekommt...
GLG
W.
Ich dachte mir, ich rechne einfach mal die Sekunden zwischen zwei Zeitpunkten runter.
Wenn jetzt ein Tag oder eine noch größere Distanz dazwischen liegt, dann kann ich eigentlich hergehen und den gesamten Inhalt von PLATFORMINFO$("TIME") in Sekunden umwandeln,
von einem bestimmten Startpunkt aus, um dann die Sekunden herunterzählen zu können.
Deshalb frage ich eben. Falls es keine einfachere Lösung gibt, dann mache ich das natürlich so... =D
Selbst gebaut ist halb gewonnen!
Falls es jemand brauchen kann!
FUNCTION get_timestamp:
LOCAL time$
LOCAL year, month, day, hour, minute, second
LOCAL tmp, schalt_year, total
STATIC year_tmp, schalt_total, normal_total, month_tmp, month_total
time$ = PLATFORMINFO$("TIME")
year = MID$(time$, 0, 4)
DEC year, 2000
month = MID$(time$, 5, 2)
day = MID$(time$, 8, 2)
hour = MID$(time$, 11, 2)
minute = MID$(time$, 14, 2)
second = MID$(time$, 17, 2)
schalt_year = MOD(year, 4)
IF year_tmp <> year
FOR tmp = 1 TO year
IF MOD(tmp, 4) = 0
INC schalt_total, 1
ELSE
INC normal_total, 1
ENDIF
NEXT
year_tmp = year
ENDIF
IF month_tmp <> month
IF month > 1 THEN INC month_total, 31
IF month > 2
IF schalt_year = 0
INC month_total, 29
ELSE
INC month_total, 28
ENDIF
ENDIF
IF month > 3 THEN INC month_total, 31
IF month > 4 THEN INC month_total, 30
IF month > 5 THEN INC month_total, 31
IF month > 6 THEN INC month_total, 30
IF month > 7 THEN INC month_total, 31
IF month > 8 THEN INC month_total, 31
IF month > 9 THEN INC month_total, 30
IF month > 10 THEN INC month_total, 31
IF month > 11 THEN INC month_total, 30
month_tmp = month
ENDIF
total = (schalt_total * 60*60*24*366) + (normal_total * 60*60*24*365) + (month_total * 86400) + (day * 86400) + (hour * 3600) + (minute * 60) + second
RETURN total
ENDFUNCTION