module.exports = {
  delayMills: delayMills,
  getCurrentMills: getCurrentMills,
  getGreet: getGreet,
}

// 等待毫秒数
function delayMills(mills) {
  return new Promise(resolve => setTimeout(resolve, mills));
}

///获取毫秒
function getCurrentMills() {
  var currentDate = new Date();
  var currentTimeMillis = currentDate.getTime();
  // return Math.floor(currentTimeMillis / 1000);
  return currentTimeMillis;
}

///获取上午、下午、晚上
function getGreet() {
  const now = new Date();
  const hour = now.getHours();
  var greeting;
  if (hour >= 5 && hour < 12) {
    greeting = '上午好';
  } else if (hour >= 12 && hour < 18) {
    greeting = '下午好';
  } else {
    greeting = '晚上好';
  }
  return greeting;
};