IMPORT util MAIN RUN "echo $(($(date +%s%N)/1000000))" -- Linux/Bash! DISPLAY unixtime_ms(CURRENT YEAR TO FRACTION(3)) USING "<<<<<<<<<<<<<<<<<<" DISPLAY unixtime_ms("1970-01-01 00:00:00.000") USING "-<<<<<<<<<<<<<<<<<<"END MAIN -- Converts a datetime to milliseconds since epochFUNCTION unixtime_ms(d) CONSTANT ms_1970_2000 BIGINT = 946684800000 -- milliseconds from 1970-01-01 to 2000-01-01 DEFINE d DATETIME YEAR TO FRACTION(3) DEFINE d2000 DATETIME YEAR TO FRACTION(3) DEFINE sec_2000_now INTERVAL SECOND(9) TO FRACTION(3) DEFINE ms_2000_now BIGINT DEFINE tmp STRING LET d2000 = "2000-01-01 00:00:00.000" LET sec_2000_now = util.Datetime.toUTC(d) - d2000 LET tmp = sec_2000_now -- Formatted! LET ms_2000_now = (tmp.subString(1,10)*1000) + tmp.subString(12,14) RETURN (ms_1970_2000 + ms_2000_now) END FUNCTION
CONSTANT d2000 DATETIME YEAR TO DAY = DATETIME(2000-01-01) YEAR TO DAY
IMPORT JAVA java.lang.SystemMAIN DISPLAY System.currentTimeMillis()END MAIN
IMPORT utilMAIN RUN "echo $(($(date +%s%N)/1000000))" -- Linux/Bash! DISPLAY millisecondsSinceEpoch(CURRENT) USING "<<<<<<<<<<<<<<<<<<"END MAIN FUNCTION millisecondsSinceEpoch(dt) DEFINE dt DATETIME YEAR TO FRACTION(3) DEFINE s, ms BIGINT, tmp STRING LET s = util.Datetime.toSecondsSinceEpoch(dt) LET tmp = EXTEND(dt, FRACTION TO FRACTION(3)) -- ".fff" LET ms = tmp.subString(2,4) RETURN (s * 1000) + msEND FUNCTION
let l_time = current year to fraction (5) let l_unic = ga_mem[l_i].empcod using "<<<<", "_", ga_mem[l_i].memcod using "<<<<<<<<<<", "_", l_time[03,04], l_time[06,07], l_time[09,10], l_time[15,16], l_time[18,19], l_time[21,25]
DEFINE tmpname STRING, mydata BYTELET tmpname = os.Path.getTempFileName()LOCATE mydata IN FILE tmpname...
DEFINE tmpname STRING, mydata BYTELOCATE mydata IN FILE -- (temp file)LET tmpname = mydata.getFileName()-- If this is an image data, you can then do:DISPLAY tmpname TO image_field...
DEFINE img BYTELOCATE img IN FILESELECT ... INTO img ...DISPLAY img TO image_field...
function monta_caminho_temporario(l_nome) define l_nome string, l_caminho string, l_time char(25) whenever error call erro_cont let l_time = current year to fraction (5) if l_nome is null then let l_nome = downshift(gg_sis.sissist) clipped, gg_dmp.dmpcod[4,6] end if let l_caminho = gg_path.tmp, # /tmp/ l_nome clipped, l_time[03,04], # Ano l_time[06,07], # Mês l_time[09,10], # Dia l_time[12,13], # Hora l_time[15,16], # Minuto l_time[18,19], # Segundo l_time[21,25], # Fração gg_usu.usucod using "&&&&&&" # Usuário return l_caminho end function