コード例 #1
0
void UKismetMathLibrary::BreakTimespan(FTimespan InTimespan, int32& Days, int32& Hours, int32& Minutes, int32& Seconds, int32& Milliseconds)
{
	Days = InTimespan.GetDays();
	Hours = InTimespan.GetHours();
	Minutes = InTimespan.GetMinutes();
	Seconds = InTimespan.GetSeconds();
	Milliseconds = InTimespan.GetMilliseconds();
}
コード例 #2
0
bool FAndroidMediaPlayer::Seek(const FTimespan& Time)
{
	if (MediaState == EMediaState::Prepared || MediaState == EMediaState::Started ||
		MediaState == EMediaState::Paused || MediaState == EMediaState::PlaybackCompleted)
	{
		JavaMediaPlayer->SeekTo(Time.GetMilliseconds());
		return true;
	}
	else
	{
		return false;
	}
}
コード例 #3
0
EIPv6SocketInternalState::Return FSocketBSDIPv6::HasState(EIPv6SocketInternalState::Param State, FTimespan WaitTime)
{
#if PLATFORM_HAS_BSD_SOCKET_FEATURE_SELECT
	// convert WaitTime to a timeval
	timeval Time;
	Time.tv_sec = (int32)WaitTime.GetTotalSeconds();
	Time.tv_usec = WaitTime.GetMilliseconds() * 1000;

	fd_set SocketSet;

	// Set up the socket sets we are interested in (just this one)
	FD_ZERO(&SocketSet);
	FD_SET(Socket, &SocketSet);

	// Check the status of the state
	int32 SelectStatus = 0;
	switch (State)
	{
		case EIPv6SocketInternalState::CanRead:
			SelectStatus = select(Socket + 1, &SocketSet, NULL, NULL, &Time);
			break;
		case EIPv6SocketInternalState::CanWrite:
			SelectStatus = select(Socket + 1, NULL, &SocketSet, NULL, &Time);
			break;
		case EIPv6SocketInternalState::HasError:
			SelectStatus = select(Socket + 1, NULL, NULL, &SocketSet, &Time);
			break;
	}

	// if the select returns a positive number, the socket had the state, 0 means didn't have it, and negative is API error condition (not socket's error state)
	return SelectStatus > 0  ? EIPv6SocketInternalState::Yes : 
		   SelectStatus == 0 ? EIPv6SocketInternalState::No : 
		   EIPv6SocketInternalState::EncounteredError;
#else
	UE_LOG(LogSockets, Fatal, TEXT("This platform doesn't support select(), but FSocketBSD::HasState was not overridden"));
	return EIPv6SocketInternalState::EncounteredError;
#endif
}
コード例 #4
0
int32 UKismetMathLibrary::GetMilliseconds( FTimespan A )
{
	return A.GetMilliseconds();
}