Time

์†Œ๊ฐœ

ZEP ์„œ๋ฒ„์˜ ์‹œ๊ฐ„์„ ์กฐํšŒํ•˜๋Š” ๋“ฑ ์‹œ๊ฐ„ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ํ•จ์ˆ˜๋ฅผ ๋ชจ์•„๋†“์€ ํด๋ž˜์Šค์ž…๋‹ˆ๋‹ค.

Methods

์ด๋ฆ„์„ค๋ช…

getTime

ZEP ์„œ๋ฒ„์˜ ํ˜„์žฌ ์‹œ๊ฐ„์„ milliseconds ๋‹จ์œ„์˜ ๊ฐ’์œผ๋กœ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค.

getUtcTime

ํ˜„์žฌ UTC ์‹œ๊ฐ„์„ milliseconds ๋‹จ์œ„์˜ ๊ฐ’์œผ๋กœ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค.

getTimeInterval

ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์ž…๋ ฅํ•œ ๋‘ ์‹œ๊ฐ„์˜ ์ฐจ์ด๋ฅผ ๊ณ„์‚ฐํ•ด ๊ฐ’์„ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค.

getTime

Time.getTime()

ZEP ์„œ๋ฒ„์˜ ํ˜„์žฌ ์‹œ๊ฐ„์„ milliseconds ๋‹จ์œ„์˜ ๊ฐ’์œผ๋กœ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ

// Q๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(KeyCodeType.q, (player)=>{
    player.sendMessage(`Server Time: ${Time.getTime()}`);
});

getUtcTime

Time.getUtcTime()

ํ˜„์žฌ UTC ์‹œ๊ฐ„์„ milliseconds ๋‹จ์œ„์˜ ๊ฐ’์œผ๋กœ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ

// Q๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(KeyCodeType.q, (player)=>{
    player.sendMessage(`UTC Time: ${Time.getUtcTime()}`);
});

getTimeInterval

Time.getTimeInterval(timeA: number, timeB: number, returnType: DateType)

timeB - timeA๋ฅผ ๊ณ„์‚ฐํ•˜๊ณ , ๊ทธ ๊ฒฐ๊ณผ๋ฅผ ์ง€์ •ํ•œ returnType์œผ๋กœ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

timeA, timeB

Number

์ฐจ์ด๋ฅผ ๊ณ„์‚ฐํ•  ์‹œ๊ฐ„ (milliseconds)

returnType

DateType

DateType.MILLISECONDS ( ms ๋‹จ์œ„ )

DateType.SECONDS (์ดˆ ๋‹จ์œ„ )

DateType.MINUTES ( ๋ถ„ ๋‹จ์œ„ )

DateType.HOURS ( ์‹œ๊ฐ„ ๋‹จ์œ„ )

DateType.DAYS ( ์ผ ๋‹จ์œ„ )

์˜ˆ์ œ

// Q๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(KeyCodeType.q, (player)=>{
    const currentTime = Time.getTime();
    const utcTime = Time.getUtcTime();
    player.sendMessage(`timeInterval: ${Time.getTimeInterval(currentTime, utcTime, DateType.MILLISECONDS)}`);
})

Last updated